SCIRun GUI Guidelines Advanced Bio PSE J Davison
SCIRun GUI Guidelines Advanced Bio. PSE J. Davison de St. Germain Chief Software Engineer SCI Institute 801 -581 -4078 dav@sci. utah. edu December 2003 NCRR
Important Elements Advanced Bio. PSE • Button Panel - Execute - Close - Find • Execution Policy - Interactive/Delayed • Tab notebook NCRR
Helper Utilities Advanced Bio. PSE • Can be found in. /SCIRun/src/Dataflow/GUI/ - Sci. Dialog. tcl proc create. Sci. Dialog - Sci. Button. Panel. tcl proc make. Sci. Button. Panel - Sci. Move. To. Cursor. tcl proc move. To. Cursor NCRR
How To Use TCL/Tk • Sketch on paper first • Use frames liberally Advanced Bio. PSE - Grooves and padding are your friends. • Resize the window often during creation - This will help you make sure that resizing works the way you want it to for the end product. NCRR
My Last Tip: Use Tooltips! Advanced Bio. PSE • SCIRun now has tooltips! • As you create your GUI, add extensive tooltips to everything! • The user can turn them off once they know everything. • Convenience functions can be found in: . /SCIRun/src/Dataflow/GUI/Tooltips. tcl NCRR
Tcl/Tk Packing Example • method ui {} { Advanced Bio. PSE # create a local variable named ‘w’ for # easier reference. Modname is unique to each GUI: set w. ui[modname] # Create a frame called main_window frame $w. main_window # Pack the winow (make it appear) and tell it to grow when # the window is resized. Give it a groove to make it stand out. pack $w. main_window -expand yes -fill both -relief groove -borderwidth 2 # Create a button with text “Do it” that runs the given command button $w. main_window. doit -text “Do it” -command “run this command” # Add a tool tip to the command Tooltip $w. main_window. doit “Press this button to do…” # Add on the common Sci Buttons (Execute, Close, Find) make. Sci. Button. Panel $w $w $this # Move the window to be near the cursor. move. To. Cursor $w } NCRR
Tcl/Tk, Itcl/Itk Web Pages Advanced Bio. PSE • http: //www. tcl. tk/man/tcl 8. 3/ - Button, canvas, checkbutton, label, menu, scrollbar, text, etc • Itcl/itk - Used to help organize tcl code - http: //incrtcl. sourceforge. net/itcl - http: //incrtcl. sourceforge. net/itk NCRR
Gui. Vars Advanced Bio. PSE • Gui. Vars connect C++ code with TCL code (so programmer doesn’t have to. ) - Gui. String - Gui. Int - Gui. Double - Etc. • C++ side: - variable. get(), variable. set() • Tcl/Tk side: - $this-variable NCRR
Questions Advanced Bio. PSE NCRR
Advanced Bio. PSE NCRR
- Slides: 10