functions in tws.i -
tws
|
tws_init, tws_button, tws_handler are the useful routines. Tiny Widget Set. Provides simplistic routines to build simplistic, almost graphical user interfaces. Currently supports simplisitic "buttons". See Cubeview for sample usage. You normally call tws_init once, then tws_button for each button, then tws_handler. Basic sample usage: // Define your handler: func my_handler(uname,button){ if (button==1) { // mouse button 1 performs action if (uname=="hello") write,"Hello World!"; if (uname=="quit") return 2; return 0; } else { // Any other button performs contextual help if (uname=="hello") write,"Click on this button to write \"Hello World!\""; if (uname=="quit") write,"Click on this button to quit"; return 0; } } // Create base widget: tws_init,0,1,2; // Create two buttons: tws_button,"Hello World!",uname="hello"; tws_button,"Quit",uname="quit"; // Call the handler: tws_handler,"my_handler"; // Enjoy. |
tws_button
|
tws_button,label=label,parent=parent,uname=uname Creates a TWS popup. It's a button (so see tws_button), that creates a popup window when clicked. You must give CHILD, a Root widget, and handler, the corresponding handler |
TWS_Button
|
TWS_Button struct TWS_Button /* DOCUMENT TWS_Button { string type,uname; pointer root,parent; // A button has no children double position(4); string label; long label_id,frame_id; } |
tws_button
|
tws_button,label=label,parent=parent,uname=uname Creates a TWS button, labeled LABEL, with uname (=user name) UNAME. The uname should be used by your handler. See tws_handler. |
TWS_Button
|
TWS_Button struct TWS_Button /* DOCUMENT TWS_Popup { string type,uname; pointer root,parent,child; // child is the root widget of the popup window double position(4); string label,handler; long label_id,frame_id; } |
TWS_ButtonEvent
|
TWS_ButtonEvent struct TWS_ButtonEvent { pointer widget; double mouse(11); long button; } |
TWS_ButtonEvent
|
TWS_ButtonEvent struct TWS_ButtonEvent { pointer widget; double mouse(11); long button; } |
tws_field
|
tws_button,label,uname=uname Creates a TWS button, labeled LABEL, with uname (=user name) UNAME. The uname should be used by your handler. See tws_handler. |
TWS_Field
|
TWS_Field struct TWS_Field /* DOCUMENT TWS_Button { string type,uname; pointer root,parent; // A button has no children double position(4),value; string label,prompt; long label_id,frame_id,value_id,frame; } |
TWS_FieldEvent
|
TWS_FieldEvent struct TWS_FieldEvent { pointer widget; double mouse(11); long button; double value; } |
TWS_Grid
|
TWS_Grid struct TWS_Grid /* DOCUMENT TWS_Grid { string type,uname; pointer children,root,parent; double cur_gridx,cur_gridy,buttons_xsize, buttons_ysize; long cur_index; double position(4); long frame_id; // id of frame for pledit GraphK frame_keywords; } |
tws_grid
|
tws_init,wid,cols,lines [,uname=uname] Creates a TWS base widget in window WID. This widget will contain the buttons in a grid with COLS columns and LINES lines. A uname (=user name) may be given to this widget for later reference, which is currently useless since the base widget doesn't return any event to your handler. After having called TWS_INIT once, you can had buttons with TWS_BUTTON. Buttons will be drawn bottom to top and left to right in the grid. |
tws_label
|
tws_button,label=label,parent=parent,uname=uname Creates a TWS Label, labeled LABEL, with uname (=user name) UNAME. |
TWS_Label
|
TWS_Label struct TWS_Label /* DOCUMENT TWS_Button { string type,uname; pointer root,parent; // A button has no children double position(4); string label; long label_id; } |
TWS_Radio
|
TWS_Radio struct TWS_Radio /* DOCUMENT TWS_Button { string type,uname; pointer root,parent; // A button has no children double position(4); string label; int selected; long label_id,selected_id; } |
tws_radio
|
tws_button,label=label,parent=parent,uname=uname Creates a TWS button, labeled LABEL, with uname (=user name) UNAME. The uname should be used by your handler. See tws_handler. |
TWS_RadioEvent
|
TWS_RadioEvent struct TWS_RadioEvent { pointer widget; double mouse(11); long button; long selected; } |
TWS_Root
|
TWS_Root struct TWS_Root /* DOCUMENT TWS_Root { string type; // Type of widget, like "Root", "Grid" or "Button" string uname; // Application name of the widget pointer children; // Pointer to an array of pointers to widget structs. pointer root; // Pointer to root widget (self in this case) pointer parent; // Pointer to parent widget (nil in this case) double position(4); // [x0,y0,x1,y1] defining rectangle of this widget. Always [0,0,1,1] for a Root. long wid; // Only for Root widgets : Window ID. long cur_plid; // Only for Root widgets : number of objects defined up to now in the window long dpi; // Root widget should accept any keyword of WINDOW long height; long width; string style; } |
tws_root
|
tws_root,wid,cols,lines [,uname=uname] Creates a TWS base widget in window WID. This widget will contain the buttons in a grid with COLS columns and LINES lines. A uname (=user name) may be given to this widget for later reference, which is currently useless since the base widget doesn't return any event to your handler. After having called TWS_INIT once, you can had buttons with TWS_BUTTON. Buttons will be drawn bottom to top and left to right in the grid. |