Version 10.10
December 2003
Introduction
Installation
Basic Elements and Structures
Text
Windows
Event Trapping
Your First Program
Debugging
Extending Widgets
Reference
Constants
Variables
Routines
Widgets
The package is a simple event driven environment for DOS in graphics modes. It is easy to use, compact and reasonably stable.
The widgets are a hierarchical system that contains a range of basic elements as well as many of the most common controls.
Among its primitives are text widgets, lines, frames, colored panes, timers and, of course, the omnipresent scr (screen widget).
The controls include all sorts of buttons, check boxes, spinners, scrollers, SLEs, MLEs and menus.
These predefined elements can be, in turn, used to engineer new, more complex widgets. Some of those are also included in the package: basic windows and message boxes, a simple file selector, generic displayers with scrollers and a system color selector.
Simple: unzip the package into the euphoria directory. Make sure your unzip program preserves directory structures, and a new directory called widgets will be created! Just copy core.e and widgets.e into your include directory, and you are ready to go...
First of all, let's get some basic terms right, so that we talk roughly the same language.
A primitive is a widget, whose definition does not depend on any other widget; it is defined, so to speak, from 'the first principles'. (Just a taxonomic distinction anyway - functionally all widgets are equal.)
When I talk about a widget, it can be one of two things: usually I would be referring to an instant, represented by the actual widget's handle, an integer. Only occasionally it would be a widget's 'class' (using the infamous OO speak), effectively the widget's defining function.
All widgets have exactly eight fields. Each field is contained in a separate, appropriately named sequence.
When a widget is created, all these sequences are appended by a single field, so that they are always of the same length. This length, effectively an index of the widget's property fields, becomes its permanent, unique handle. It can be, of course, assigned to a variable, or a constant, preferably with a meaningful identifier.
The first seven fields below are quite specific containers. The last one is a general, all-purpose data holder for colors, patterns, images, edges, kinds of anything, outputs, etc. More specifically data fields of text widgets are used to store the pen information.
Quite often fields contain default values, which, of course, can easily be overwritten. Also, not every widget uses all the fields; the unused fields remain filled with default or dummy values, and are simply ignored.
The pile is another simple, very important structure. The system needs it to display all currently used widgets in the required order: the bottommost first, and the top one as the last item of the pile sequence. Also, only events of the top widget (together with timers and the universal escape key, of course) are constantly monitored.
The menu stack, mpile, is a minor auxiliary structure that keeps track of displayed submenus to facilitate their collapse on exit.
Similarly, wpile is also a minor auxiliary structure recording the hierarchy of displayed modal windows.
The text widget is certainly a complex primitive, but it is also very versatile.
Directly, you can specify not just the position and the dimensions of the text box, but also placement of the text in it through the use of margins as well as any of eight different combinations of horizontal and vertical justifications.
The text data field is a property sequence with ten standard elements. For easy access, each has a predefined two letter combination (see pen properties in the constants section below).
There are only two kinds of windows to worry about. The non-modal variety (with a host other than nil) takes care of itself, it behaves the same way as any other non-modal widget.
The modal windows are a bit trickier. First of all, they are not displayed automatically. They have to be either inserted into the pile manually before the program starts, or invoked through a control using the open_window routine.
Both kinds of windows can be repositioned manually on the screen, dragged around by their title bars. But they are not, currently anyway, resizable.
Let's start with something really simple!
As a rule, each widget type/class has a separate defining function. The following four lines form a complete (non-sensical) program:
include widgets.e constant b = button(scr, {20,50,100,20}, "e&xit", PLAIN, routine_id("quit")) screen("simple example",257,blue) go()
It puts a labelled button on the screen:
b is a handle, an integer.
button() is a class function, a widget generator.
The first parameter, scr, is a pre-defined widget, the underlying graphics screen, a sort of 'universal' host.
The {20, 50, 100, 20} sequence will be stored in the above mentioned dim field. It marks the top left corner, width and height of the newly generated control.
The label will have a highlighted 'x', the 'hot' key.
By the way, there are three types of buttons to choose from: PLAIN, TOOGLE and FAST. (The FAST ones have a built-in accelerated repeat action!)
The last parameter associates new button's standard events (the left mouse button click and the hot key) with the system 'abort' routine.
The screen() routine is used to specify the screen title, graphics mode (640x480x256 in this case) and the color of the screen.
The go() command initializes the rat, generates necessary event tracking structures, displays the widgets and, eventually, enters the main event loop.
There are quite a few debugging tools defined in the last section of core.e, but by far the most useful one is the dump routine. Use it early and use often in the development cycle! It gives you an honest as well as a very complete snapshot of your creation, with all linkages clearly exposed.
The dump routine creates a text file, also called dump (very sensibly!), in the current working directory. A short excerpt from the beginning of a real dump follows:
pile = {1} wpile = {} mpile = {} self = 6 fonts: {"tahoma16.f", "vga8x16.f"} key1trap = {115} key2trap = {{6,{8,6},-1}} rattrap = {{11,-1,{11,9},-1,626,2,638,14},{6,-1,{7,6},-1,100,40,149,60}} 1: name : "screen" host : 0 flag : 0 part : {2,5,6,9} dim : {0,0,640,480} trap : {} show : 0 data : {4,18} 2: name : "shower" host : 1 flag : 0 part : {3,4} dim : {0,0} trap : {} show : 1 data : {" 20: 36: 43"}
You can insert the routine as many times as you wish, and in any part of your code; every time it just appends a fresh snapshot to the output file.
core.e: false = 0 nil = 0 true = 1 esc = 27 lbp -- left button pressed mbp -- middle button pressed rbp -- right button pressed scr -- pre-defined widget, automatically placed on pile compiled rat pointers: RAT_ARROW RAT_ARROW1 RAT_TRIANGLE RAT_CROSS RAT_IBEAM RAT_LTRB -- left top to right bottom diagonal arrows RAT_RTLB -- right top to left bottom diagonal arrows RAT_LR -- left to right arrows RAT_TB -- top to bottom arrows RAT_PENCIL RAT_HGLASS RAT_NOGO RAT_RESIZE RAT_HAND RAT_HAND1 masks for use with kbd function: RSHIFT = 1 LSHIFT = 2 SHIFT = 3 CONTROL = 4 ALT = 8 SCROLL_LOCK = 16 NUM_LOCK = 32 CAPS_LOCK = 64 INSERT = 128 system colors: black = 0 -- text sc1 = 1 -- dark shadows sc2 = 2 -- light shadows sc3 = 3 -- dark face sc4 = 4 -- light face sc5 = 5 -- highlights sc6 = 6 -- 'paper'color white = 7 brown = 8 blue = 9 green = 10 cyan = 11 red = 12 magenta = 13 yellow = 14 orange = 15 RGB = {49,49,42} -- default rgb mix for sc4 flag field masks: GLOBAL = 0 INACTIVE= 1 HIDDEN = 2 LOCAL = 4 SELECTED= 8 MULTI = 16 -- allows multiple selection (default for lbox) TILDE = 32 -- text: show tildes (default 0) AMPER = 64 -- text: show ampersands (default 0) font fields: FI = 1 -- font filename RL = 2 -- run-length encoded char images WI = 3 -- char widths HE = 4 -- font nominal height BH = 5 -- font nominal base height pen properties in data field of a text widget: ST = 1 -- string FO = 2 -- font widget, handle FC = 3 -- foreground color PC = 4 -- paper color HC = 5 -- hilite color SC = 6 -- shadow color JU = 7 -- justification EC = 8 -- extra char pitch EL = 9 -- extra line pitch SO = 10 -- shadow offsets widgets.e: CLEAR = -1 -- transparent background for text widget EDGE = {{{5},{5},{2},{2}}, {{2},{2},{5},{5}}} -- default edge FAST = 2 -- button type HORIZONTAL = 1 -- group orientation PLAIN = 0 -- button type PUT = -1 -- display kind (using display_image) for pic widget TOGGLE = 1 -- button type VERTICAL= 0 -- group orientation justification: LE = 0 -- left HO = 1 -- horizontally centered RI = 2 -- right VE = 4 -- vertically centered BO = 8 -- bottom LT = 0 -- left, top HT = 1 -- horizontally centered, top RT = 2 -- right, top LV = 4 -- left, vertically centered HV = 5 -- horizontally centered, vertically centered RV = 6 -- right, vertically centered LB = 8 -- left, bottom HB = 9 -- horizontally centered, bottom RB = 10 -- right, bottom
core.e: sequence default_pointer -- default compiled rat pointer fonts -- contains all currently loaded fonts mpile -- keeps track of all currently opened submenus pile -- holds all host widgets -- only the last one (top) is monitored rgb -- holds current rgb mix of sc4; default is RGB integer rat_event -- rat moved or a rat button is pressed ratx -- current rat horizontal coordinate raty -- current rat vertical coordinate rat_visible -- boolean, rat pointer visible or hidden (1 or 0) burr_flag -- 0: burr off, 1: burr on default_font -- holds default font handle exit_flag -- when true, the main loop is exited mflag -- when true, collapse_menu routine is called self -- contains widget associated with the last trapped event widgets.e: integer xsize -- horizontal dimension of screen ysize -- vertical dimension of screen
core.e: abs -- return absolute value of ab object align -- converts relative x,y coordinates of specified widget -- into absolute using host's x,y coordinates as offsets bar -- draw filled rectangle box -- draw rectangular frame burr -- emit aural warning that an illegal operation is attempted call_hook -- creates a hook for a user routine clear_flag -- clear flag in the flag field of widget collapse_menu -- routine to remove submenus confine_rat -- rectangular rat cage display -- recursive routine to display widget as well as all its parts dp -- debug: dump pretty print of any euphoria oject dump -- debug: formatted system print dw -- debug: dump print of widget or sequence of widgets flip_flag -- flip flag in the flag field of widget get_flag -- return current value of flag get_palette -- return 3-element sequence containing rgb values (0..63) go -- main system routine hide_rat -- hide rat pointer hook -- associate event of widget with user routine_id rid kbd -- return true if a special key is activated load_font -- load font from file, return font handle loop -- the main event monitoring loop inside go max -- return maximal value from one-dimensional sequence merge_image -- display 2-d sequence with nominated 'transparent' color min -- return minimal value from one-dimensional sequence modal -- return true if window or mbox is modal new -- create a new widget and return its handle pp -- debug: pretty print: any object, with strings in quotes quit -- causes exit from the main loop rat -- update mouse rename -- rename widget replicate -- return a sequence generated by pattern repetition round -- return value of object rounded towards the nearest integer set_flag -- set flag in the flag field of widget set_palette -- change single color set_palettes -- set contiguous range of colors set_system_colors -- set the first 16 colors as system colors shift -- translates widget by indicated number of pixels in -- both principal directions show_rat strip -- return sequence stripped of all occurrences of an integer sw -- debug: screen print of widget or sequence of widgets tile -- return 2-d image of area tiled with given pattern track -- compile rat and key events of widget at top of pile track_one -- special version of track to keep track of specific widget wait_while -- loop while a specified rat event is happening when -- associate event of widget with user routine_id when_any -- associate all events of widget with user routine_id widgets.e: close_window -- erase window and remove it from pile lengths -- return sequence of lengths, in pixels, of substrings of text open_mbox -- put mbox on top of pile and display it open_window -- put window on top of pile and display it read_file -- read text file and return it as single text sequence reload_lbox -- reload lbox with new sequence of strings rewrite -- reload text widget with a new string and show it screen -- invokes graphics mode set_rbutton -- select rbutton currently deselected start_timer -- insert timer into monitored event queue stop_timer -- remove timer from monitored event queue text_dim -- return text image's over-all dimensions text_height -- return total text image height text_image -- return 2-d image sequence of text text_width -- return total text image width toggle_button -- default state: 'popped' toggle_cbox -- default: unchecked toggle_pbutton -- default: unchecked pal.e: free_front -- return bitmap with unused colors moved to front of palette unused -- return sequence of unused colors in a bitmapabs
Syntax: | include core.e o = abs(o) |
Description: | return absolute value of a euphorian object |
Syntax: | include core.e align(ow) |
Description: | recursive routine that converts relative x,y coordinates of widget or widgets w into absolute using host's x,y coordinates as offsets |
Comments: | utility routine that facilitates use of relative coordinates, which is usually much simpler |
Syntax: | include core.e bar(sdim, oc) |
Description: | draw filled rectangle dim = {x, y, width, height} if atom(c), then it is a plain color, else it is a pattern: {flag, 2-d color sequence} tiling flag: LOCAL or GLOBAL |
See Also: | box, tile, LOCAL/GLOBAL |
Syntax: | include core.e box(sxywh, oedge) |
Description: | draw rectangular frame if atom(edge), then it is the border (line) color else the sequence is edge colors, from outside in, clockwise, starting with the left edge: {{i1,i2,...}, {j1,...}}, {k1,..}, {l1,..}} |
See Also: | bar |
Syntax: | include core.e burr() |
Description: | emit aural warning that an illegal operation has been attempted it can be disabled by setting the global burr_flag to zero |
Syntax: | include core.e hook_proc() |
Description: | creates a hook for a user routine inside a widget's method code |
See Also: | hook |
Syntax: | include core.e clear_flag(iwidget, if) |
Description: | clear flag f in the flag field of widget |
See Also: | flag, flag, flip_flag, set_flag |
Syntax: | include widgets.e close_window(iwin) |
Description: | erase window remove it from pile change tbar of window just under it, if any may be used with file_selectors |
See Also: | file_selector, open_window, window |
Syntax: | include core.e collapse_menu() |
Description: | specialized routine to facilitate removal of submenus |
See Also: | menu |
Syntax: | include rat.e confine_rat(ix1, iy1, ix2, iy2) |
Description: | a rat cage, where x1,y1 and x2,y2 are its top-left and bottom-right corner coordinates respectively |
See Also: | set_rat_xy |
Syntax: | include core.e display(ow) |
Description: | recursive routine that displays w as well as all its parts w is either a single widget, or a sequence of widgets |
Syntax: | include core.e dp(oobj) |
Description: | dump pretty print of any euphoria oject |
See Also: | dump, dw, sw |
Syntax: | include core.e dump() |
Description: | formatted print of main system structures as well as all widgets output file name: "dump" |
Comments: | usually applied at the end of program, but, as all debug routines, it can be used at any point to capture a particular state |
See Also: | dp, dw, sw |
Syntax: | include core.e dw(ow) |
Description: | dump print of widget or sequence of widgets |
See Also: | dump, dw, sw |
Syntax: | include core.e flip_flag(iwidget, if) |
Description: | flip flag f in the flag field of widget |
See Also: | flag, flag, clear_flag, set_flag |
Syntax: | include pal.e sbmp = free_front(sbmp) |
Description: | re-arrange bitmap so that all unused colors are shifted to the beginning of the palette return modified bitmap used to make room for system colors hint: use graphics utility like IrfanView or similar to free at least 16 colors to accommodate system colors |
See Also: | set_system_colors, unused |
Syntax: | include core.e b = get_flag(iwidget, if) |
Description: | return current value of flag f |
See Also: | clear_flag, flag, flip_flag, set_flag |
Syntax: | include core.e srgb = get_palette(ici) |
Description: | return 3-element sequence containing rgb values (0..63) ci is color index |
Comments: | similar to standard palette(), but it is faster and does not set new color |
See Also: | set_palette, set_palettes |
Syntax: | include core.e go() |
Description: | the main system routine, it: displays the pile tracks the top of pile enters the main loop returns to original text mode on exit |
See Also: | loop |
Syntax: | include rat.e hide_rat() |
Description: | removes the rat pointer from the screen, usually to allow screen updates |
Comments: | the calls to show_rat() and hide_rat() do not have to be balanced! |
See Also: | rat, show_rat |
Syntax: | include core.e hook(iwidget, ievent, irid) |
Description: | associate event of widget with user routine_id rid via a built-in hook_proc routine |
See Also: | hook_proc |
Syntax: | include core.e bb = kbd(imask) |
Description: | boolean function: return true if a special key corresponding to mask is activated |
See Also: | masks |
Syntax: | include widgets.e ss = lengths(iwidget) |
Description: | widget must be text return sequence of lengths, in pixels, of substrings of text using current font, attributes and parameters substrings are delimited by embedded newline characters function does not take any margins into account |
See Also: | text, text_dim, text_height, text_width |
Syntax: | include core.e ifont_handle = load_font(stfilename) |
Description: | load font from the given file return font handle if font is already loaded, just return its handle! |
Comments: | only one font is automatically loaded at start up its handle is stored in the global variable default_font |
Syntax: | include core.e loop() |
Description: | the main event monitoring loop |
See Also: | go |
Syntax: | include core.e ax = max(ss) |
Description: | return maximal value from one-dimensional sequence s |
Syntax: | include core.e merge_image(sxy, simage, ic) |
Description: | display 2-d sequence image at point xy image cells of color c are considered transparent |
Comments: | similar to standard display_image() 'on-the-fly' run-length-encoding is used for speed |
Syntax: | include core.e ax = min(ss) |
Description: | return minimal value from one-dimensional sequence s |
Syntax: | include core.e iwidget = new(stname, ihost) |
Description: | creates a new widget of given name as a part of host |
Syntax: | include widgets.e open_mbox(iwin) |
Description: | put mbox on top of pile display it while saving the are underneath change tbar of window just under it, if any |
See Also: | mbox |
Syntax: | include widgets.e open_window(iwin) |
Description: | put window on top of pile display it while saving the are underneath change tbar of window just under it, if any may be used with file_selectors |
See Also: | file_selector, close_window, window |
Syntax: | include core.e pp(ifile, oobj) |
Description: | simple pretty print: print any Euphoria object, with strings in quotes |
Syntax: | include core.e quit() |
Description: | sets exit_flag to true, causes exit from the main loop |
See Also: | loop |
Syntax: | include rat.e rat() |
Description: | updates the rat pointer, if currently visible, as well as the key global variables: rat_event, ratx and raty |
See Also: | hide_rat, show_rat |
Syntax: | include widgets.e sst = read_file(stfilename) |
Description: | read a text file into a single sequence return text sequence |
See Also: | reader |
Syntax: | include widgets.e reload_lbox(iwidget, ss) |
Description: | reload existing lbox with a new sequence of strings s |
See Also: | lbox |
Syntax: | include core.e rename(iwidget, stnewname) |
Description: | rename an existing widget and overwrite, recursively, its old name with the new one in all its parts |
Syntax: | include core.e ss = replicate(spattern, inewlength, ioffset) |
Description: | return a sequence generated by pattern repetition for local patterns the offset is zero for global patterns the offset is the starting horizontal location in global coordinates |
See Also: | tile |
Syntax: | include widgets.e rewrite(iwidget, sstring) |
Description: | reload text widget with a new string and show it |
See Also: | text, text_image |
Syntax: | include core.e oxi = round(ox) |
Description: | return value of a euphorian object rounded towards the nearest integer it rounds mid-points up, both negative and positive |
Syntax: | include widgets.e screen(sttitle, imode, ocolor) |
Description: | it invokes the specified graphics mode title string will be displayed in the screen title bar. An empty title string supresses the title bar! color is either a plain color, or a 2-d pattern |
Comments: | any available graphics mode with at least 16 colors can be used the routine also sets the default system colors and initializes the rat |
See Also: | set_system_colors |
Syntax: | include core.e set_flag(iwidget, if) |
Description: | set flag f in the flag field of widget |
See Also: | flag, flag, flip_flag, clear_flag |
Syntax: | include core.e set_palette(ici, srgb) |
Description: | change color with index ci rgb is sequence of color intensities {red,green,blue}, with values 0..63 |
Comments: | similar to standard palette(), but generally much faster |
See Also: | get_palette, set_palettes |
Syntax: | include core.e set_palettes(ici, srgbs) |
Description: | set contiguous range of colors ci is the starting color index rgbs is a sequence color intensities {{r1,g1,b1},{r2,g2,b2},...} with values 0..63 |
Comments: | similar to standard all_palette(), but generally much faster, and it also allows resetting of only limited range of colors |
See Also: | get_palette, set_palette |
Syntax: | include widgets.e set_rbutton(iwidget) |
Description: | select rbutton only if it is currently deselected, and toggle currently selected rbutton |
See Also: | rbuttons |
Syntax: | include core.e set_system_colors(srgb) |
Description: | set the first 16 colors as system colors rgb is rgb mix for sc4 (light face color) default RGB = {46, 46, 46}, each component range is 0..63 hint: use graphics utility like IrfanView or similar to free the first 16 colors of a palette to accommodate system colors |
See Also: | screen, free_front, unused |
Syntax: | include core.e shift(iw, idx, idy)) |
Description: | recursive routine that translates widget w and all its components by indicated number of pixels in both principal directions |
Syntax: | include rat.e show_rat() |
Description: | makes rat pointer visible |
Comments: | the calls to show_rat() and hide_rat() do not have to be balanced! |
See Also: | hide_rat, rat |
Syntax: | include widgets.e start_timer(iwidget) |
Description: | resets the next refresh time of timer widget to current time plus selected timer interval, and inserts timer into the monitored event queue |
See Also: | timer, stop_timer |
Syntax: | include widgets.e stop_timer(iwidget) |
Description: | removes timer from the monitored event queue |
See Also: | timer, start_timer |
Syntax: | include core.e s = strip(s, ix) |
Description: | strip sequence s of all occurrences of x |
Syntax: | include core.e sw(ow) |
Description: | screen print of widget or sequence of widgets |
See Also: | dump, dp, dw, sp |
Syntax: | include widgets.e sdim = text_dim(itext_widget) |
Description: | return text image over-all dimensions: dim = {width, height} |
See Also: | lengths, text, text_height, text_width |
Syntax: | include widgets.e iheight = text_height(itext_widget) |
Description: | return total text image height |
See Also: | lengths, text, text_dim, text_width |
Syntax: | include widgets.e simage = text_image(iwidget) |
Description: | return 2-d image sequence of text as specified in fields of text widget |
See Also: | rewrite, text, write |
Syntax: | include widgets.e iwidth = text_width(itext_widget) |
Description: | return total text image width |
See Also: | lengths, text, text_dim, text_height |
Syntax: | include core.e s = tile(spattern, inewwidth, inewheight, ixoffset, iyoffset) |
Description: | return 2-d image sequence of tiled area for local tiling xoffset and yoffset are zeros, and the pattern will start in the top left corner of tiled area |
See Also: | replicate |
Syntax: | include widgets.e toggle_button(iwidget) |
Description: | change state of button widget (default state: 'popped') can be used only with 'TOGGLE' buttons! |
See Also: | button |
Syntax: | include widgets.e toggle_cbox(iwidget) |
Description: | toggle cbox widget (default: unchecked) |
See Also: | cbox |
Syntax: | include widgets.e toggle_pbutton(iwidget) |
Description: | toggle pbutton widget (default: unchecked) |
See Also: | pbutton |
Syntax: | include core.e track() |
Description: | compile all rat and key events of the widget at top of pile, recursively, into easily 'scannable' global structures lbtrap, rbtrap, k1trap and k2trap rat events: {{w, default method, hook, x1, y1, x2, y2}, ... key pressed: k1trap: {w1, w2, w3,... k2trap: {{key1, default_method1, hook1}, {key2, default_method2, hook2},... |
See Also: | track_one |
Syntax: | include core.e track_one(iwidget) |
Description: | special version of track to keep track of a specific widget, not necessarily at the top of pile, e.g. a menu |
See Also: | track |
Syntax: | include pal.e ss = unused(sbmp) |
Description: | return sequence s of color indexes unused in bitmap bmp hint: use graphics utility like IrfanView or similar to free at least 16 colors to accommodate system colors |
See Also: | set_system_colors, free_front |
Syntax: | include rat.e wait_while(ievent) |
Description: | loops while the specified event is happening |
Comments: | the system is continually updated by calling rat() inside the waiting loop |
See Also: | rat |
Syntax: | include core.e when(iwidget, oevent, orid) |
Description: | associate event of widget with user routine_id rid event is either a single event or a sequence of events rid is either a single routine_id or a sequence of routine_ids |
See Also: | when_any |
Syntax: | include core.e when_any(iwidget, orid) |
Description: | associate all events of widget with user routine_id rid rid is either a single routine_id or a sequence of routine_ids |
See Also: | when |
button | bevelled text button | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = button(ihost, sdim, stlabel, ikind, irid) |
||||||
comment: |
dim = {x, y, width, height} label may contain a 'hot' char (preceded by '&') button kind: PLAIN, TOGGLE, or FAST PLAIN: standard button that springs back to 'popped' state when left rat button is released TOGGLE: it functions more or less like a cbox; it changes its state with every rat click FAST: special kind that keeps executing the user supplied routine (with increasing frequency!) while the left rat button remains pressed! rid: routine_id of associated user procedure |
||||||
see also: | buttons, cbox, pbutton, toggle_button | ||||||
name | host | flag | part | dim | trap | show | data |
"button" | host | 0 | {pane,text} | dim | {...} | -1 | 0 |
buttons | button group | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = buttons(ihost, sdim, slabels, skinds, srids, iorientation) |
||||||
comment: |
dim = {x, y, pitch} labels is a sequence of strings, that may contain 'hot' chars kinds: sequence of corresponding types: PLAIN, TOGGLE or FAST rids: user routine_ids orientation: VERTICAL (=0), or HORIZONTAL (=1) group |
||||||
see also: | button, cboxes, pbuttons, rbuttons | ||||||
name | host | flag | part | dim | trap | show | data |
"buttons" | host | 0 | {button1,button2,..} | {0,0} | {} | -1 | 0 |
cbox | check box control | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = cbox(ihost, sdim, slabel, irid) |
||||||
comment: |
dim = {x, y} ... top left corner label may contain a 'hot' char preceded by '&' rid: user routine_id flag: if checked then SELECTED flag set |
||||||
see also: | button, cboxes, pbutton, rbutton, toggle_cbox | ||||||
name | host | flag | part | dim | trap | show | data |
"cbox" | host | 0 | SELECTED | {pane,text,pic} | {x, y, total_width, 13} | {...} | -1 | {} |
cboxes | check box group | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = cboxes(ihost, sdim, slabels, srids, iorientation) |
||||||
comment: |
dim = {x, y, pitch} labels is a sequence of strings, that may contain 'hot' chars rids: user routine_ids orientation: VERTICAL (=0), or HORIZONTAL (=1) group |
||||||
see also: | buttons, cbox, pbuttons, rbuttons | ||||||
name | host | flag | part | dim | trap | show | data |
"cboxes" | host | 0 | {cbox1,cbox2,..} | {0,0} | {} | -1 | {} |
file_selector | a window widget | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = file_selector(iboss, sdim) |
||||||
comment: |
dim = {x, y} : top left corner part: {window_pane, tbar, title, closer, mask sle, curr dir text, lbox, cbox} data: {background image, home dir, dir seq, selected file | 0} |
||||||
see also: | lbox, window | ||||||
name | host | flag | part | dim | trap | show | data |
"file selector" | nil | 0 | {...} | dim & {304, 340} | {} | rid | {...} |
frame | rectangular empty box | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = frame(ihost, sdim, oedge) |
||||||
comment: |
dim = {x, y, width, height} if atom(edge) then it is the border (line) color, else the sequence is edge colors, from outside in, clockwise, starting with the left edge: {{i1,i2,...}, {j1,...}}, {k1,..}, {l1,..}} |
||||||
see also: | bar, box, and pane | ||||||
name | host | flag | part | dim | trap | show | data |
"frame" | host | 0 | {} | dim | {} | rid | {edge} |
hline | horizontal line | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = hline(ihost, sdim, ocolor) |
||||||
comment: |
dim = {x, y, length} x, y are coordinates of the leftmost point color is either a color index or a color sequence ordered from top to bottom |
||||||
see also: | vline | ||||||
name | host | flag | part | dim | trap | show | data |
"hline" | host | 0 | {} | dim | {} | rid | {color} |
hscroll | horizontal scroller | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = hscroll(ihost, sdim) |
||||||
comment: |
dim = {x, y, scroll_length, image_width, image_step} flag: 0 when shown, 3 (=INACTIVE+HIDDEN) when hidden part: {left_button, right_button, slide, slider} dim: {x, y, scroll_length, image_width, image_step, slider_x, slider_step} slider_x: current left edge position, in pixels slider_step: calculated from image_step |
||||||
see also: | reader, viewer, vscroll | ||||||
name | host | flag | part | dim | trap | show | data |
"hscroll" | host | 0 | {...} | {...} | {} | -1 | 0 |
hslide | adjustable horizontal slider | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = hslide(ihost, sxyl, scolors, idis) |
||||||
comment: |
xyl = {x, y, total_length} colors: {left_pane_color, right_pane_color} dis: initial displacement part: {frame, left_pane, right_pane, left_pbutton, right_pbutton} data: {current_displacement} |
||||||
see also: | |||||||
name | host | flag | part | dim | trap | show | data |
"hslide" | host | 0 | {...} | {...} | {} | -1 | {dis} |
lbox | list box | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = lbox(iboss, sdi, ss), ifont |
||||||
comment: |
di = {x, y, width, height} s: sequence of substrings d in dim = {x, y, width, height, 20, line_pitch} data: object n, selected line or lines: n = 0 -> no selection was made n: atom > 0 -> line number n was selected if sequence(n) then multiple selection was made if default MULTI flag is cleared, only single selection will be possible! |
||||||
see also: | reload_lbox | ||||||
name | host | flag | part | dim | trap | show | data |
"lbox" | boss | 0 | MULTI | {frame, vscroll, hscroll, text} | d | {} | rid | {image, n} |
mbox | message window with optional multiple buttons | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = mbox(iboss, sdim, stlabel, stmessage, sbutton_labels) |
||||||
comment: |
boss: nil for modal windows! dim = {x, y, width, height} label: title bar string button_labels: sequence of strings, empty if no buttons part: {pane, tbar, text, closer, button_group} image in data: saved background when mbox is displayed |
||||||
see also: | open_mbox, window | ||||||
name | host | flag | part | dim | trap | show | data |
"mbox" | boss | 0 | {...} | {0, 0} | {} | -1 | {image} |
menu | simple hierarchical menu system | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = menu(ihost, sxy, sm) |
||||||
comment: |
xy: top left corner of menu strip m: menu sequence: {{labe1, m1}, {label2, m2}, ...} where m1, m2... are either: integers: routine_id's of associated methods, or submenu sequences of the same kind as menu sequence above part: sequence of menu_leaf widgets |
||||||
see also: | collapse_menu, mpile | ||||||
name | host | flag | part | dim | trap | show | data |
"menu" | host | 0 | {...} | {0, 0} | {} | -1 | 0 |
pane | filled and edged rectangle | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = pane(ihost, sdim, ocolor, oedge) |
||||||
comment: |
dim = {x, y, width, height} if atom(color), then it is a plain color, else it is a pattern: {flag, 2-d color sequence} if color is specified as CLEAR, then only the outer frame is drawn tiling flag: LOCAL or GLOBAL if atom(edge), then it is the border (line) color else the sequence is edge colors, from outside in, clockwise, starting with the left edge: {{i1,i2,...}, {j1,...}}, {k1,..}, {l1,..}} |
||||||
see also: | bar, box and frame | ||||||
name | host | flag | part | dim | trap | show | data |
"pane" | host | 0 | {} | dim | {} | rid | {color,edge} |
pbutton | bevelled picture button | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = pbutton(ihost, sdim, sbitmaps, ikind, irid) |
||||||
comment: |
dim = {x, y, width, height} bitmaps in data: {bmp1, kind1, bmp2, kind2} corresponding to popped and pushed states resp. display kind1, kind2: PUT = -1, merge >= 0 (transparent color) button kind: PLAIN, TOGGLE, or FAST rid: routine_id of associated user procedure |
||||||
see also: | button, cbox, pbuttons, toggle_pbutton | ||||||
name | host | flag | part | dim | trap | show | data |
"pbutton" | host | 0 | {pane, pic} | dim | {...} | -1 | {bmp1, bmp2} |
pbuttons | pbutton group | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = pbuttons(ihost, sdim, sbmps, skinds, srids, iorientation) |
||||||
comment: |
dim = {x, y, pitch} bmps is a sequence of bitmap quadruplets kinds: sequence of corresponding types: PLAIN, TOGGLE or FAST rids: user routine_ids orientation: VERTICAL (=0), or HORIZONTAL (=1) group |
||||||
see also: | buttons, cboxes, pbutton, rbuttons | ||||||
name | host | flag | part | dim | trap | show | data |
"pbuttons" | host | 0 | {pbutton1, pbutton2,..} | {0,0} | {} | -1 | 0 |
pic | picture using bitmap | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = pic(ihost, sdim, sbitmap, ikind) |
||||||
comment: |
dim = {x, y}, top left corner display kind: PUT = -1, merge >= 0 (transparent color) |
||||||
name | host | flag | part | dim | trap | show | data |
"pic" | host | 0 | {} | dim | {} | rid | {bitmap, kind} |
rbuttons | radio button group | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = rbuttons(ihost, sdim, slabels, srids, iorientation) |
||||||
comment: |
dim = {x, y, pitch} labels is a sequence of strings, labels may contain 'hot' chars rids: user routine_ids orientation: VERTICAL (=0), or HORIZONTAL (=1) group w in data: currently selected rbutton |
||||||
see also: | buttons, cboxes, pbuttons, set_rbutton | ||||||
name | host | flag | part | dim | trap | show | data |
"rbuttons" | host | 0 | {rbutton1,rbutton2,..} | {0,0} | {} | -1 | w |
reader | displayer of text, with scrollers when required | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include viewer.e iwidget = reader(ihost, sdim, stext) |
||||||
comment: |
dim = {x, y, width, height} text is a single single string with lines separated by linefeeds dim: {x, y, width, height, 20, line_pitch} The last two entries just above are an arbitrary 20 pixel horizontal step, and a vertical step equivalent to the nominal line pitch The reader has also built-in Page up and Page Down responses! |
||||||
see also: | hscroll, read_file, viewer, vscroll | ||||||
name | host | flag | part | dim | trap | show | data |
"reader" | host | 0 | {frame, vscroll, hscroll, text} | {...} | {} | rid | {bitmap} |
shower | displayer of numbers or text | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = shower(ihost, sdim, oo, oedge, ijustification) |
||||||
comment: |
dim = {x, y, width, height} o: either a number or text string to be displayed recommended justification: LV, or HV, or RV |
||||||
name | host | flag | part | dim | trap | show | data |
"shower" | host | 0 | {pane, text} | {0, 0} | {} | rid | {oo} |
sle | single line editor | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = sle(ihost, sdim, stext, scaption) |
||||||
comment: |
dim = {x, y, width, height} text: initial text to be edited data: {text_image, escape key} escape keys: tab | cr | esc | sh+tab | up| down |
||||||
name | host | flag | part | dim | trap | show | data |
"sle" | host | 0 | {pane, text, caption} | {...} | {...} | rid | {stext_image, iescape_key} |
spinner | number selector with accelerated repeat buttons | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = spinner(iboss, sdim, sindata) |
||||||
comment: |
dim = {x, y, width, height} indata = {default_value, minimum_value, maximum_value, step, number_of_decimal_places} data:dat = {selected_value, minimum_value, maximum_value, step, number_of_decimal_places} |
||||||
name | host | flag | part | dim | trap | show | data |
"spinner" | boss | 0 | {pane, text, up button, down button} | {...} | {} | rid | dat |
tbar | title bar for screen and windows | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = tbar(iboss, sttitle) |
||||||
name | host | flag | part | dim | trap | show | data |
"tbar" | boss | 0 | {title_text, closer_button} | {...} | {} | orid | {sc2 | blue, -1} |
text | plain text widget | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = text(ihost, sdim, stxt, ijust) |
||||||
comment: |
full dim parameter has the following six elements: {x, y, width, height, horizontal margin, vertical margin} if any or all trailing elements are missing, the system will pad the sequence with zeros! x, y is top left corner of the first character if width or height is smaller than necessary to accommodate given text, it will be automatically replaced by an appropriate minimum value table in data refers to bottom table of text properties |
||||||
see also: | about text, constants, rewrite, text_image, variables | ||||||
name | host | flag | part | dim | trap | show | data |
"text" | host | 0 | {} | dim | {} | rid | table |
ST | FO | FC | PC | HC | SC | JU | EC | EL | SO |
---|---|---|---|---|---|---|---|---|---|
txt | n | black | CLEAR | orange | -1 | just | 0 | 1 | {1,1} |
timer | completely independent main loop interrupt | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = timer(iboss, adelta, irid) |
||||||
comment: |
nrt in data: next_refresh_time delta = timer_interval rid: routine_id of user supplied procedure |
||||||
see also: | start_timer, stop_timer | ||||||
name | host | flag | part | dim | trap | show | data |
"timer" | boss | 0 | {} | {0,0} | {} | -1 | {nrt, delta, rid} |
viewer | displayer of images, with scrollers when required | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include viewer.e iwidget = viewer(ihost, sd, sbitmap) |
||||||
comment: |
d = {x, y, width, height} di in dim: d & {20,20} -- arbitrary image steps in x, y directions The viewer has built-in Page up and Page Down actions! |
||||||
see also: | hscroll, reader, vscroll | ||||||
name | host | flag | part | dim | trap | show | data |
"viewer" | host | 0 | {frame, vscroll, hscroll} | di | {} | rid | {bitmap} |
vline | vertical line | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = vline(ihost, sd, ocolor) |
||||||
comment: |
d = {x, y, length} x, y are coordinates of the top point color is either a color index or a color sequence ordered from left to right |
||||||
see also: | hline | ||||||
name | host | flag | part | dim | trap | show | data |
"vline" | host | 0 | {} | dim | {} | rid | {color} |
vscroll | vertical scroller | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = vscroll(ihost, sd) |
||||||
comment: |
d = {x, y, scroll_length, image_height, image_step} flag: 0 when shown, 3 (=INACTIVE+HIDDEN) when hidden part: {up_button, down_button, slide, slider} dim: {x, y, scroll_length, image_height, image_step, slider_y, slider_step} slider_y, slider_step: current position and step, calculated values appended to dim |
||||||
see also: | hscroll, reader, viewer | ||||||
name | host | flag | part | dim | trap | show | data |
"vscroll" | host | 0 | {...} | {...} | {} | -1 | 0 |
window | plain window | ||||||
---|---|---|---|---|---|---|---|
syntax: |
include widgets.e iwidget = window(iboss, sdim, sttitle) |
||||||
comment: |
dim = {x, y, width, height} part: {pane, tbar, text, closer} data: either background image when window displayed, or image of itself when closed host: nil for modal windows! |
||||||
see also: | close_window, file_selector, mbox, open_window | ||||||
name | host | flag | part | dim | trap | show | data |
"window" | boss | 0 | {...} | dim | {} | rid | {image} |