26. Programming with Geneva - New Data Types and Functions

Index,   Changes to exisiting functions,   Geneva.cnf, Help & other Docs
  1. New Data Types
  2. New Functions
    1. ay_return=appl_yield(void)
    2. xaf_return=x+appl_flags(int getset, int index, APPFLAGS *flags)
    3. xpf_return = x_appl_font( int getset, int zero, XFONTINFO *info )
    4. xas_return = x_appl_sleep( int id, int sleep )
    5. xat_return = x_appl_term( int apid, int retrn, int set_me )
    6. xfc_return = x_form_center( OBJECT *tree, int *cx, int *cy, int *cw, int *ch )
    7. xfe_return = x_form_error( char *fmt, int errnum )
    8. xff_return = x_form_filename( OBJECT *tree, int obj, int to_from, char *string )
    9. xfm_return = x_form_mouse( OBJECT *tree, int mouse_x, int mouse_y, int clicks, int *edit_obj, int *next_obj, int *edit_idx )
    10. xfs_return = x_fsel_input( char *inpath, int pathlen, char *files, int sels, int *exbutton, char *label )
    11. xgb_return = x_graf_blit( GRECT *source, GRECT *dest )
    12. xgr_return = x_graf_rubberbox(GRECT *area, GRECT *outer, int minwidth, int minheight, int maxwidth, int maxheight, int snap, int lag )
    13. xoe_return = x_objc_edit( OBJECT *tree, int edit_obj, int key_press, int shift_state, int *edit_idx, int mode )
    14. xwd_return = x_wdial_draw( int handle, int start, int depth )
    15. xwc_return = x_wdial_change( int handle, int object, int newstate )
    16. xwcr_return = x_wind_create( int kind, int xkind, int wx, int wy, int ww, int wh )
    17. xwca_return = x_wind_calc( int type, int kind, int xkind, int inx, int iny, int inw, int inh, int *outx, int *outy, int *outw, int *outh )
    18. xwt_return = x_wind_tree( int mode, WIND_TREE *wtree )
      1. Mode 0, X_WT_GETCNT (get count & flags)
      2. Mode 1, X_WT_READ (Read the current tree into the program's memory)
      3. Mode 2, X_WT_SET (Set count, flags, and tree address)
    19. xs_return = x_settings¥€int getset, int length, SETTINGS *user )
      1. "getset" mode:
    20. xsg_return = x_shel_get( int mode, int length, char *buf )
    21. xsp_return = x_shel_put( int mode, char *buf )
    22. void x_sprintf( char *buf, char *fmt, ... )
    23. void x_sscanf( char *buf, char *fmt, ... )
    24. xhe_return = x_help( char *topic, char *helpfile, int sensitive )


26.5. New Data Types

This section describes the new structures and constants used by the new functions found in Geneva. These are contained in XWIND.H. Note that all bitfields begin with the most significant bit first.

NameType Description
GENEVA_VER constantThe Geneva version for which XWIND.H was last updated
GENEVA_COOKIE constantThe cookie "Gnva"
G_COOKIEtypedef strucStructure pointed to by the "Gnva" cookie
> verint> Should contain GENEVA_VER
> process_name char pointer> Points to the name of the process currently using Geneva. This is in appl_find() format.
> apid int> Application ID of the process
> aes_funcspointer to array> Internal table of AES functions
> xaes_funcs pointer to array> Internal table of extended functions


Note: The function tables are subject to change in future versions. Please contact Gribnif Software before using them directly.

NameType Description
SET_VER constantThe current version returned in the SETTINGS structure
KEYCODEtypedef structKeypress description
> shift unsigned char> bit 0: Right Shift key held
> bit 1: Left Shift key held
> bit 2: Control key held
> bit 3: Alterna key held
> scanunsigned char> Scan code or zero
> asciiunsigned char> ASCII value or zero


Note: "ascii" is compared first with the ASCII value of the key which was pressed. If this fails, the scan code is compared. Currently, the key will match if either bit 0 or bit 1 of "shift" is set, and either [Shift] key is held by the user.

