GEOS SDK TechDocs
|
|
4 Managing Rulers
|
4.2 Mouse Tracking
The RulerShowControl allows the user to show or hide rulers. This control works by setting RulerViews not usable. However, objects which aren't usable don't work with GCN, and thus you will need to set up some other object to intercept the appropriate notifications. Don't try to include a RulerShowControl unless you know about GCN or are willing to learn.
When declaring your RulerShowControl, you may choose a GCN list which the control will work with. The default list is MANUFACTURER_ID_GEOWORKS:
GAGCNLT_DISPLAY_OBJECTS_WITH_RULERS. However, you may change this to be any list you like. You must also specify a message which some object will respond to.
Some object which will be usable when the user has access to the RulerShowControl should be on the control's GCN list. This object must be prepared to handle the message in the
RSCI_message
field. This message should take a RulerShowControlAttributes structure and set the ruler views usable or not usable accordingly. See Sample Handler for use with RulerShowControl
for an example.
Code Display 19-3 RulerShowControl Instance Data and Features
typedef WordFlags RSCCFeatures; #define RSCCF_SHOW_VERTICAL (0x04) #define RSCCF_SHOW_HORIZONTAL (0x02) #define RSCCF_SHOW_RULERS (0x01)
typedef WordFlags RSCCToolboxFeatures; /* There are no toolbox features. */
#define RSCC_DEFAULT_FEATURES (RSCCF_SHOW_VERTICAL | RSCCF_SHOW_HORIZONTAL) #define RSCC_DEFAULT_TOOLBOX_FEATURES (0)
@instance RulerShowControlAttributes RSCI_attrs; typedef WordFlags RulerShowControlAttributes; #define RSCA_SHOW_VERTICAL 0x8000 #define RSCA_SHOW_HORIZONTAL 0x4000
@instance GCNListType RSCI_gcnList; /* object to notify */
@instance Message RSCI_message; /* message to notify with */
Code Display 19-4 Sample Handler for use with RulerShowControl
@method MyDisplayClass, MSG_MD_UPDATE_RULERS /* The RulerShowControl's RSCI_message field should be * MSG_MD_UPDATE_RULERS. The message should have been declared * using the RULER_SHOW_CONTROL_NOTIFY prototype. */
if (attrs & RSCA_SHOW_VERTICAL) {
@call LeftView::MSG_GEN_SET_USABLE(VUM_NOW);
}
else {
@call LeftView::MSG_GEN_SET_NOT_USABLE(VUM_NOW);
}
if (attrs & RSCA_SHOW_HORIZONTAL) {
@call TopView::MSG_GEN_SET_USABLE(VUM_NOW);
}
else {
@call TopView::MSG_GEN_SET_NOT_USABLE(VUM_NOW);
}
}
GEOS SDK TechDocs
|
|
4 Managing Rulers
|
4.2 Mouse Tracking