100 likes | 106 Views
SCIRun GUI Guidelines. J. Davison de St. Germain Chief Software Engineer SCI Institute 801-581-4078 December 2003. dav@sci.utah.edu. Important Elements. Button Panel Execute Close Find Execution Policy Interactive/Delayed Tab notebook. Helper Utilities.
E N D
SCIRun GUI Guidelines J. Davison de St. Germain Chief Software Engineer SCI Institute 801-581-4078 December 2003 dav@sci.utah.edu
Important Elements • Button Panel • Execute • Close • Find • Execution Policy • Interactive/Delayed • Tab notebook
Helper Utilities • Can be found in ./SCIRun/src/Dataflow/GUI/ • SciDialog.tcl proc createSciDialog • SciButtonPanel.tcl proc makeSciButtonPanel • SciMoveToCursor.tcl proc moveToCursor
How To Use TCL/Tk • Sketch on paper first • Use frames liberally • 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.
My Last Tip: Use Tooltips! • 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
Tcl/Tk Packing Example • method ui {} { # 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) makeSciButtonPanel $w $w $this # Move the window to be near the cursor. moveToCursor $w }
Tcl/Tk, Itcl/Itk Web Pages • http://www.tcl.tk/man/tcl8.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
GuiVars • GuiVars connect C++ code with TCL code (so programmer doesn’t have to.) • GuiString • GuiInt • GuiDouble • Etc. • C++ side: • variable.get(), variable.set() • Tcl/Tk side: • $this-variable