OB_PREFER typedef unionExtended object description
> sstruct > Bitmapped flags
>> outlined1 bit>> Object is OUTLINED
>> shadowed 1 bit>> Object is SHADOWED
>> draw_3D 1 bit>> Object is draw in 3D
>> rounded1 bit>> Object has round corners
>> reserved12 bits>> Reserved for future use
>> framecol4 bits>> Color of frame
>> textcol4 bits>> Color of text
>> textmode1 bit>> 0: transparent, 1: replace
>> fillpattern3 bits>> Fill pattern index
>> interiorcol4 bits>> Color of interior
> l unsigned long> Longword for accessing all flags
SETTINGS typedef structDescribes Geneva's global settings
> version int> Version SETTINGS is for, in BCD
> struct_lenint> Total # of bytes in SETTINGS
> boot_rezint> ST/TT resolution at startup
> falcon_rezint > Falcon video mode at startup
> flags union> Preferences
>> sstruct>> Bitmapped flags
>>> pulldown1 bit>>> 1: use pulldown menus
>>> insert_mode1 bit>>> 1: insert in dialog edits
>>> long_titles1 bit>>> long underlines X_UNDERLINE
>>>alerts_under_mouse 1 bit>>> alerts appear under mouse
>>> fsel_1col1 bit>>> 1 column in Item Selector
>>> grow_shrink1 bit>>> 1: FMD_GROW/SHRINK on
>>>ear_always_topped 1 bit>>> 1: tear aways always usable
>>> reserved9 bits>>> Reserved for future use
>> iunsigned int>> Word for accessing all flags
> gagdet_pauseint> # of 50 Hz timer tics to wait
> menu_startKEYCODE> Key to start menus
> app_switchKEYCODE> Key to toggle between apps
> ascii_tableKEYCODE> Key to open ASCII table
> redraw_allKEYCODE> Key to redraw whole screen
> wind_keys[13]KEYCODE> Keys for window events
> color_3D[4]OB_PREFER> Colors for 3D objects
> color_root[4]OB_PREFER>> Colors for root objects
> color_exit[4]OB_PREFER> Colors for EXIT objects
> color_other[4]OB_PREFER> Colors for other objects
> sort_typechar> fsel sort type, 0(Name) - 4(None)
> find_file[26]char> fsel Search string td>
> fsel_path[10][35]char> Item Selector paths
> fsel_ext[10][6]char> Item Selector extension strings


Note: The color_xx arrays are indexed depending upon the number of bitplanes in the current resolution: 1-plane=0, 2-planes=1, 4-planes=2, >4-planes=3. The wind_keys array is indexed using the following constants:

XS_UPPAGEconstantIndex for up page key
XS_DNPAGEconstantIndex for down page key
XS_UPLINEconstantIndex for up line key
XS_DNLINEconstantIndex for down line key
XS_LFPAGEconstantIndex for page left key
XS_RTPAGE constantIndex for page right key
XS_LFLINEconstantIndex for line left key
XS_RTLINEconstantIndex for line right key
XS_CLOSEconstantIndex for close box key
XS_CYCLEconstantIndex for cycle window key
XS_FULLconstantIndex for full window key
XS_LFINFOconstantIndex for info left key
XS_RTINFOconstantIndex for info right key
X_SHLOADSAVE constantx_shel_get/put load/save SETTINGS
X_SHOPENconstantx_shel_get/put start read/write
X_SHACCESSconstantx_shel_get/put do read/write
X_SHCLOSEconstantx_shel_get/put close
WIND_TREEtypedef structStructure for x_wind_tree
> handleint> Handle of window being modified
> countint> Number of objects in window
> flagint> Location to copy to/from
X_WT_GETCNTconstantx_wind_tree get count and flag
X_WT_READconstantx_wind_tree copy window tree
X_WT_SETconstantx_wind_tree set new tree
X_WTFL_RESIZEconstantAuto resize
X_WTFL_CLICKSconstantProcess clicks
X_WTFL_SLIDERSconstantResize sliders, info
X_WTFL_BLITSCRL constantUse blit for realtime scroll
WGCLOSEconstantCloser gadget
WGMOVEconstantMover
WGICONIZconstantSmaller (iconify)
WGBACKconstantSend to back
WGFULLconstantFuller
WGILEFT constantInfo left
WGINFOconstantInfo
WGIRTconstantInfo right
WGTOOLBOXconstantTool bar
WGMNLEFTconstantMenu left
WGMENUconstantMenu
WGMNRTconstantMenu right
WGUPconstantUp arrow 1
WGVBIGSLconstantVertical scroll bar 1
WGVSMLSLconstantVertical slider 1
WGDOWNconstantDown arrow 1
WGVSPLITconstantVertical split bar
WGUP2constantUp arrow 2
WGVBIGSL2constantVertical scroll bar 2
WGVSMLSL2constantVertical slider 2
WGDOWN2constantDown arrow 2
WGLEFTconstantLeft arrow 1
WGHBIGSLconstantHorizontal scroll bar 1
WGHSMLSLconstantHorizontal slider 1
WGRTconstantRight arrow 1
WGHSPLITconstantHorizontal split bar
WGLEFT2constantLeft arrow 2
WGHBIGSL2constantHorizontal scroll bar 2
WGHSMLSL2constantHorizontal slider 2
WGRT2constantRight arrow 2
WGSIZEcon1more than five lines of 30 characters each, and the pre-defined error messages can take up to three lines, there should be no more than two lines of text surrounding the inserted error text.

Example:


              if( x_form_error( "[1][Error!|%s][Continue|Quit]", -33 ) == 1 )

                    continue...

              else quit...



beginning of section
top of page

