Article # 204, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
How to make a dialog box with no triggers.
Q. How can I have a small dialog on the screen that doesn't have any of the default Ok or Cancel triggers on it? A. Yes, here is some sample code that explains the necessary hints and attributes to make a dialog with no triggers. Note that this code can be made to work on any GEOS platform, although this particular sample was written for the Nokia 9000 Communicator. /* * This object groups all the program-initiated * objects together into one place. See the * SDK_C/GENINTER sample application for an * explanation of this concept. */ @object GenInteractionClass PopUpHiddenGroup = { GI_comp = @PopUpFlashBox; GII_attrs = @default | GIA_NOT_USER_INITIATABLE; } /* * This is the popup dialog. It has one child, the * text input object PopUpFlashText. */ @object GenInteractionClass PopUpFlashBox = { GI_comp = @PopUpFlashText; GII_attrs = @default | GIA_NOT_USER_INITIATABLE | GIA_INITIATED_VIA_USER_DO_DIALOG | GIA_MODAL; GII_visibility = GIV_DIALOG; /* * This prevents the automatic Ok and Cancel triggers * from appearing. */ GII_type = GIT_MULTIPLE_RESPONSE; /* * This makes the window the correct size (small). */ HINT_WINDOW_NO_TITLE_BAR; /* * Modify these two values to position the dialog * on the screen, relative to the primary window. */ HINT_POSITION_WINDOW_AT_RATIO_OF_PARENT = { SWSS_RATIO | PCT_15, SWSS_RATIO | PCT_5 }; } /******************************************************************** * Code for PopUpApplicationClass * This class is just a subclass of FoamSubApplicationClass. You * could use GenApplicationClass if you're writing for some other * version of GEOS. *******************************************************************/ /******************************************************************** * MSG_META_KBD_CHAR ******************************************************************** * SYNOPSIS: Intercept the keyboard press at the application * level. Here we can handle it appropriately. * PARAMETERS: word character * word flags * word state * RETURNS: void * SIDE EFFECTS: none * STRATEGY: First call the superclass so the default keypress * handling behavior is performed. Then check to see * that this is the release of the spacebar. If it is * then we can initiate the popup dialog. * REVISION HISTORY: * Name Date Description * ---- ---- ----------- * NF 1/7/97 Initial version *******************************************************************/ @method PopUpApplicationClass, MSG_META_KBD_CHAR { /* * icReply - Return value from UserDoDialog. Indicates how the * dialog was closed. */ InteractionCommand icReply; @callsuper(); if ( ( flags & CF_RELEASE ) && ( ' ' == character ) ) { icReply = UserDoDialog( @PopUpFlashBox ); /* * icReply will be one of several things: * IC_OK - User hit Enter. * IC_DISMISS - User hit Esc. * IC_NULL - System is shutting down. */ if ( IC_OK == icReply ) { /* * Dismiss the interaction since IC_OK doesn't * do that automatically. * Here you can grab text from PopUpFlashText. */ @send PopUpFlashBox::MSG_GEN_GUP_INTERACTION_COMMAND( IC_DISMISS ); } } } /* MSG_META_KBD_CHAR */ /******************************************************************** * Code for PopUpTextClass * This is just a subclass of GenTextClass. *******************************************************************/ /******************************************************************** * MSG_META_KBD_CHAR ******************************************************************** * SYNOPSIS: Intercept the keyboard press at the input text * level. Here we can handle it appropriately. * PARAMETERS: word character * word flags * word state * RETURNS: void * SIDE EFFECTS: none * STRATEGY: First call the superclass so the default keypress * handling behavior is performed. Then check to see * that this is either a Return or an Esc. * REVISION HISTORY: * Name Date Description * ---- ---- ----------- * NF 1/7/97 Initial version *******************************************************************/ @method PopUpTextClass, MSG_META_KBD_CHAR { /* * Superclass for single-line GenText doesn't * do anything with Enter or Esc. */ @callsuper(); if ( flags & CF_RELEASE ) { if ( C_ENTER == ( character & 0x00FF ) ) { @send PopUpFlashBox::MSG_GEN_GUP_INTERACTION_COMMAND( IC_OK ); } if ( C_ESCAPE == ( character & 0x00FF ) ) { @send PopUpFlashBox::MSG_GEN_GUP_INTERACTION_COMMAND( IC_DISMISS ); } } } /* MSG_META_KBD_CHAR */