The following functions were introduced with MagiC 4 and WDIALOG. They permit simple construction of dialog boxes in windows:
• wdlg_close | Closes a window-dialog |
• wdlg_create | Creates a window-dialog |
• wdlg_delete | Releases memory of closed window-dialog |
• wdlg_evnt | Evaluates the dialog-events |
• wdlg_get_edit | Obtains current editable field |
• wdlg_get_handle | Obtains window ID of a dialog |
• wdlg_get_tree | Obtains object tree of the window |
• wdlg_get_udata | Obtains user data |
• wdlg_open | Opens a window-dialog |
• wdlg_redraw | Draws an object in a window-dialog |
• wdlg_set_edit | Activates editable field in the dialog |
• wdlg_set_iconify | Iconifies a window-dialog |
• wdlg_set_size | Alters the size of a dialog |
• wdlg_set_tree | Anchors a new object tree in the dialog |
• wdlg_set_uniconify | Uniconifies a window-dialog |
Note: The existence of these functions can be checked for with appl_getinfo (opcode 7).
See also: Window management Style guidelines WDIALOG
Name: | »Window-dialog close« - Close a window-dialog
| ||||||||||
Opcode: | 162
| ||||||||||
Syntax: | int16_t wdlg_close ( DIALOG *dialog, int16_t *x, int16_t *y );
| ||||||||||
Description: | The function wdlg_close closes the window-dialog
dialog. The following apply:
Note: Old WDIALOG versions do not return the window coordinates. In that case the binding enters -1, so that the dialog will be centred automatically at the next call. | ||||||||||
Return value: | The function always returns the value 1.
| ||||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||||||
Group: | Window-dialogs
| ||||||||||
See also: | Binding wdlg_open
|
C: | int16_t wdlg_close ( DIALOG *dialog, int16_t *x, int16_t *y );
| ||||||||||||||||||||||||
Binding: |
int16_t wdlg_close ( DIALOG *dialog, int16_t *x, int16_t *y ) { int_out[1] = -1; int_out[2] = -1; addr_in[0] = dialog; crys_if (162); *x = int_out[1]; *y = int_out[2]; return ( int_out[0] ); } | ||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog create« - Create a window-dialog
| ||||||||||||||||
Opcode: | 160
| ||||||||||||||||
Syntax: | DIALOG *wdlg_create ( HNDL_OBJ handle_exit, OBJECT *tree, void
*user_data, int16_t code, void *data, int16_t flags );
| ||||||||||||||||
Description: | The function wdlg_create allocates memory for a dialog
structure and initializes it. The following apply:
| ||||||||||||||||
Return value: | Pointer to the dialog structure.
| ||||||||||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||||||||||||
Group: | Window-dialogs
| ||||||||||||||||
See also: | Binding wdlg_open wdlg_close
|
C: | DIALOG *wdlg_create ( HNDL_OBJ handle_exit, OBJECT *tree, void
*user_data, int16_t code, void *data, int16_t flags );
| |||||||||||||||||||||||||||||||||||||||
Binding: |
DIALOG *wdlg_create ( HNDL_OBJ handle_exit, OBJECT *tree, void *user_data, int16_t code, void *data, int16_t flags ) { addr_in[0] = handle_exit; addr_in[1] = tree; addr_in[2] = user_data; addr_in[3] = data; int_in[0] = code int_in[1] = flags; crys_if (160); return ( addr_out[0] ); } | |||||||||||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog delete« - Release memory used by a closed
window-dialog
| ||||
Opcode: | 163
| ||||
Syntax: | int16_t wdlg_delete ( DIALOG *dialog );
| ||||
Description: | The function wdlg_delete releases the memory allocated for a
window-dialog that has been closed. The following applies:
| ||||
Return value: | The function always returns the value 1.
| ||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||
Group: | Window-dialogs
| ||||
See also: | Binding wdlg_close
|
C: | int16_t wdlg_delete ( DIALOG *dialog );
| ||||||||||||||||||||||||
Binding: |
int16_t wdlg_delete ( DIALOG *dialog ) { addr_in[0] = dialog; crys_if (163); return ( int_out[0] ); } | ||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog event« - Evaluate dialog-events
| ||||||
Opcode: | 166
| ||||||
Syntax: | int16_t wdlg_evnt ( DIALOG *dialog, EVNT *events );
| ||||||
Description: | The call wdlg_evnt serves for evaluating or handling events in
a window-dialog. The following apply:
Note: This function must be called in an event-loop. The event-bits that refer to the window-dialog are cleared in the bit-vector mwhich. Following wdlg_evnt the EVNT-structure of the application can be used to evaluate the events intended for it. If wdlg_evnt returns a 0, the window-dialog has to be closed (call (wdlg_close). Note: The iconify-event is not supported by wdlg_evnt. Those wanting to install the Iconifier icon as a window object during wdlg_open therefore have to evaluate this event and process it themselves. The same applies if one wants to install the Sizer icon as an object. | ||||||
Return value: | The function returns the value 1 if no error has arisen. With a
return value of 0, the dialog must be closed.
| ||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||
Group: | Window-dialogs
| ||||||
See also: | Binding wdlg_open wdlg_close
|
C: | int16_t wdlg_evnt ( DIALOG *dialog, EVNT *events );
| |||||||||||||||||||||||||||
Binding: |
int16_t wdlg_evnt ( DIALOG *dialog, EVNT *events ) { addr_in[0] = dialog; addr_in[1] = events; crys_if (166); return ( int_out[0] ); } | |||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog get edit« - Obtain current editable field
| ||||||||
Opcode: | 164 (sub-opcode 1)
| ||||||||
Syntax: | int16_t wdlg_get_edit ( DIALOG *dialog, int16_t *cursor );
| ||||||||
Description: | The function wdlg_get_edit returns the index of the current
editable object. The following apply:
Note: With old WDIALOG versions cursor is not returned. The binding ensures that -1 is entered in this case. | ||||||||
Return value: | This function returns the index of the current editable object.
If the result is 0, then no editable object is active at the present
time.
| ||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||||
Group: | Window-dialogs
| ||||||||
See also: | Binding wdlg_open wdlg_close
|
C: | int16_t wdlg_get_edit ( DIALOG *dialog, int16_t *cursor );
| ||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_get_edit ( DIALOG *dialog, int16_t *cursor ) { addr_in[0] = dialog; int_in[0] = 1; int_out[1] = -1; crys_if (164); *cursor = int_out[1]; return ( int_out[0] ); } | ||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog get window handle« - Obtain window ID of a
dialog
| ||||
Opcode: | 164 (sub-opcode 3)
| ||||
Syntax: | int16_t wdlg_get_handle ( DIALOG *dialog );
| ||||
Description: | The call wdlg_get_handle obtains the window ID (the
window-handle) of a window-dialog. The following apply:
| ||||
Return value: | The function returns the AES handle of the dialog-window.
| ||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||
Group: | Window-dialogs
| ||||
See also: | Binding wind_find
|
C: | int16_t wdlg_get_handle ( DIALOG *dialog );
| |||||||||||||||||||||||||||
Binding: |
int16_t wdlg_get_handle ( DIALOG *dialog ) { addr_in[0] = dialog; int_in[0] = 3; crys_if (164); return ( int_out[0] ); } | |||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog get tree« - Obtain object tree of the window
| ||||||||
Opcode: | 164 (sub-opcode 0)
| ||||||||
Syntax: | int16_t wdlg_get_tree ( DIALOG *dialog, OBJECT **tree, GRECT *r
);
| ||||||||
Description: | The call wdlg_get_tree obtains the address of the object-tree
displayed in the window. The following apply:
Note: In addition, the function returns the size of the working area of the window. If the dialog size has not been altered with wdlg_set_size, then the working area corresponds to the GRECT of the root object. | ||||||||
Return value: | The function always returns the value 1.
| ||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||||
Group: | Window-dialogs
| ||||||||
See also: | Binding wdlg_get_handle
|
C: | int16_t wdlg_get_tree ( DIALOG *dialog, OBJECT **tree, GRECT *r
);
| |||||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_get_tree ( DIALOG *dialog, OBJECT **tree, GRECT *r ) { addr_in[0] = dialog; addr_in[1] = tree; addr_in[2] = r; int_in[0] = 0; crys_if (164); return ( int_out[0] ); } | |||||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog get user data« - Obtain the user-data of a
window-dialog
| ||||
Opcode: | 164 (sub-opcode 2)
| ||||
Syntax: | void *wdlg_get_udata ( DIALOG *dialog );
| ||||
Description: | The call wdlg_get_udata obtains the user data of a
window-dialog. The following applies:
| ||||
Return value: | This function returns the variable user_data that was
passed at the wdlg_create call.
| ||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||
Group: | Window-dialogs
| ||||
See also: | Binding wdlg_get_handle
|
C: | void *wdlg_get_udata ( DIALOG *dialog );
| |||||||||||||||||||||||||||
Binding: |
void *wdlg_get_udata ( DIALOG *dialog ) { addr_in[0] = dialog; int_in[0] = 2; crys_if (164); return ( addr_out[0] ); } | |||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog open« - Opens a window-dialog
| ||||||||||||||||
Opcode: | 161
| ||||||||||||||||
Syntax: | int16_t wdlg_open ( DIALOG *dialog, int8_t *title, int16_t
kind, int16_t x, int16_t y, int16_t code, void *data );
| ||||||||||||||||
Description: | The call wdlg_open opens a window-dialog on the screen. The
following apply:
Note: Before wdlg_open returns to the caller, the service routine handle_exit() (see above) is called with the function number HNDL_OPEN. | ||||||||||||||||
Return value: | Handle of the dialog window (0: Error)
| ||||||||||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||||||||||||
Group: | Window-dialogs
| ||||||||||||||||
See also: | Binding wdlg_close wdlg_delete
|
C: | int16_t wdlg_open ( DIALOG *dialog, int8_t *title, int16_t
kind, int16_t x, int16_t y, int16_t code, void *data );
| ||||||||||||||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_open ( DIALOG *dialog, int8_t *title, int16_t kind, int16_t x, int16_t y, int16_t code, void *data ) { addr_in[0] = dialog; addr_in[1] = title; addr_in[2] = data; int_in[0] = kind; int_in[1] = x; int_in[2] = y; int_in[3] = code; crys_if (161); return ( int_out[0] ); } | ||||||||||||||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog redraw« - Draw an object in a window-dialog.
| ||||||||||
Opcode: | 167
| ||||||||||
Syntax: | void wdlg_redraw ( DIALOG *dialog, GRECT *rect, int16_t obj,
int16_t depth );
| ||||||||||
Description: | The call wdlg_redraw draws an object in a window-dialog while
respecting the rectangle list of the window. The following apply:
Note: If one wants to draw an object within the dialog then one should always use wdlg_redraw and not objc_draw. Before calling wdlg_redraw, just as before and after objc_draw, a wind_update call is necessary. | ||||||||||
Return value: | The function does not return a result.
| ||||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||||||
Group: | Window-dialogs
| ||||||||||
See also: | Binding objc_draw WM_REDRAW
|
C: | void wdlg_redraw ( DIALOG *dialog, GRECT *rect, int16_t obj,
int16_t depth );
| ||||||||||||||||||||||||||||||
Binding: |
void wdlg_redraw ( DIALOG *dialog, GRECT *rect, int16_t obj, int16_t depth ) { addr_in[0] = dialog; addr_in[1] = rect; int_in[0] = obj; int_in[1] = depth; crys_if (167); } | ||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog set edit object« - Activate editable field in
the window-dialog
| ||||||
Opcode: | 165 (sub-opcode 0)
| ||||||
Syntax: | int16_t wdlg_set_edit ( DIALOG *dialog, int16_t obj );
| ||||||
Description: | The call wdlg_set_edit activates an editable object. The
following apply:
Note: Activates an editable object, i.e. the cursor will be drawn in the specified object and deleted from any previously active object. | ||||||
Return value: | The function returns the number of the current edit object. The
value 0 means that none ist active.
| ||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||
Group: | Window-dialogs
| ||||||
See also: | Binding wdlg_open wdlg_close
|
C: | int16_t wdlg_set_edit ( DIALOG *dialog, int16_t obj );
| ||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_set_edit ( DIALOG *dialog, int16_t obj ) { addr_in[0] = dialog; int_in[0] = 0; int_in[1] = obj; crys_if (165); return ( int_out[0] ); } | ||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog iconify« - Iconify a window-dialog
| ||||||||||||
Opcode: | 165 (sub-opcode 3)
| ||||||||||||
Syntax: | int16_t wdlg_set_iconify ( DIALOG *dialog, GRECT *g, int8_t
*title, OBJECT *tree, int16_t obj );
| ||||||||||||
Description: | The call wdlg_set_iconify permits the iconifying of a
window-dialog. The following apply:
Note: The new position of the window will be adopted normally from the message WM_ICONIFY; but it is also possible to let MagiC obtain this directly by passing coordinates of -1,-1,-1,-1. The function alters the position and size of the root object. As, in general, one would like to display a different object tree for an iconified window, this can be specified in the parameter tree. The object tree normally consists of a root object (G_BOX) and an icon to be displayed of the type G_ICON or G_CICON. If the icon is to be displayed centred in the window, then one passes its object index in parameter obj. When setting a new window title, one must bear in mind that at a later uniconify the user must restore the old title himself. | ||||||||||||
Return value: | The function always returns the value 1.
| ||||||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7). This function is only present from WDIALOG 1.05 onwards.
If it is not present, intout[0] contains a 0.
| ||||||||||||
Group: | Window-dialogs
| ||||||||||||
See also: | Binding wdlg_set_uniconify
|
C: | int16_t wdlg_set_iconify ( DIALOG *dialog, GRECT *g, int8_t
*title, OBJECT *tree, int16_t obj );
| |||||||||||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_set_iconify ( DIALOG *dialog, GRECT *g, int8_t *title, OBJECT *tree, int16_t obj ) { addr_in[0] = dialog; addr_in[1] = g; addr_in[2] = title; addr_in[3] = tree; int_in[0] = 3; int_in[1] = obj; crys_if (165); return ( int_out[0] ); } | |||||||||||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog set size« - Alter the size of a window-dialog
| ||||||||
Opcode: | 165 (sub-opcode 2)
| ||||||||
Syntax: | int16_t wdlg_set_size ( DIALOG *dialog, GRECT *new_size );
| ||||||||
Description: | The call wdlg_set_size makes it possible to alter the size of a
window-dialog. The following apply:
Note: The function can alter position or size of a window-dialog. If the root object is to be moved or enlarged then the object dimensions have to be altered before calling wdlg_set_size. The buttons must always lie completely within the window's working area, as form_button pays no regard to the rectangle list. The normal use for wdlg_set_size are enlargeable dialogs that have a Sizer object at the bottom right corner. | ||||||||
Return value: | The function always returns the value 1.
| ||||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||||
Group: | Window-dialogs
| ||||||||
See also: | Binding wdlg_open wdlg_close
|
C: | int16_t wdlg_set_size ( DIALOG *dialog, GRECT *new_size );
| ||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_set_size ( DIALOG *dialog, GRECT *new_size ) { addr_in[0] = dialog; addr_in[1] = new_size; int_in[0] = 2; crys_if (165); return ( int_out[0] ); } | ||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog set tree« - Anchor a new object tree in the
window-dialog
| ||||||
Opcode: | 165 (sub-opcode 1)
| ||||||
Syntax: | int16_t wdlg_set_tree ( DIALOG *dialog, OBJECT *new_tree );
| ||||||
Description: | The call wdlg_set_tree anchors a new object tree in a
window-dialog. The following apply:
Note: If the new root object has a different size, then the window size will be adapted automatically; the window contents will be updated in every case. | ||||||
Return value: | The function always returns the value 1.
| ||||||
Availability: | The presence of this call should be checked for using appl_getinfo
(Opcode 7).
| ||||||
Group: | Window-dialogs
| ||||||
See also: | Binding wdlg_open wdlg_close
|
C: | int16_t wdlg_set_tree ( DIALOG *dialog, OBJECT *new_tree );
| ||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_set_tree ( DIALOG *dialog, OBJECT *new_tree ) { addr_in[0] = dialog; addr_in[1] = new_tree; int_in[0] = 1; crys_if (165); return ( int_out[0] ); } | ||||||||||||||||||||||||||||||
GEM-Arrays: |
|
Name: | »Window-dialog uniconify« - Uniconify a window-dialog
| ||||||||||
Opcode: | 165 (sub-opcode 4)
| ||||||||||
Syntax: | int16_t wdlg_set_uniconify ( DIALOG *dialog, GRECT *g, int8_t
*title, OBJECT *tree );
| ||||||||||
Description: | The call wdlg_set_uniconify makes it possible to uniconify a
window-dialog. The following apply:
Note: The new position of the window will be adopted normally from the message WM_UNICONIFY. The function alters the position and size of the root object. As, in general, one has displayed a different object tree for an iconified window, the original tree can be specified in the parameter tree and so restored. With the parameter title one can set the old window title that was valid before the iconification. | ||||||||||
Return value: | The function always returns the value 1.
| ||||||||||
Availability: | The presence of this function can be ascertained with appl_getinfo
(opcode 7). This function is only present from WDIALOG 1.05 onwards.
If it is not present, then intout[0] contains a 0.
| ||||||||||
Group: | Window-dialogs
| ||||||||||
See also: | Binding wdlg_set_iconify
|
C: | int16_t wdlg_set_uniconify ( DIALOG *dialog, GRECT *g, int8_t
*title, OBJECT *tree );
| ||||||||||||||||||||||||||||||||||||
Binding: |
int16_t wdlg_set_uniconify ( DIALOG *dialog, GRECT *g, int8_t *title, OBJECT *tree ) { addr_in[0] = dialog; addr_in[1] = g; addr_in[2] = title; addr_in[3] = tree; int_in[0] = 4; crys_if (165); return ( int_out[0] ); } | ||||||||||||||||||||||||||||||||||||
GEM-Arrays: |
|