Convert to/from a standard GEMDOS filename in editable field in a dialog.


    control[0] = $7112

    control[1] = 2

    control[2] = 1

    control[3] = 2

    control[4] = 0



    intin[0]   = obj         Index of the editable object in the tree



    intin[1]   = to_from     Convert to (0) or from (1) the field



    intout[0]  = xff_return  Always 1



    addrin[0]  = tree        Object tree of the dialog containing

                              the editable field



    addrin[1]  = string      Pointer to the string containing the

                              GEMDOS-formatted (FILENAME.EXT) string.

Since filenames are typically entered in a GEM dialog using the period to separate the filename from the extension, and filenames with less than eight characters before the period are padded with spaces, converting to and from the editable field can be a difficult task.

When the mode parameter passed to x_form_filename() is 0, the string is converted from the FILENAME.EXT format to the editable field format. When mode is 1, the filename is converted from the editable field and written into string in FILENAME.EXT format. Note that this function assumes that the editable field is an object of type G_FTEXT or G_FBOXTEXT and uses the te_ptmplt string "________.___".

Example:




  OBJECT *tree;

  char name[13] = "DEFAULT.TXT";



  x_form_filename( tree, object, 0, name );

  form_do( tree, object );

  x_form_filename( tree, object, 1, name );

  /* "name" now contains what the user changed it to */  


beginning of section
top of page

26.6.9 xfm_return = x_form_mouse( OBJECT *tree, int mouse_x, int mouse_y, int clicks, int *edit_obj, int *next_obj, int *edit_idx )

Handle mouse clicks in a dialog, including editable cursor movement.


  control[0] = $7113

  control[1] = 6

  control[2] = 4

  control[3] = 1

  control[4] = 0



  intin[0]   = mouse_x     X coordinate of the mouse pointer

  intin[1]   = mouse_y     Y coordinate of the mouse pointer

  intin[2]   = clicks      Number of clicks to be processed

  intin[3]   = edit_obj    Object currently having the edit cursor

  intin[4]   = next_obj    Object selected with the mouse

  intin[5]   = edit_idx    Position of edit cursor within field  

  

  intout[0]  = xfm_return  0: An object was selected, 1: No object

  intout[1]  = edit_obj    New object having the edit cursor

  intout[2]  = next_obj    Selected object, or 0 for none

  intout[3]  = edit_idx    New edit cursor position



  addrin[0]  = tree

This function begins by calling form_button(). If neither an EXIT nor a TOUCHEXIT button is selected, and the object is EDITABLE, then the editable cursor is moved to the character within the editable field which is under the mouse pointer.

beginning of section
top of page

26.6.10 xfs_return = x_fsel_input( char *inpath, int pathlen, char *files, int sels, int *exbutton, char *label )

Extended file selector.


  control[0] = $7120

  control[1] = 2

  control[2] = 2

  control[3] = 3

  control[4] = 0



  intin[0]   = pathlen   Maximum length (incl. null) of inpath

  intin[1]   = sels      Maximum number of items that can be

                          selected upon return from the call



  intout[0]  = xfs_return  0: An error occurred

  intout[1]  = exbutton    0: The user selected Cancel

                           1: The user selected OK



  addrin[0]  = inpath    Pointer to the path (with wildcards)

                          to start selection at

  addrin[1]  = files     Pointer to the string containing the 

                          default filename to be displayed. 

Also, 

                    holds up to "sels" filenames (each 

                    null-terminated) upon return.

  addrin[2]  = label     A label of up to 30 characters, which 

                          will appear at the top of the item selector.

This function is similar to fsel_exinput(), but has several extensions:

  • The inpath parameter can contain not only the traditional * and ? wildcards, but can also contain regular expressions using [] and {}:
    • Any characters contained between square brackets ("[]") define a list of acceptable characters to substitute into that one position. This can either be individual characters, like "[ABCD]", a range separated by a hyphen like "[A-D]", or a mix of the two, like "[A-DXYZ]".
    • A list of words contained within curly brackets ("{}") defines one or more acceptable values. The values must be separated by commas.
  • The "pathlen" parameter defines the maximum length of inpath. If the user adds too many extensions or the path otherwise grows too long, an error alert will appear.
  • Upon successful return, files can contain up to sels filenames. Each name in the list is followed by a NULL character (ASCII 0) and the last filename is followed by a final NUL The exception to this rule is when sels is one, in which case the final NULL is not used; For all other cases, the area pointed to by files must be at least (13 * sels)+1 bytes long.


beginning of section
to bof page

26.6.11 xgb_return = x_graf_blit( GRECT *source, GRECT *dest )

Blit one area of the screen to another location, or save/restore a block of screen data.


  control[0] = $7130

  control[1] = 0

  control[2] = 1

  control[3] = 2

  control[4] = 0



  intout[0]  = xgb_return     0: Not enough memory for data to be

                                  stored

                              1: No error



  addrin[0]  = source    Address of source rectangle or NULL

  addrin[1]  = dest      Address of destination rectangle or NULL

