Adverti horiz upsell
Creating simple user interfaces
Creating simple user interfaces
rueter, added 2006-05-19 08:38:55 UTC 19,840 views  Rating:
(0 ratings)
Page 4 of 4

get_color

Show a color chooser dialog.


syntax:

get_color ?default?

example:

get_color "pick a colour" 15



panel

This is a bit more complex than the other methods but you can actually build simple customized interfaces that include things like file browsers, check boxes, drop down menus, etc.

syntax:
panel ?-w#? ?title? {{label var type args}...}
  • ?-w#?: optional - use -w followed by a number to set the desired panel width in pixels

  • ?title?: optional panel title the following arguments can be repeated as many times as needed

  • label: this is the label of the following UI element

  • var: this variable contains the default value and the result afetr the panel is closed

  • args depend on the UI desired element:

    • f: a text line with folder button to enter an search filenames

    • f2: a text line with folder button to enter an search clips

    • m: multiline text input (about 4 lines)

    • m2: larger multiline input (8 lines)

    • n: notepad - huge text field. n can be followed by the number of lines required, i.e. n3

    • b: boolean check box

    • c: RGB color chip

    • e: enumeration pulldown, add tcl list of enumeration values

    • F: text font pulldown menu

    • x: expression input (needs some additinal variables)

    • (none): single line text input

example:
panel "load something" { {"the file: " input f} {"check something" checked b} }



display

Creates a window showing the result of command. The command is executed in the "context" of the given node, so this and a knob name in expressions refer to that node. In the window is an "update" button which causes the command to be run again.

syntax:

display ?-width #? ?-title text? command ?context-node?
  • -w width: set the width of the window in pixels

  • -t title: set the title of the window

  • command: the text returned by this TCL command will be shown in the box

  • node: if this node is changed, the dialog box will automatically update


    examples:

    display the IDs of all selected nodes
    display -width 800 -title "what time is it?" selected_nodes

    format the display a little bit and insert line breaks
    display -width 800 -title "what time is it?" {join [selected_nodes] n}

    click for larger version

    The Best thing to do with the display command is to write an extra tcl proc that generates and formats the output in a way you want it and then have the display command call that proc.