IgorOOP /IgorOOPGuiBasics

Top
Up
Contents
RecentChanges
Attachment
Backlinks
Print
Page
Edit
User:38.103.63.18
(anonymous)
Login
8164 hits since Thu Jun 13 12:31:06 2002
Not finished yet.

GUI Tips

Panel minimization and restoration

Object panel can be minimized or restored by Double Cliking in the panel.

The "l","s","e","d" buttons

The small "l","s","e","d" buttons in the title region of an object panel call "load", "save", "fedit", "del" methods respectively.
  • e button brings up a panel which shows string and variable members of the object
  • ctrl+e brings up table with waves in the object
  • d button deletes the object
  • l button loads object from folder in a harddisk
  • shift+l lets you select load path
  • s button saves the object in a harddisk
  • shift+s lets you select where to save

Panel refresh

You can recreate panel by option+clicking close box (alt+colse box in windows). So you can, for example, edit guiparam_edit text wave, which you can access by ctrl+e button and reflect the change by recreating the panel using option+close box.

Automatic GUI builder

''The procedure file OOP_gui (for mac) and OOP_gui_windows (for windows) contain implementations for automatic gui builder.''

Basic Idea

The role of the automatic gui builder is to create panels which are associated with objects (= datafolder). String, variable members in a datafolder will be associated with variable fields in a panel and methods will be associated with buttons. Which members/methods and how they should be represented in a panel is specified in a text wave using "spec" string (described below). The main function for the automatic gui builder is gui_build:
gui_build(obj, guiparam, left,top,width, rgb, suffix,titleW,div) 
It accepts path to a datafolder (obj), text wave containing "spec strings" (guiparam), positions (left, top), width, color (rgb), width for field names (titleW), number of columns (div) and the name for the panel (suffix).

Strings, variables in a datafolder are directly associated with variable fields using fullpath. Button callbacks and other callbacks (e.g. for variable fields, popups, ...) find out path to the datafolder from encoded name (seel below).

Encoding path to a datafolder in Window ID

To associate a datafolder and a panel, path to the datafolder is encoded in window id. For example, if the path is "root:foo:bar" and the name of the panel is "edit", then the window id is "foo_bar_edit".

Various callback functions (in GUI_CONTROL_HOOK section in OOP_gui procedure file) use this encoding to find out which datafolder to act on.

Unfortunately there is a limit on the length of window id. So strange things happen if the path name is too long. So it's better to either keep depth of datafolders shallow (e.g. put every object under root folder) or use very short names for objects.

"Spec" Strings

Italic parts are what you should supply.
spec explanation
btn;method calls method of the object (no arguments) uses "gui_btn_call" callback
btn;name;method name = button name, calls method of the object (no arguments) object id is encoded in the button id (does not use window id => must use this when listing other objects in a panel) uses "gui_btn_do" callback function
btn;name;btn_proc;1 button name = name, uses btn_proc for callback
txt;text; draws text using font size=12, default color
txt;text;fsize specifies font size = fsize
txt;text;fsize;rgb specifies font size, color
txt;text;fsize;rgb;1 add "edit", "del" button
str;sname makes variable field associated with string member "sname"
str;sname;varproc similar to the above but variable field has a callback "varproc" which is a method of the object
var;vname makes variable field associated with variable member "vname"
var;vname;varproc similar to the above but has callback "varproc" which is a name of a method of the object
spop;sname;popstr string variable field with popup memu associated with it, "sname" = a name of string member, popstr = name of string member which contains string or string function to be used with popup menu, default callback procedure for the pupup is "gui_pop_setvar" which set the value of the string member "sname".
spop;sname;popstr;proc similar to above but uses "proc" instead of default "gui_pop_setvar"
mpop;sname;popstr similar to spop but uses the callback function "gui_pop_appendvar" which appends selected value to the string member "sname"
chk;vname create check box, corresponding variable member ("vname") has either 1 (checked) or 0 (unchecked).
strbtn;sname similar to "str;sname" but has associated small button which calls "edit" method of the object whose path is determined by the value of string member "sname".
strbtn;sname;btnproc similar to "str;sname" but has small button which calls "btnproc" method of the object
strbtn;sname;btnproc;varproc similar to the above but variable field has callback "varproc" which is a method of the object
varbtn;vname similar to "strbtn;sname"
varbtn;vname;btnproc similar to "strbtn;sname;btnproc"
varbtn;vname;btnproc;varproc similar to "strbtn;sname;btnproc;varproc"

Consult gui_buildItem function and other various control hook functions in GUI_CONTROL_HOOK section in OOP_gui procedure file.

Making panels from an object

Convention

In IgorOOP, we name "spec" wave as guiparam_"suffix" where "suffix" is a name for the corresponding panel. The default panel is named "edit", so the "spec" wave for the default edit panel is named "guiparam_edit". But we can have other "spec" waves like "guiparam_foo" as well.

Making panels

Now calling obj_gui("edit") makes a panel using "guiparam_edit" spec wave. Similarly calling obj_gui("foo") makes a panel using "guiparam_foo" spec wave.

Some Member Parameters for GUI

  • string /g gui_rgb : color, e.g. "(65535,0,0)" for red
  • variable /g gui_col : number of columns >= 1 (default 1)
  • variable /g gui_titleW : width for fields name (default 90)
  • string /g winparam_"suffix" : window position and width for panel "suffix": default "left:5;top:42;width:130;height:0;"