If source and dest are both non-zero, then the function simply blits the screen data from one rectangle to the other.

If dest is NULL, then the operation saves the area of the screen specified by source in its internal buffer. When the function ise=ater called with source NULL and dest properly set, it will restore the area in the (new) location.

The internal buffer is large enough to hold 1/2 of the current screen. Exceeding this will cause Geneva to try to allocate enough memory to hold the screen data. If this fails, a zero will be returned in xgb_return. Since this buffer is also used by Geneva to hold the screen data for alerts and menus, and also by the item selector, you should always surround code which uses x_graf_blit() with wind_update() calls.

This example displays a dialog and uses a blit to restore what was underneath it:


          OBJECT *tree;

          GRECT r;

          rsrc_gaddr( 0, 0, &tree );            /* get dialog */

          form_center( tree, &r.g_x, &r.g_y,

                       &r.g_w, &r.g_h );        /* center it */

          wind_update( BEG_UPDATE );            /* lock menu bar */

          graf_blit( &r, 0L );                  /* save what's there */

          objc_draw( tree, 0, 8, r.g_x,

                     r.g_y, r.g_w, r.g_h );     /* draw dialog */

          form_do( tree, 0 );                   /* get user response */

          graf_blit( 0L, &r );                  /* now restore */

          wind_update( END_UPDATE );            /* re-enable menus */



beginning of section
top of page

26.6.12 xgr_return = x_graf_rubberbox(GRECT *area, GRECT *outer, int minwidth, int minheight, int maxwidth, int maxheight, int snap, int lag )

Extended rubberband box drawing.


  control[0] = $7131

  control[1] = 6

  control[2] = 1

  control[3] = 2

  control[4] = 0



  intin[0]   = minwidth  Minimum width of the rubberband box

  intin[1]   = minheight Minimum height of the box

  intin[2]   =enaxwidth  Maximum width of the box

  intin[3]   = maxheight Maximum height of the box

  intin[4]   = snap      Width/height increment

  intin[5]   = lag       0: Follow mouse exactly

                         1: Move relative to initial width & height

  intout[0]  = xgr_return     0: The mouse was released prematurely

                              1: No error



  addrin[0]  = area      Initial size of the rubberband box

  addrin[1]  = outer     Outer limit of the rubberband box

This function is similar to the AES function graf_rubberbox(), but it offers several extensions.

  • The area parameter points to a GRECT structure which describes the dimensions of the initial rubberband box. If the lag parameter is zero, then the g_w and g_h elements of area are ignored.

  • outer describes the size of the outside bounding rectangle. The rubberband box will never go outside this box. If this is a NULL pointer, the outside boundaries will be the whole desktop.

  • minwidth and minheight describe the minimum height of the rubberband box; maxwidth and maxheight are the maximums. If either of the minimums are greater than zero, then extended resizing is possible. In this mode, the mouse can be dragged to the left or top edge of the minimum area, and resizing happens in a manner similar to Geneva's extended window resizing.

  • snap is the number of pixels to jump by. If this value is greater than 1, the rubberband box will only move when its width or height is an even increment of this value.

  • The lag parameter says whether the rubberband box should exactly follow the mouse, or if it should stay a constant distance from the mouse pointer. When resizing a window, Geneva uses the lag mode so that if the resize gadget is released before the mouse is moved, the window will not be resized.


beginning of section
top of page

26.6.13 xoe_return = x_objc_edit( OBJECT *tree, int edit_obj, int key_press, int shift_state, int *edit_idx, int mode )

Process keyboard input into an editable field, with extensions.


  control[0] = $7140

  control[1] = 5

  control[2] = 2

  control[3] = 1

  control[4] = 0



  intin[0]   = edit_obj    Object being edited

  intin[1]   = key_press   Scan code and ASCII value of the key

  intin[2]   = edit_idx    Current cursor position within field

  intin[3]   = shift_state bit 0: R-Shift, 

                               1: L-Shift, 

                               2: Control

  intin[4]   = mode      1: initialize, 

                         2: edit, 

                         3: end edit



  intout[0]  = xoe_return  0: not an editable field, 

                           1: no error

  intout[1]  = edit_idx  New cursor position



  addrin[0]  = tree      OBJECT tree containing editable field

This function is nearly identical to the objc_edit() function normaly found in GEM. By adding the shift_state, however, it is able to correctly process extended keystrokes involving the [Control] and [Shift] keys.

beginning of section
top of page

26.6.14 xwd_return = x_wdial_draw( int handle, int start, int depth )

Redraw a dialog within a window.


  control[0] = $7150

  control[1] = 3

  control[2] = 1  control[3] = 0

  control[4] = 0



  intin[0]   = handle    Handle of the window having the dialog

  intin[1]   = start     First object to draw

  intin[2]   = depth     Level to draw until:

                          0: Draw just the object

                          1: Draw object & its immediate children

                          ...

                          8: Draw all levels of children



  intout[0]  = xwd_return 0: An error occurred

