Defines | |
#define | mt_FormDo(a, b, c) mt_form_do(b,c,a->aes_global) |
Handle a formular created by mt_FormBegin(). | |
#define | FormDo(a, b) mt_form_do(a,b,gl_appvar->aes_global) |
See mt_FormDo(). | |
Functions | |
WINDOW * | mt_FormWindBegin (APPvar *app, OBJECT *dial, char *nom) |
Open a formular in a modal window. | |
void | mt_FormWindEnd (APPvar *app) |
close a modal window formular | |
int | mt_FormWindDo (APPvar *app, int __evnt) |
handle a modal window formular | |
int | mt_FormWindDoBuff (APPvar *app, int __evnt, short buff[8]) |
handle a modal window formular | |
int | mt_FormAttach (APPvar *app, WINDOW *win, OBJECT *tree, func_evnt func) |
Attach a formular to a window. | |
void | mt_FormResize (APPvar *app, WINDOW *win, INT16 *x, INT16 *y, INT16 *w, INT16 *h) |
compute the window size prior to the formular size. | |
WINDOW * | mt_FormCreate (APPvar *app, OBJECT *tree, int attrib, func_evnt func, char *name, GRECT *coord, int grow, int dup) |
Create and handle a formular in a window. | |
int | mt_FormSave (APPvar *app, WINDOW *win, int mode) |
Store objects state of a windowed formular. | |
int | mt_FormRestore (APPvar *app, WINDOW *win, int mode) |
Restore state of object in windowed formular. | |
void | mt_FormBegin (APPvar *app, OBJECT *tree, MFDB *bckgrnd) |
Open a classic formular. | |
void | mt_FormEnd (APPvar *app, OBJECT *tree, MFDB *bckgrnd) |
Close a classic formular. | |
int | mt_FormAlert (APPvar *app, int but, char fmt[],...) |
Display a GEM alert. | |
void * | mt_FormThumb (APPvar *app, WINDOW *win, int *idxthb, int *idxbut, int nb) |
handle a thumb object in a windowed formular. | |
void | mt_FormThbSet (APPvar *app, WINDOW *win, int but) |
Retrieve active thumb. | |
int | mt_FormThbGet (APPvar *app, void *thb, int mode) |
Retrieve active thumb. | |
void __CDECL | mt_stdFormClose (WINDOW *win, int ind, int mode, void *data, APPvar *app) |
Standard callback function to handle a close button in formular. | |
int | FormAlert (int but, char fmt[],...) |
see mt_FormAlert() | |
void __CDECL | stdFormClose (WINDOW *win, int ind, int mode, void *data) |
see mt_stdFormClose() |
|
See mt_FormDo().
|
|
Handle a formular created by mt_FormBegin(). This function is just an alias to mt_form_do().
|
|
see mt_FormAlert()
|
|
Display a GEM alert.
Example FormAlert( 1, "[1][Event message %d occurs.][OK]", buff[0]); |
|
Attach a formular to a window.
mt_FormAttach() does not duplicated the object tree. If you create multiple window formular from an unique object tree with mt_FormAttach() you should duplicate the object tree with mt_ObjcDup().
|
|
Open a classic formular.
A call of mt_FormDo() handles user interaction with the formular. A call of mt_FormClose() close and release memory used by mt_FormBegin(). Example void do_dialog( int tree_index) { MFDB screen; OBJECT *tree; int res; rsrc_gaddr( 0, tree_index, &tree); FormBegin( tree, &screen); res = FormDo( tree, -1) switch(res){ case OK: ... break; } FormEnd( tree, &screen); }
|
|
Create and handle a formular in a window.
The formular is centered at screen (by using mt_GrectCenter()) if a NULL value is given to gpos parameter. A non NULL value of this parameter allows you to define the position in the desktop od the window (gpos->g_x and gpos->g_y) and the size of the window (gpos->g_w and gpos->g_h). If a formular is bigger than the window, mt_FormCreate() creates sliders wigdet to make scroll the window. The name parameter specifies the window name (equivalent to a mt_WindSet( WF_NAME) call). It is possible to create several windows with a same formular by setting the dup parameter of mt_FormAttach() to 1 : the object tree is duplicated in memory (see mt_ObjcDup()) and this copy is used as formular. A such tree is always unique. The raison of using duplicated objects is that each formular has to have their own coordinates, flags and state. When an object tree is duplicated, the bit WS_FORMDUP of win->status of the window descriptor is set to 1. Event mesages handled by default In addition to events handled by mt_WindCreate(), mt_FormCreate() defines the following events :
Handling a window formular There are three ways in WinDom to handle user selection in a windowed formular :
These methods are illustrated in examples provided in WinDom package.
|
|
Close a classic formular.
|
|
compute the window size prior to the formular size.
If the window containing formular is already opened at screen, the window is resize and parameters x, y, w and h have not signification (NULL value can be used). If the window is not opened at screen, x, y, w and h parameters are filled with the new size and position and can be used to call WindSet(WF_CURRXYWH) function.
|
|
Restore state of object in windowed formular.
|
|
Store objects state of a windowed formular.
Memory used by mt_FormSave() is released when window is destroyed or when the formular (or toolbar) is removed from the window via mt_FormAttach() (or mt_WindSet(WF_TOOLBAR)). Currently, this function is incomplete because editable objects are not saved. It is probably most powerful to use mt_ObjcDup() to create a snapshot of a formular that is make probably this function deprecated.
|
|
Retrieve active thumb.
|
|
Retrieve active thumb.
|
|
handle a thumb object in a windowed formular.
i of these arrays, idxthb [i] is linked to idxbut [i].The fonction returns a pointer which be used by functions mt_FormThbSet() and mt_FormThbGet(). Example: // Example of thumb indexes with three elements int but [] = {BUT1, BUT2, BUT3}; int sub [] = {SUB1, SUB2, SUB3}; win = FormCreate( ...); FormThumb( win, sub, but, 3);
|
|
Open a formular in a modal window.
The user WinDom variable windom.mform.widget defines the widgets of the window.
|
|
handle a modal window formular
User interaction or event can be traited directly from the output of the function. In the case where FORM_EVNT flag is used, a while() structure is required because event imply the output of mt_FormWindDo(). Another method to trait event and user selection is to catch up event with mt_EvntAttach() and object selection with mt_ObjcAttach(). mt_FormWindDo() and mt_FormWindEnd() does not need a window paramater : window formular are modals and there is no ambiguity because a modal window is always the top window application. Several modal window can be imbricated.
|
|
handle a modal window formular
The main difference is the parameter buff[8]. This parameter allows to read the full content of the AES message that occurs (if the function returns MU_MESAG). |
|
close a modal window formular
|
|
Standard callback function to handle a close button in formular. This function is a standard callback function that you can link to 'Close' button in a formular (using mt_ObjcAttach()). This function restore the NORMAL state of the object and destroy the formular. |
|
|