This function will redraw a dialog contained within a window. The dialog must have previously been set using the wind_set() option X_WF_DIALOG.

The dialog is redrawn, starting at start, continuing for depth levels, taking into account any other windows which may overlap the one being drawn.

An error code is returned if either the handle specified is not a valid window handle, if the window does not belong to the application making the x_wdial_draw() call, if the window does not contain a dialog, or if the window is not currently open.

beginning of section
top of page

26.6.15 xwc_return = x_wdial_change( int handle, int object, int newstate )

Redraw one object within a window dialog, showing a new state.


  control[0] = $7151

  control[1] = 3

  control[2] = 1

  control[3] = 0

  control[4] = 0



  intin[0]   = handle    Handle of the window having the dialog

  intin[1]   = object    Object whose state is changing

  intin[2]   = newstate  The object's new ob_state



  intout[0]  = xwc_return     0: An error occurred

This function will redraw an object in a dialog contained within a window, showing its new state. This is commonly used to show an exit button being selected or another button becoming disabled. The dialog must have previously been set using the wind_set() option X_WF_DIALOG.

An error code is returned if either the handle specified is not a valid window handle, if the window does not belong to the application making the x_wdial_draw() call, if the window does not contain a dialog, or if the window is not currently open.

beginning of section
top of page

26.6.16 xwcr_return = x_wind_create( int kind, int xkind, int wx,bunt wy, int ww, int wh )

Extended wind_create().


  control[0] = $7153

  control[1] = 6

  control[2] = 1

  control[3] = 0

  control[4] = 0



  intin[0]   = kind      Window type (ala wind_create())

  intin[1]   = xkind     Extended window type

  intin[2]   = wx        Window x-coordinate

  intin[3]   = wy        Window y-coordinate

  intin[4]   = ww        Window width

  intin[5]   = wh        Window height



  intout[0]  = xwcr_return    0: An error occurred

If you wish to use new or extended functions such as the X_MENU or split window attributes, then x_wind_create() must be used to create these windows.

begin±Æng of section
top of page

26.6.17 xwca_return = x_wind_calc( int type, int kind, int xkind, int inx, int iny, int inw, int inh, int *outx, int *outy, int *outw, int *outh )

Extended wind_calc().


  control[0] = $7154

  control[1] = 7

  control[2] = 5

  control[3] = 0

  control[4] = 0

If you wish to use new or extended functions such as the X_MENU or split window attributes, then x_wind_create() must be used to create these windows.

beginning of section
top of page

26.6.18 xwt_return = x_wind_tree( int mode, WIND_TREE *wtree )

Get or alter a window's OBJECT tree and gadget control flags.


  control[0] = $7152

  control[1] = 1

  control[2] = 1

  control[3] = 1

  control[4] = 0



  intin[0]   = mode 0: Get count & flags, 1: Read tree,

                                          2: Set count & flags



  intout[0]  = xwt_return     0: An error occurred



  addrin[0]  = wtree          Pointer to a WIND_TREE structure

This function alters the way in which Geneva draws and processes the gadgets of a particular window. This allows a program to take control over how gadgets react to the mouse, and also to add new gadgets.

The gadgets that make up a window are really just another OBJECT tree. This function allows you to modify it by (optionally) reading the current tree into a block of your program's memory. Geneva can then be informed that the modified tree (or, for that matter, any OBJECT tree) should be used for the window gadgets. Note:This function will only affect windows which have already been created.

If all you need to do in your program is to change the fill patterns or colors of a gadget, it is better to use wind_set( WF_COLOR ) to accomplish this task, if possible.

beginning of section
top of page

26.6.18.1. Mode 0, X_WT_GETCNT (get count & flags)

This mode must be used prior to mode 1. It sets the count element of the structure pointed to by wtree to contain the number of OBJECTS that make up the bendow's tree. The tree element is unchanged.

beginning of section
top of page

26.6.18.2. Mode 1, X_WT_READ (Read the current tree into the program's memory)

This mode copies count OBJECTS of the window's current tree into the array of OBJECTS pointed to by the tree element. The area of memory MUST be large enough to hold count elements.

Note that any objects in the resulting tree which have the HIDETREE ob_flag set are inactive, and their sizes and locations may be inaccurate.

If the tree which was being copied was the default OBJECT tree used by Geneva, then the ob_spec fields of the second (WGMOVE) and seventh (WGINFO) OBJECTS in the resulting copy will be zero. If this tree is then set (using mode 2, below), and the X_WTFL_RESIZE bit is on, then the programmer MUST modify these ob_spec's to point to TEDINFO structures! Otherwise, Geneva will attempt to set the title and info text in bad memory locations.

beginning of section
top of page

26.6.18.3. Mode 2, X_WT_SET (Set count, flags, and tree address)

This mode changes the attributes. If count is not less than zero, the window's OBJECT tree and count of objects will be set. The tree element must point to a static area of memory containing an OBJECT tree. The flags are always set, regardless of count.

The following bits are defined in the flags element. By default, they are all set (turned on) for any window that is created. Undefined bits are reserved for future use and should not be modified.

  • Flags bit 0, X_WTFL_RESIZE
    When set, the window's gadgets are automatically resized whenever the window's size is changed. If this bit is on, the ordering of the OBJECTs which make up the window's tree MUST not change. However, more objects can be appended to the end of the tree. When this bit is off, Geneva will never change the sizes, positions, flags, colors, or text of any object in the tree.
  • Flags bit 1, X_WTFL_CLICKS
    When set, the window responds normally to mouse clicks on the gadgets by moving the window, dragging the scroll bars, etc. When this bit is off, any mouse clicks (or keyboard equivalents for these actions) will be returned as either a WM_ARROWED message to indicate which arrow/scroll bar gadget was chosen, or an X_WM_SELECTED message for any other gadget. In this case, the program is responsible for taking an appropriate action. The Task Manager uses this bit in its "Keyboard..." dialog.
  • Flags bit 2, X_WTFL_SLIDERS
    When set, the sliders of a windowed dialog and info bar of a window will act normally. When it is off, the sliders for a windowed dialog will never change (even if the dialog is moved by the application), and clicking on the info left/right arrows will do nothing. The Task Manager uses this bit in its "Keyboard..." dialog.

Example:


/* Get the tree for a window, and change the appearence of 

the up and down arrows */

TEDINFO info_ted, mover_ted;

OBJECT *tree

WIND_TREE wt;

int handle;



/* Create a window */

if( (handle = wind_create( UPARROW|DNARROW|VSLIDE, 20, 20,

   200, 200 )) != 0 )

{

  /* Get the current count and flags */

  wt.handle = handle;  x_wind_tree( X_WT_GETCNT, &wt );

  /* Now allocate enough memory to hold the entire tree */

  if( (tree = Malloc( wt.count*sizeof(OBJECT) )) != 0 )

  {

     /* And get the tree */

     wt.tree = tree;

     x_wind_tree( X_WT_READ, &wt );

     /* Now, we *must* set these two TEDINFO's. The contents of the

        TEDINFO's is not important because the info and mover bars

        are not used */

     tree[WGMOVE].ob_spec.tedinfo = &mover_ted;

     tree[WGINFO].ob_spec.tedinfo = &info_ted;

     /* Modify the arrows. The up arrow will now be a '^' character,

        and the down arrow will be a 'v' */

     tree[WGUP].ob_spec.bfobspec.character = '^';

     tree[WGDOWN].ob_spec.bfobspec.character = 'v';

     x_wind_tree( X_WT_SET, &wt );

     /* All done! The window can be opened now, but don't forget to

        Mfree(tree) later on when it's closed. */

  }

}



beginning of section
top of page

26.6.19 xs_return = x_settings( int getset, int length, SETTINGS *user )

Get or set Geneva's internal settings.


  control[0] = $7180

  control[1] = 2

  control[2] = 1

  control[3] = 1

  control[4] = 0



  intin[0]   = getset    0 for Get, 1 for Set, -1 for Reset

  intin[1]   = length    # of bytes to get or set



  intout[0]  = xs_return Always 1



  addrin[0]  = user      Points to SETTINGS to get or set, or NULL



beginning of section
top of page
26.6.19.1. "getset" mode:

  • 0: Get
    Read length bytes (or the maximum length of the SETTINGS structure.) Setting length to a negative number will read the whole structure, though this is not recommended since future versions may expand the SETTINGS structure.

Example:


  SETTINGS set;

  x_settings( 0, sizeof(set), &set );


  • 1: Set
    Set length bytes (or the maximum length of the SETTINGS structure.) Setting length to a negative number will set the whole structure, though this is not recommended since future versions may expand the SETTINGS structure. The contents of user are not modified.

Example: Temporarily disable pulldowns:


  SETTINGS set;

  x_settings( 0, sizeof(set), &set );   /* get current */

  set.pulldown = 0;

  x_settings( 1, sizeof(set), &set );   /* turn off */  

  ...                                   /* do some stuff here */

  set.pulldown = 1;

  x_settings( 1, sizeof(set), &set );   /* turn back on */


  • -1: Reset
    Reset length bytes of the settings to their default values. If length is less than zero, all of the settings will be reset. The user parameter can be NULL, since it is not used.

This function always returns 1.

beginning of section
top of page

26.6.20 xsg_return = x_shel_get( int mode, int length, char *buf )

Read information from GENEVA.CNF.


  control[0] = $7181

  control[1] = 2

  control[2] = 1

  control[3] = 1

  control[4] = 0



  intin[0]   = mode      -1: Re-read Geneva's settings

                          0: Open GENEVA.CNF

                          1: Read a line

                          2: Close GENEVA.CNF

  intin[1]   = length     Number of bytes to read into "buf"



  intout[0]  = xsg_return-3: Incorrect GENEVA.CNF version

                             (mode -1)

                         -2: disk error

                         -1: Already in use (mode 0)

                          0: End of data or string not found

                          1: No error



  addrin[0]  = buf        Product string (mode 0) or buffer to

                           read "length" bytes of data into

                           (mode 1)

This function will cause Geneva to either re-read all of its own internal settings, or read the settings from an outside program's portion of GENEVA.CNF.

When mode is X_SHLOADSAVE (-1), Geneva will re-read all of its internal settings. The length and buf parameters are not used in this mode. The Task Manager's "Load Settings" option uses this.

In order to read its own settings, a program must begin by using mode X_SHOPEN (0) to open GENEVA.CNF. The name passed in buf can contain any character (including uppercase and punctuation) except the [ or ] characters. The length parameter is not used in this mode.

If the X_SHOPEN was successful, the program can then make repeated calls using the X_SHACCESS (1) mode. Here, length specifies the maximum number of bytes to read into the string buffer buf. The x_sscanf() function is very helpful for retreiving formatted data that has been read with x_shel_get();

If an error occurs at any time during the open or read phases (or if the program's section of GENEVA.CNF ends), the file is automatically closed. If a program wants to end the reading sooner, it must use mode X_SHCLOSE (2) to close the file. Otherwise, any future attempts to read from the file will fail.

Example:


int sh_error( int err )

{

  switch(err) {     case -2:

     Cconws( "Disk error" );

     return 1;

     case -1:

     Cconws( "GENEVA.CNF is already in use by another program" );

     return 1;

     case 0:

     Cconws( "Read failed unexpectedly" );

     return 1;

     default:

     return 0;

  }

}



main() {

  char buffer[100];

  int version, number1, number2;



  if( !sh_error( x_shel_get(X_SHOPEN,0,"My Program") ) )

     if( !sh_error( x_shel_get(X_SHACCESS,sizeof(buffer),buffer) ) )

     {

       x_sscanf( buffer, "%v", &version );

       if( version != 0x200 ) {

          Cconws( "Not compatible with version 2.0!" );

          x_shel_get( X_SHCLOSE, 0, 0L );

          return;

       }

       if( !sh_error( x_shel_get(X_SHACCESS,sizeof(buffer),

          buffer) ) )

       x_sscanf( buffer, "%x %d", number1, number2 );

       x_shel_get( X_SHCLOSE, 0, 0L );

     }

}



beginning of section
top of page

26.6.21 xsp_return = x_shel_put( int mode, char *buf )

Save a program's own settings, or Geneva's settings, to GENEVA.CNF.


        control[0] = $7182

        control[1] = 1

        control[2] = 1

        control[3] = 1

        control[4] = 0



        intin[0]   = mode           -1: Save Geneva's settings

                                     0:  Open GENEVA.CNF

                                     1:  Write a line

                                     2:  Close GENEVA.CNF



        intout[0]  = xsp_return     -2: Disk error

                                    -1: Already in use (mode 0)

                                     0:  File not open or incorrect mode

                                     1:  No error



        addrin[0]  = buf             Null-terminated string to write

When mode is X_SHLOADSAVE (-1), Geneva will save all of its internal settings. The length and buf parameters are not used in this mode.

The Task Manager's Save Settings option uses this.

In order to save its own settings, a program must begin by using mode X_SHOPEN (0) to open GENEVA.CNF. The name passed in buf can contain any character (including uppercase and punctuation) except the [ or ] characterli The length parameter is not used in this mode.

If the X_SHOPEN was successful, the program can then make repeated calls using the X_SHACCESS (1) mode. Here, buf points to a null-terminated string to write. The string should be no more than 80 characters of readable text, and must not include the [ or ] characters. If the first character of the string is a semi-colon ";", it will be treated as a comment when read by x_shel_get(). The x_sprintf() function is very helpful for formatting data for x_shel_put();

If an error occurs at any time during the open or write phases the file is automatically closed. If no errors occur, the program must use mode X_SHCLOSE (2) to close the file. Otherwise, any future attempts to write to the file will fail.

beginning of section
top of page

26.6.22 void x_sprintf( char *buf, char *fmt, ... )

Print data to a string, with extended formats.


  control[0] = $7183

  control[1] = 0

  control[2] = 0

  control[3] = 3

  control[4] = 0



  addrin[0]  = buf             Buffer to receive output string

  addrin[1]  = fmt             Null-terminated format string

  addrin[2]  = &...            Pointer to first argument on user stack

This function acts almost identically to the sprintf() function found in C programming libraries. It understands the following format specifiers:


          %c   Character

          %s   String

          %x   Unsigned int in hexadecimal

          %X   Unsigned long in hexadecimal

          %d   Signed int in decimal

          %D   Signed long in decimal

          %o   Signed int in octal

          %b   Boolean:  'F' for 0, or 'T' for non-zero

          %k   When passed a pointer to a KEYCODE structure, output all

                three elements using the format "%02x %02x %02x"

          %v   Take the int argument and output the MSB and LSB in the

                format "%x.%02x". Used for generating version numbers.

          %S   Surround the string with curly braces, so that a string

                containing spaces can be read back in correctly with the x_sscanf() function

          %h   Same as %x

These prefixes can be used before the string and number formats:


  -    Left-justified, instead of right-justified

  0    Pad with 0's insteausof spaces

  0-9  Any number of digits (following a possible first '0' for padding)

        specify the field length, in decimal



  Example:                                   Result:

  x_sprintf( str, "%04x", 0xFE );            00FE

  x_sprintf( str, "%-06s", "Hi!" );          Hi!000

  x_sprintf( str, "%6s", "Hi!" );            Hi!

  x_sprintf( str, "%b %v", 2, 0x502 );       T 5.02

  x_sprintf( str, "%S %s", "a b", "c d" );   {a b} c d

  KEYCODE key = { 1, 0, 'X' };

  x_sprintf( str, "key=%k", &key );          keyd 1 00 58  

This sort of thing doesn't really belong in a GUI, but it made sense to include it, since it is used by Geneva internally, anyway.

beginning of section
top of page

26.6.23 void x_sscanf( char *buf, char *fmt, ... )

Read formatted data from a string, with extended formats.


  control[0] = $7184

  control[1] = 0

  control[2] = 0

  control[3] = 3

  control[4] = 0



  addrin[0]  = buf     Buffer containing data

  addrin[1]  = fmt     Null-terminated format string

  addrin[2]  = &...    Pointer to first argument on user stack

This function acts almost identically to the sscanf() function found in C programming libraries. It understands the following format specifiers:


  %c   Character

  %s   String

  %x   Unsigned int in hexadecimal

  %X   Unsigned long in hexadecimal

  %d   Signed int in decimal

  %D   Signed long in decimal

  %o   Signed int in octal

  %b   Boolean into char:  0 for 'F', or 1 for 'T'

  %k   When passed a pointer to a KEYCODE structure, scan all three 

       elements using the format "%x %x %x"

  %v   Scan for the MSB and LSB of an int using the format

       "%x.%x". Used for reading version numbers.

  %S   String surrounded with curly braces. This allows a string 

       containing spaces to be read back in as one string.

  %h   Unsigned char in hexadecimal

The x_sscanf() function does not understand any format prefixes.


  Example:                                   Result:

  int i;

  char str[10], str2[10], bool;

  KEYCODE key;

  x_sscanf( "FE", "%x", &i );                i = 0xFE

  x_sscanf( "Hi!", "%s", str );              str = "Hi!"

  x_sscanf( "T 5.02", "%b %v", &bool, &i );  bool = 1, i = 0x502

  x_sscanf( "{a b} c", "%S %s", str, str2 ); str = "a b", str2 = "c"

  x_sprintf( "01 00 58", "%k", &key );       key = { 1, 0, 58 };

This sort of thing doesn't really bong in a GUI, but it made sense to include it, since it is used by Geneva internally, anyway.

begrening of section
top of page

26.6.24 xhe_return = x_help( char *topic, char *helpfile, int sensitive )

Inform the Help display program of a request for help text.


        control[0] = $7185

        control[1] = 1

        control[2] = 1

        control[3] = 2

        control[4] = 0



        intin[0]   = sensitive       0: "topic" is not case-sensitive



        intout[0]  = xhe_return      0: an error occurred



        addrin[0]  = topic           Help topic to search for

        addrin[1]  = helpfile        GEMDOS file name to search first 

                                      for the help topic, or NULL to 

                                      search only GENEVA.HLP.

This function is used by a program to provide online help for its features.

Geneva begins by checking to see if the help display program is already in memory. If it is not, then it is loaded from disk by way of the SHOWHELP environmental variable, as set in GEM.CNF.

Once the program is in memory, it is sent a message containing the values passed in the x_help() function call. The user is then either shown the help text, or an error message saying that the topic was not found.

The topic parameter points to a NUL-terminated string containing the help topic to search for. If sensitive is non-zero, then the case (upper/lower) of the topic must exactly match what is stored in the help file. If, however, sensitive is zero, both the case-sensitive and case-insensitive sections of the help file are searched for the topic.

filename points to a NUL-terminated string describing the path and file name of the default help file to search for the topic. If no path information is used, then the PATH environmental variable is searched (by way of shel_find()) for the file. If this file is not found, or the topic is not found in the file, the user receives an error message. If filename is NULL (0L), then the topic is only searched for in GENEVA.HLP.

An error code is returned if either the help program could not be loaded, or there was insufficient free memory to send the message.

beginning of section,  Index,   Next section (Geneva.cnf, Help and other Docs,  Previous section
top of page