Introduction to GUI programming with TKScript and FOX
(5-February-2004). (last change: 16-Mar-2005)
table of contents
Acknowledgements
- history of vintage desktop computers (~1960-~1980)
- A little history of the world wide web. (1945-1995)
- The GLADE XML GUI builder/library is (c) 1998-2004 by Damon Chaplin.
- XUL is (c) 2001-2004 by Netscape
- The SCGUI project (~Sept. 2002)
- XAML is (c) 2004 by Microsoft.
- ....and finally be sure to checkout Doug Engelbart "and the group of 17 researchers"' "90-minute live public demonstration of the online system, NLS, they had been working on since 1962", Douglas Engelbart describes this as "an instrument for helping humans operate within the domain of complex information structures". ... :)
Introduction
Software development and graphical user interfaces have come a long way since the very first days of 7bit ASCII/ANSI terminal emulators. The great success of the World Wide Web brought a paradigm shift concerning the way applications are being developed. The "explosion" of number crunching power for the average desktop computer in the late 80ies/early 90ies allowed for further abstraction layers to be added to existing (OS) libraries/applications. A large number of scripting and markup languages, mostly designed for special purposes (e.g. text documents, math, databases, (vector)graphics, presentations..), has emerged since then.
While application programming was mainly a "hackers" issue in the 80ies (you need to know a great deal of the underlying hardware and internal OS structures) this has changed a lot by now. Most IDEs shipped today offer some kind of interface designer which lets you insert/position/edit graphical user interfaces. Usually these interface designers will create either source code (and keep the abstract GUI representation private) or emit an XML file storing the GUI setup and names of the event callbacks that can be loaded at runtime using a "C" library (first invented 1998 by Damon Chaplin- afaik).
The "GLADE" XML GUI approach really impressed me by that time (I even hacked around on my own browser + gui toolkit by that time..but I was too unexperienced and the code was too hackish to be continued (p.s.: thanks a lot Mr. B. Horstmann!) but there are a few points that keep me from using "C" or "C++" to write GUIs:
- while the GLADE GUIs are dynamic, the code is static (i.e. precompiled)
- While "C"/"C++" is a good choice for writing "system level" code, higher level scripting languages
- are runtime interpretable/compilable (compilable=either VM (slower than recursive ptree exec) or VM+JIT (fast))
- are platform independent (if freely available)
- have builtin language features for common design patterns (typecasts/strings/hashes/arrays/lists..)
- are often easier to learn because of a less strict grammar
- may provide runtime linking of (precompiled C++) classes via shared objects (e.g. TKScript, Ch)
Dinner time
Regarding the history of the Web, SGML/XML and markup languages in general, it is really astonishing that it took almost 7 years since the public opening of the WWW until someone released a browser that was not only capable of displaying HTML pages and providing the "usual" JS+HTML DOM but also offered the possibility to include advanced GUI elements allowing for complex GUI applications like....e.g. a browser :) YOu guessed it, I'm talking of Mozilla which was --afaik-- the first usuable (!) abd publically available browser that also featured a GUI markup language - XUL.
Well and as we all know Microsoft has not slept since then and they also built their own XML "document based" GUI toolkit (XAML and Avalon). While on the one hand it is surely true that they have not invented something really new it is on the
other hand also true that they are creating a usuable and (probably working:) solution.....--but: the following issues keep me away from using this toolkit:
- it is not portable (resp. not ported). I like to choose the operating system I want to run software on.
- it is not free. A look in the source often tells you more than 1000 manuals.
- you cannot directly embed script code. the design seems very similar to e.g. libglade.
Introduction to FXML
After this little history / view on the current situation of GUI application development I'd like to introduce you to my approach to this issue. Having worked with HTML "GUI" programming quiet a bit during the last years I always wanted to have something as easy to use as HTML+JavaScript/PHP/Perl but designed for client applications. While looking at GUI toolkit bindings for traditional scripting languages like e.g. TCL, Perl, Python or PHP I found the following issues:
- no "abstract" definition language but you rather must code like e.g. in "C" (or "C++"). This leads to a lot of GUI-code overhead which can get you in real trouble when the application has to be customized or changed often.
- One of advantages of "C" is that the executable is rather small, compared to the size of e.g. a Perl or Java installation.
- It should be possible to easily ship the script runtime with your application, 1024KBytes should be the upper limit for the runtime(+libs) (reasons: stability, no further dependencies)
- concerning XUL+JavaScript: Nice job! -But somehow it seems a bit large and is actually not designed as a lightweight GUI+script toolkit ;) (OpenGL?)
Hopefully some of you who think I'm re-inventing the wheel may now understand the reasons for this project.
Finally, this is distributed in the hope that it will be useful..
What I'm really looking forward to is a kind of HTML like markup language draft from e.g. the W3C staff which is designed as close to XHTML as possible. This markup language should offer the possibility to embed script statements as well as using a more abstract "ID" based message system to separate GUI and script code.
The FXML markup language, as the name implies, is designed close to the FOX toolkit. Nevertheless it is planned to include a kind of stylesheet translator once there is a real public standard for XML GUIs. This "2 stage" approach makes sense since it would otherwise be necessary to mix the FOX dependent code with the parser for a (more complex) XML GUI format.
FXML elements and attributes (29-January-2003)
The following section introduces you to the FOX markup language (FXML). Please note that this project is actively in development so you better check back often. There is no "stable" release available yet but you may find the current test-release quiet usuable already.
comments
- the
<!-- ... --->
sequence is used to exclude the given block from interpretation
Types
STRING
: string constant, e.g. 'hello' or "hello 'world !'" or 'hello "world !"'
INT
: an integer, e.g. "-25", "5"
FLAGS
: a string list of constants, e.g. "LAYOUT_FIX_WIDTH,LAYOUT_FIX_HEIGHT"
SCRIPT(...)
: a script callback, ... substitutes the current argument list
ID
: reference another fxobject or set an anchor, e.g. "mymainwindow"
$<property>
: substitutes an attribute of the current fx object (e.g. $text is short for fx.text)
script
<script
body ='/*..arbitrary script code.. (no class or module statements)*/'
/>
- can be used to embed "shared" script code (e.g. functions)
- if possible, put your code in a separate .tks file
fxmainwindow
<fxmainwindow
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
title =STRING
>
...
</fxmainwindow>
- derived from FXTopWindow
- there may be only one FXMainWindow.
fxlabel
<fxlabel
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
iconPosition =FLAGS
justify =FLAGS
text =STRING
font =ID
fx.text =STRING
/>
fxbutton
<fxbutton
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
iconPosition =FLAGS
justify =FLAGS
text =STRING
font =ID
onLeftBtnRelease =SCRIPT()
fx.text =STRING
/>
fxfont
<fxfont
flags =FLAGS
parent =ID
id =ID
size =INT
h =INT
face =STRING
weight =FLAGS
slant =FLAGS
encoding =FLAGS
setWidth =FLAGS
/>
fxtextfield
<fxtextfield
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
cols =INT
text =STRING
font =ID
onVerify =SCRIPT(String _text)
onKeyPress =SCRIPT(int _code, int _state)
onKeyRelease =SCRIPT(int _code, int _state)
fx.text =STRING
/>
fxslider
<fxslider
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
headSize =INT
slotSize =INT
tickDelta =INT
value =INT
inc =INT
lo =INT
hi =INT
onLeftBtnRelease =SCRIPT(int _value)
onMotion =SCRIPT(int _value)
fx.value =INT;
fx.lo =INT;
fx.hi =INT;
/>
fxdial
<fxdial
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
revolutionIncrement =INT
notchSpacing =INT
notchOffset =INT
dialStyle =FLAGS
value =INT
lo =INT
hi =INT
onLeftBtnRelease =SCRIPT(int _value)
onMotion =SCRIPT(int _value)
fx.value =INT;
fx.lo =INT;
fx.hi =INT;
/>
fxscrollbar
<fxscrollbar
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
page =INT
inc =INT
value =INT
hi =INT
onLeftBtnRelease =SCRIPT(int _value)
onMotion =SCRIPT(int _value)
fx.value =INT;
fx.hi =INT;
/>
fxgroupbox
<fxgroupbox
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
text =STRING
groupBoxStyle =FLAGS
font =ID
>
...
</fxgroupbox>
fxhorizontalframe
<fxhorizontalframe
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
>
...
</fxhorizontalframe>
fxverticalframe
<fxverticalframe
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
>
...
</fxverticalframe>
fxhorizontalseparator
<fxhorizontalseparator
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
/>
fxverticalseparator
<fxverticalseparator
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
/>
fxmenubar
<fxmenubar
flags =FLAGS
parent =ID
id =ID
/>
- must appear directly after the fxmainwindow element, must not be followed by fxmenupane directly (a bug)
fxmenupane
<fxmenupane
flags =FLAGS
parent =ID
id =ID
>
...
</fxmenupane>
- must be placed at the end of a window definition (a bug)
fxmenucommand
<fxmenucommand
flags =FLAGS
parent =ID
id =ID
label =STRING
onLeftBtnRelease =SCRIPT()
onLeftBtnPress =SCRIPT()
/>
fxmenutitle
<fxmenutitle
flags =FLAGS
parent =ID
id =ID
label =STRING
/>
fxglcanvas
<fxglcanvas
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
onPaint =SCRIPT()
onMotion =SCRIPT(int _x, int _y)
onKeyPress =SCRIPT(int _code, int _state)
onKeyRelease =SCRIPT(int _code, int _state)
onLeftBtnPress =SCRIPT()
onLeftBtnRelease =SCRIPT()
timeout =INT
fx.timeout =INT
FXGLCanvas::setTimeout(int _ms)
FXGLCanvas::startTimer(int _ms)
FXGLCanvas::stopTimer()
/>
- timer automatically restarts.
- glViewport() is called with the widget size
- gl matrices are reset to identity.
fxmessagebox
<fxmessagebox
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
caption =STRING
message =STRING
int FXMessageBox::execute() - create/show/run modal
/>
- global tool functions:
- FXMessageBox_warning(FXComposite _parent, int _flags, String _caption, String _message)
- FXMessageBox_error(FXComposite _parent, int _flags, String _caption, String _message)
- FXMessageBox_information(FXComposite _parent, int _flags, String _caption, String _message)
- FXMessageBox_question(FXComposite _parent, int _flags, String _caption, String _message)
- fixme
fxfiledialog
<fxfiledialog
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
title =STRING - popup window title
filename =STRING
pattern =STRING - e.g. "all files (*)\nscripts (*.tks)\nFXML files (*.fxml)"
patternList =STRING
currentPattern =INT -e.g. 2=FXML files
directory =STRING
itemSpace =INT
fileBoxStyle =FLAGS
selectMode =FLAGS
showReadOnly =BOOL
int execute() - create/show/runModal.. returns true or false..
/>
fx4splitter
<fx4splitter
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
hSplit =INT - fraction 0..10000
vSplit =INT - fraction 0..10000
splitterStyle =FLAGS
barSize =INT
expanded =INT - 0..3 or -1==all
/>
fxcolordialog
<fxcolordialog
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
title =STRING - popup window title
rgba =INT - #AARRGGBB
opaqueOnly =BOOL
/>
fxcheckbutton
<fxcheckbutton
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
iconPosition =FLAGS
justify =FLAGS
text =STRING
font =ID
checkButtonFlags =FLAGS
onLeftBtnRelease =SCRIPT(int _check)
fx.text =STRING
fx.check =INT
/>
fxcombobox
<fxcombobox
flags =FLAGS
parent =ID
id =ID
x =INT
y =INT
w =INT
h =INT
frameStyle =FLAGS
layoutHints =FLAGS
padLeft =INT
padRight =INT
padTop =INT
padBottom =INT
helpText =STRING
tipText =STRING
font =ID
text =STRING
editable =INT
numColumns =INT
numVisible =INT
currentItem =INT
comboStyle =FLAGS
onLeftBtnRelease =SCRIPT(int _item)
fx.text =STRING
fx.currentItem =INT
fx.editable =INT - combobox is editable (1) or just the default text is displayed (0)
fx.items =STRING - e.g. "one\ntwo\nthree"
getItemText(int _i) - return text string for item # _i
/>
Key codes:
KEY_BackSpace, KEY_Tab, KEY_Linefeed, KEY_Clear, KEY_Return, KEY_Pause, KEY_Scroll_Lock, KEY_Sys_Req, KEY_Escape, KEY_Delete, KEY_Multi_key, KEY_Home, KEY_Left, KEY_Up, KEY_Right, KEY_Down, KEY_Prior, KEY_Page_Up, KEY_Next, KEY_Page_Down, KEY_End,
KEY_Begin, KEY_BackSpace, KEY_Tab, KEY_Linefeed, KEY_Clear, KEY_Return, KEY_Pause, KEY_Scroll_Lock, KEY_Sys_Req, KEY_Escape, KEY_Delete, KEY_Multi_key, KEY_Home, KEY_Left, KEY_Up, KEY_Right, KEY_Down, KEY_Prior, KEY_Page_Up, KEY_Next, KEY_Page_Down, KEY_End, KEY_Begin, KEY_Select, KEY_Print, KEY_Execute, KEY_Insert, KEY_Undo, KEY_Redo, KEY_Menu, KEY_Find, KEY_Cancel, KEY_Help,
KEY_Break, KEY_Mode_switch, KEY_script_switch, KEY_Num_Lock, KEY_KP_Space, KEY_KP_Tab, KEY_KP_Enter, KEY_KP_F1, KEY_KP_F2, KEY_KP_F3, KEY_KP_F4, KEY_KP_Home, KEY_KP_Left, KEY_KP_Up, KEY_KP_Right, KEY_KP_Down, KEY_KP_Prior, KEY_KP_Page_Up, KEY_KP_Next, KEY_KP_Page_Down, KEY_KP_End, KEY_KP_Begin, KEY_KP_Insert, KEY_KP_Delete, KEY_KP_Equal, KEY_KP_Multiply, KEY_KP_Add, KEY_KP_Separator, KEY_KP_Subtract, KEY_KP_Decimal, KEY_KP_Divide, KEY_KP_0, KEY_KP_1, KEY_KP_2, KEY_KP_3, KEY_KP_4, KEY_KP_5,
KEY_KP_6, KEY_KP_7, KEY_KP_8, KEY_KP_9, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11,
KEY_L1, KEY_F12, KEY_L2, KEY_F13, KEY_L3, KEY_F14, KEY_L4, KEY_F15, KEY_L5, KEY_F16, KEY_L6, KEY_F17, KEY_L7, KEY_F18, KEY_L8, KEY_F19, KEY_L9, KEY_F20, KEY_L10, KEY_F21, KEY_R1, KEY_F22, KEY_R2, KEY_F23, KEY_R3, KEY_F24, KEY_R4, KEY_F25, KEY_R5, KEY_F26, KEY_R6, KEY_F27, KEY_R7, KEY_F28, KEY_R8, KEY_F29, KEY_R9, KEY_F30, KEY_R10, KEY_F31, KEY_R11, KEY_F32, KEY_R12,
KEY_F33, KEY_R13, KEY_F34, KEY_R14, KEY_F35, KEY_R15, KEY_Shift_L, KEY_Shift_R, KEY_Control_L, KEY_Control_R, KEY_Caps_Lock,
KEY_Shift_Lock, KEY_Meta_L, KEY_Meta_R, KEY_Alt_L, KEY_Alt_R, KEY_Super_L, KEY_Super_R, KEY_Hyper_L, KEY_Hyper_R, KEY_ISO_Lock, KEY_ISO_Level2_Latch, KEY_ISO_Level3_Shift, KEY_ISO_Level3_Latch, KEY_ISO_Level3_Lock, KEY_ISO_Group_Shift, KEY_ISO_Group_Latch, KEY_ISO_Group_Lock, KEY_ISO_Next_Group, KEY_ISO_Next_Group_Lock, KEY_ISO_Prev_Group, KEY_ISO_Prev_Group_Lock, KEY_ISO_First_Group, KEY_ISO_First_Group_Lock, KEY_ISO_Last_Group, KEY_ISO_Last_Group_Lock, KEY_ISO_Left_Tab, KEY_ISO_Move_Line_Up,
KEY_ISO_Move_Line_Down, KEY_ISO_Partial_Line_Up, KEY_ISO_Partial_Line_Down, KEY_ISO_Partial_Space_Left, KEY_ISO_Partial_Space_Right, KEY_ISO_Set_Margin_Left, KEY_ISO_Set_Margin_Right, KEY_ISO_Release_Margin_Left, KEY_ISO_Release_Margin_Right, KEY_ISO_Release_Both_Margins, KEY_ISO_Fast_Cursor_Left, KEY_ISO_Fast_Cursor_Right, KEY_ISO_Fast_Cursor_Up, KEY_ISO_Fast_Cursor_Down, KEY_ISO_Continuous_Underline, KEY_ISO_Discontinuous_Underline, KEY_ISO_Emphasize, KEY_ISO_Center_Object, KEY_ISO_Enter, KEY_dead_grave, KEY_dead_acute, KEY_dead_circumflex, KEY_dead_tilde, KEY_dead_macron, KEY_dead_breve, KEY_dead_abovedot, KEY_dead_diaeresis, KEY_dead_abovering, KEY_dead_doubleacute, KEY_dead_caron, KEY_dead_cedilla, KEY_dead_ogonek,
KEY_dead_iota, KEY_dead_voiced_sound, KEY_dead_semivoiced_sound, KEY_dead_belowdot, KEY_First_Virtual_Screen, KEY_Prev_Virtual_Screen, KEY_Next_Virtual_Screen, KEY_Last_Virtual_Screen, KEY_Terminate_Server, KEY_AccessX_Enable, KKEY_AccessX_Feedback_Enable, KEY_RepeatKeys_Enable, KEY_SlowKeys_Enable, KEY_BounceKeys_Enable, KEY_StickyKeys_Enable, KEY_MouseKeys_Enable, KEY_MouseKeys_Accel_Enable, KEY_Overlay1_Enable, KEY_Overlay2_Enable, KEY_AudibleBell_Enable, KEY_Pointer_Left, KEY_Pointer_Right, KEY_Pointer_Up, KEY_Pointer_Down, KEY_Pointer_UpLeft,
KEY_Pointer_UpRight, KEY_Pointer_DownLeft, KEY_Pointer_DownRight, KEY_Pointer_Button_Dflt_, KEY_Pointer_Button1, KEY_Pointer_Button2, KEY_Pointer_Button3, KEY_Pointer_Button4, KEY_Pointer_Button5, KEY_Pointer_DblClick_Dflt, KEY_Pointer_DblClick1, KEY_Pointer_DblClick2, KEY_Pointer_DblClick3, KEY_Pointer_DblClick4, KEY_Pointer_DblClick5, KEY_Pointer_Drag_Dflt, KEY_Pointer_Drag1, KEY_Pointer_Drag2, KEY_Pointer_Drag3, KEY_Pointer_Drag4, KEY_Pointer_Drag5, KEY_Pointer_EnableKeys, KEY_Pointer_Accelerate, KEY_Pointer_DfltBtnNext, KEY_Pointer_DfltBtnPrev
KEY_space, KEY_exclam, KEY_quotedbl, KEY_numbersign, KEY_dollar, KEY_percent, KEY_ampersand, KEY_apostrophe, KEY_quoteright, KEY_parenleft, KEY_parenright, KEY_asterisk, KEY_plus, KEY_comma, KEY_minus, KEY_period, KEY_slash, KEY_0, KEY_1, KEY_2,
KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_colon, KEY_semicolon, KEY_less, KEY_equal, KEY_greater, KEY_question, KEY_at, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_bracketleft, KEY_backslash, KEY_bracketright, KEY_asciicircum, KEY_underscore, KEY_grave, KEY_quoteleft, KEY_a, KEY_b, KEY_c, KEY_d, KEY_e, KEY_f, KEY_g, KEY_h, KEY_i, KEY_j, KEY_k, KEY_l, KEY_m, KEY_n, KEY_o, KEY_p, KEY_q, KEY_r, KEY_s, KEY_t, KEY_u, KEY_v, KEY_w, KEY_x, KEY_y, KEY_z, KEY_braceleft, KEY_bar, KEY_braceright, KEY_asciitilde, KEY_nobreakspace, KEY_exclamdown, KEY_cent, KEY_sterling, KEY_currency, KEY_yen, KEY_brokenbar, KEY_section, KEY_diaeresis, KEY_copyright, KEY_ordfeminine, KEY_guillemotleft, KEY_notsign, KEY_hyphen, KEY_registered, KEY_macron, KEY_degree, KEY_plusminus, KEY_twosuperior, KEY_threesuperior, KEY_acute, KEY_mu, KEY_paragraph, KEY_periodcentered, KEY_cedilla, KEY_onesuperior, KEY_masculine, KEY_guillemotright, KEY_onequarter, KEY_onehalf, KEY_threequarters, KEY_questiondown, KEY_Agrave, KEY_Aacute, KEY_Acircumflex, KEY_Atilde, KEY_Adiaeresis, KEY_Aring, KEY_AE, KEY_Ccedilla, KEY_Egrave, KEY_Eacute, KEY_Ecircumflex, KEY_Ediaeresis, KEY_Igrave, KEY_Iacute, KEY_Icircumflex, KEY_Idiaeresis, KEY_ETH, KEY_Eth, KEY_Ntilde, KEY_Ograve, KEY_Oacute, KEY_Ocircumflex, KEY_Otilde, KEY_Odiaeresis, KEY_multiply, KEY_Ooblique, KEY_Ugrave, KEY_Uacute, KEY_Ucircumflex, KEY_Udiaeresis, KEY_Yacute, KEY_THORN, KEY_Thorn, KEY_ssharp, KEY_agrave, KEY_aacute, KEY_acircumflex,
KEY_atilde, KEY_adiaeresis, KEY_aring, KEY_ae, KEY_ccedilla, KEY_egrave, KEY_eacute, KEY_ecircumflex, KEY_ediaeresis, KEY_igrave, KEY_iacute, KEY_icircumflex, KEY_idiaeresis, KEY_eth, KEY_ntilde, KEY_ograve, KEY_oacute, KEY_ocircumflex, KEY_otilde, KEY_odiaeresis, KEY_division, KEY_oslash, KEY_ugrave, KEY_uacut, KEY_ucircumflex, KEY_udiaeresis, KEY_yacute, KEY_thorn, KEY_ydiaeresis, KEY_Select, KEY_Print, KEY_Execute, KEY_Insert, KEY_Undo, KEY_Redo, KEY_Menu, KEY_Find, KEY_Cancel, KEY_Help, KEY_Break, KEY_Mode_switch, KEY_script_switch, KEY_Num_Lock.
flags:
- IMAGE flags:
- IMAGE_KEEP - Keep pixel data in client
- IMAGE_OWNED - Pixel data is owned by image
- IMAGE_DITHER - Dither image to look better
- IMAGE_NEAREST - Turn off dithering and map to nearest color
- IMAGE_ALPHA - Data has alpha channel
- IMAGE_OPAQUE - Force opaque background
- IMAGE_ALPHACOLOR - Override transparancy color
- IMAGE_SHMI - Using shared memory image
- IMAGE_SHMP - Using shared memory pixmap
- IMAGE_ALPHAGUESS - Guess transparency color from corners
- FXFont fontweight flags:
- FONTWEIGHT_DONTCARE - Don't care about weight
- FONTWEIGHT_THIN - Thin
- FONTWEIGHT_EXTRALIGHT - Extra light
- FONTWEIGHT_LIGHT - Light
- FONTWEIGHT_NORMAL - Normal or regular weight
- FONTWEIGHT_REGULAR - Normal or regular weight
- FONTWEIGHT_MEDIUM - Medium bold face
- FONTWEIGHT_DEMIBOLD - Demi bold face
- FONTWEIGHT_BOLD - Bold face
- FONTWEIGHT_EXTRABOLD - Extra
- FONTWEIGHT_HEAVY - Heavy
- FONTWEIGHT_BLACK - Black
- FXFont fontslant flags:
- FONTSLANT_DONTCARE - Don't care about slant
- FONTSLANT_REGULAR - Regular straight up
- FONTSLANT_ITALIC - Italics
- FONTSLANT_OBLIQUE - Oblique slant
- FONTSLANT_REVERSE_ITALIC - Reversed italic
- FONTSLANT_REVERSE_OBLIQUE - Reversed oblique
- FXFont fontencoding flags:
- FONTENCODING_DEFAULT - Don't care character encoding
- FONTENCODING_ISO_8859_1
- FONTENCODING_ISO_8859_2
- FONTENCODING_ISO_8859_3
- FONTENCODING_ISO_8859_4
- FONTENCODING_ISO_8859_5 - Cyrillic (almost obsolete)
- FONTENCODING_ISO_8859_6
- FONTENCODING_ISO_8859_7
- FONTENCODING_ISO_8859_8
- FONTENCODING_ISO_8859_9
- FONTENCODING_ISO_8859_10
- FONTENCODING_ISO_8859_11
- FONTENCODING_ISO_8859_13
- FONTENCODING_ISO_8859_14
- FONTENCODING_ISO_8859_15
- FONTENCODING_ISO_8859_16
- FONTENCODING_KOI8
- FONTENCODING_KOI8_R - Russian
- FONTENCODING_KOI8_U - Ukrainian
- FONTENCODING_KOI8_UNIFIED
- FONTENCODING_LATIN1 - Latin 1 (West European)
- FONTENCODING_LATIN2 - Latin 2 (East European)
- FONTENCODING_LATIN3 - Latin 3 (South European)
- FONTENCODING_LATIN4 - Latin 4 (North European)
- FONTENCODING_LATIN5 - Latin 5 (Turkish)
- FONTENCODING_LATIN6 - Latin 6 (Nordic)
- FONTENCODING_LATIN7 - Latin 7 (Baltic Rim)
- FONTENCODING_LATIN8 - Latin 8 (Celtic)
- FONTENCODING_LATIN9 - Latin 9 AKA Latin 0
- FONTENCODING_LATIN10 - Latin 10
- FONTENCODING_USASCII - Latin 1
- FONTENCODING_WESTEUROPE - Latin 1 (West European)
- FONTENCODING_EASTEUROPE - Latin 2 (East European)
- FONTENCODING_SOUTHEUROPE - Latin 3 (South European)
- FONTENCODING_NORTHEUROPE - Latin 4 (North European)
- FONTENCODING_CYRILLIC - Cyrillic
- FONTENCODING_RUSSIAN - Cyrillic
- FONTENCODING_ARABIC - Arabic
- FONTENCODING_GREEK - Greek
- FONTENCODING_HEBREW - Hebrew
- FONTENCODING_TURKISH - Latin 5 (Turkish)
- FONTENCODING_NORDIC - Latin 6 (Nordic)
- FONTENCODING_THAI - Thai
- FONTENCODING_BALTIC - Latin 7 (Baltic Rim)
- FONTENCODING_CELTIC - Latin 8 (Celtic)
- FXFont fontsetwidth flags:
- FONTSETWIDTH_DONTCARE - Don't care about set width
- FONTSETWIDTH_ULTRACONDENSED - Ultra condensed printing
- FONTSETWIDTH_EXTRACONDENSED - Extra condensed
- FONTSETWIDTH_CONDENSED - Condensed
- FONTSETWIDTH_NARROW - Narrow
- FONTSETWIDTH_COMPRESSED - Compressed
- FONTSETWIDTH_SEMICONDENSED - Semi-condensed
- FONTSETWIDTH_MEDIUM - Medium printing
- FONTSETWIDTH_NORMAL - Normal printing
- FONTSETWIDTH_REGULAR - Regular printing
- FONTSETWIDTH_SEMIEXPANDED - Semi expanded
- FONTSETWIDTH_EXPANDED - Expanded
- FONTSETWIDTH_WIDE - Wide
- FONTSETWIDTH_EXTRAEXPANDED - Extra expanded
- FONTSETWIDTH_ULTRAEXPANDED - Ultra expanded
- FXFont fontpitch flags:
- FONTPITCH_DEFAULT - Default pitch
- FONTPITCH_FIXED - Fixed pitch, mono-spaced
- FONTPITCH_VARIABLE - Variable pitch, proportional spacing
- FXFont fonthint flags:
- FONTHINT_DONTCARE - Don't care which font
- FONTHINT_DECORATIVE - Fancy fonts
- FONTHINT_MODERN - Monospace typewriter font
- FONTHINT_ROMAN - Variable width times-like font, serif
- FONTHINT_SCRIPT - Script or cursive
- FONTHINT_SWISS - Helvetica/swiss type font, sans-serif
- FONTHINT_SYSTEM - System font
- FONTHINT_X11 - X11 Font string
- FONTHINT_SCALABLE - Scalable fonts
- FONTHINT_POLYMORPHIC - Polymorphic fonts
- LAYOUT flags:
- LAYOUT_NORMAL - Default layout mode
- LAYOUT_SIDE_TOP - Pack on top side (default)
- LAYOUT_SIDE_BOTTOM - Pack on bottom side
- LAYOUT_SIDE_LEFT - Pack on left side
- LAYOUT_SIDE_RIGHT - Pack on right side
- LAYOUT_FILL_COLUMN - Matrix column is stretchable
- LAYOUT_FILL_ROW - Matrix row is stretchable
- LAYOUT_LEFT - Stick on left (default)
- LAYOUT_RIGHT - Stick on right
- LAYOUT_CENTER_X - Center horizontally
- LAYOUT_FIX_X - X fixed
- LAYOUT_TOP - Stick on top (default)
- LAYOUT_BOTTOM - Stick on bottom
- LAYOUT_CENTER_Y - Center vertically
- LAYOUT_FIX_Y - Y fixed
- LAYOUT_RESERVED_1
- LAYOUT_RESERVED_2
- LAYOUT_FIX_WIDTH - Width fixed
- LAYOUT_FIX_HEIGHT - Height fixed
- LAYOUT_MIN_WIDTH - Minimum width is the default
- LAYOUT_MIN_HEIGHT - Minimum height is the default
- LAYOUT_FILL_X - Stretch or shrink horizontally
- LAYOUT_FILL_Y - Stretch or shrink vertically
- LAYOUT_EXPLICIT - LAYOUT_FIX_X|LAYOUT_FIX_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT
- FXFrame flags:
- FRAME_NONE - Default is no frame
- FRAME_SUNKEN - Sunken border
- FRAME_RAISED - Raised border
- FRAME_THICK - Thick border
- FRAME_GROOVE - A groove or etched-in border
- FRAME_RIDGE - A ridge or embossed border
- FRAME_LINE - Simple line border
- FRAME_NORMAL - Regular raised/thick border
- FXPacker flags:
- PACK_NORMAL - Default is each its own size
- PACK_UNIFORM_HEIGHT - Uniform height
- PACK_UNIFORM_WIDTH - Uniform width
- FXWindow decor flags:
- DECOR_NONE - Borderless window
- DECOR_TITLE - Window title
- DECOR_MINIMIZE - Minimize button
- DECOR_MAXIMIZE - Maximize button
- DECOR_CLOSE - Close button
- DECOR_BORDER - Border
- DECOR_RESIZE - Resize handles
- DECOR_MENU - Window menu
- DECOR_ALL - (DECOR_TITLE|DECOR_MINIMIZE|DECOR_MAXIMIZE|DECOR_CLOSE|DECOR_BORDER|DECOR_RESIZE|DECOR_MENU)
- FXWindow placement flags:
- PLACEMENT_DEFAULT - Place it at the default size and location
- PLACEMENT_VISIBLE - Place window to be fully visible
- PLACEMENT_CURSOR - Place it under the cursor position
- PLACEMENT_OWNER - Place it centered on its owner
- PLACEMENT_SCREEN - Place it centered on the screen
- PLACEMENT_MAXIMIZED - Place it maximized to the screen size
- FXScrollbar/FXSlider flags:
- SCROLLERS_NORMAL - Show the scrollbars when needed
- HSCROLLER_ALWAYS - Always show horizontal scrollers
- HSCROLLER_NEVER - Never show horizontal scrollers
- VSCROLLER_ALWAYS - Always show vertical scrollers
- VSCROLLER_NEVER - Never show vertical scrollers
- HSCROLLING_ON - Horizontal scrolling turned on (default)
- HSCROLLING_OFF - Horizontal scrolling turned off
- VSCROLLING_ON - Vertical scrolling turned on (default)
- VSCROLLING_OFF - Vertical scrolling turned off
- SCROLLERS_TRACK - Scrollers track continuously for smooth scrolling
- SCROLLERS_DONT_TRACK - Scrollers don't track continuously
- FXComposite flags:
- JUSTIFY_NORMAL - Default justification is centered text
- JUSTIFY_CENTER_X - Text is centered horizontally
- JUSTIFY_LEFT - Text is left-justified
- JUSTIFY_RIGHT - Text is right-justified
- JUSTIFY_HZ_APART - Combination of JUSTIFY_LEFT & JUSTIFY_RIGHT
- JUSTIFY_CENTER_Y - Text is centered vertically
- JUSTIFY_TOP - Text is aligned with label top
- JUSTIFY_BOTTOM - Text is aligned with label bottom
- JUSTIFY_VT_APART - Combination of JUSTIFY_TOP & JUSTIFY_BOTTOM
- FXLabel flags:
- ICON_UNDER_TEXT - Icon appears under text
- ICON_AFTER_TEXT - Icon appears after text (to its right)
- ICON_BEFORE_TEXT - Icon appears before text (to its left)
- ICON_ABOVE_TEXT - Icon appears above text
- ICON_BELOW_TEXT - Icon appears below text
- TEXT_OVER_ICON - Same as ICON_UNDER_TEXT
- TEXT_AFTER_ICON - Same as ICON_BEFORE_TEXT
- TEXT_BEFORE_ICON - Same as ICON_AFTER_TEXT
- TEXT_ABOVE_ICON - Same as ICON_BELOW_TEXT
- TEXT_BELOW_ICON - Same as ICON_ABOVE_TEXT
- LABEL_NORMAL - JUSTIFY_NORMAL|ICON_BEFORE_TEXT
- FXButton flags:
- BUTTON_AUTOGRAY - Automatically gray out when not updated
- BUTTON_AUTOHIDE - Automatically hide button when not updated
- BUTTON_TOOLBAR - Toolbar style button [flat look]
- BUTTON_DEFAULT - May become default button when receiving focus
- BUTTON_INITIAL - This button is the initial default button
- BUTTON_NORMAL - (FRAME_RAISED|FRAME_THICK|JUSTIFY_NORMAL|ICON_BEFORE_TEXT)
- FXScrollbar flags:
- SCROLLBAR_HORIZONTAL - Horizontally oriented
- SCROLLBAR_VERTICAL - Vertically oriented
- FXSlider flags:
- SLIDER_HORIZONTAL - Slider shown horizontally
- SLIDER_VERTICAL - Slider shown vertically
- SLIDER_ARROW_UP - Slider has arrow head pointing up
- SLIDER_ARROW_DOWN - Slider has arrow head pointing down
- SLIDER_ARROW_LEFT - Slider has arrow head pointing left
- SLIDER_ARROW_RIGHT - Slider has arrow head pointing right
- SLIDER_INSIDE_BAR - Slider is inside the slot rather than overhanging
- SLIDER_TICKS_TOP - Ticks on the top of horizontal slider
- SLIDER_TICKS_BOTTOM - Ticks on the bottom of horizontal slider
- SLIDER_TICKS_LEFT - Ticks on the left of vertical slider
- SLIDER_TICKS_RIGHT - Ticks on the right of vertical slider
- SLIDER_NORMAL
- FXTextField flags:
- TEXTFIELD_PASSWD - Password mode
- TEXTFIELD_INTEGER - Integer mode
- TEXTFIELD_REAL - Real mode
- TEXTFIELD_READONLY - NOT editable
- TEXTFIELD_ENTER_ONLY - Only callback when enter hit
- TEXTFIELD_LIMITED - Limit entry to given number of columns
- TEXTFIELD_OVERSTRIKE - Overstrike mode
- TEXTFIELD_NORMAL - FRAME_SUNKEN|FRAME_THICK
- FXDial flags:
- DIAL_VERTICAL - Vertically oriented
- DIAL_HORIZONTAL - Horizontal oriented
- DIAL_CYCLIC - Value wraps around
- DIAL_HAS_NOTCH - Dial has a Center Notch
- DIAL_NORMAL
- FXGroupBox flags:
- GROUPBOX_TITLE_LEFT - Title is left-justified
- GROUPBOX_TITLE_CENTER - Title is centered
- GROUPBOX_TITLE_RIGHT - Title is right-justified
- GROUPBOX_NORMAL - 0
- FX*Separator flags:
- SEPARATOR_NONE - Nothing visible
- SEPARATOR_GROOVE - Etched-in looking groove
- SEPARATOR_RIDGE - Embossed looking ridge
- SEPARATOR_LINE - Simple line
- FXMessageBox flags:
- MBOX_OK -Message box has a only an OK button
- MBOX_OK_CANCEL -Message box has OK and CANCEL buttons
- MBOX_YES_NO -Message box has YES and NO buttons
- MBOX_YES_NO_CANCEL -Message box has YES, NO, and CANCEL buttons
- MBOX_QUIT_CANCEL -Message box has QUIT and CANCEL buttons
- MBOX_QUIT_SAVE_CANCEL -Message box has QUIT, SAVE, and CANCEL buttons
- MBOX_CLICKED_YES -The YES button was clicked
- MBOX_CLICKED_NO -The NO button was clicked
- MBOX_CLICKED_OK -The OK button was clicked
- MBOX_CLICKED_CANCEL -The CANCEL button was clicked
- MBOX_CLICKED_QUIT -The QUIT button was clicked
- MBOX_CLICKED_SAVE -The SAVE button was clicked
- FXFileDialog flags:
- FILELIST_SHOWHIDDEN - Show hidden files or directories
- FILELIST_SHOWDIRS - Show only directories
- FILELIST_NO_OWN_ASSOC - Do not create associations for files
- FXFileDialog (setSelectMode()) flags:
- SELECTFILE_ANY - A single file, existing or not (to save to)
- SELECTFILE_EXISTING - An existing file (to load)
- SELECTFILE_MULTIPLE - Multiple existing files
- SELECTFILE_MULTIPLE_ALL - Multiple existing files or directories
- SELECTFILE_DIRECTORY - Existing directory
- FX4Splitter flags:
- FOURSPLITTER_TRACKING - Track continuously during split
- FOURSPLITTER_NORMAL
- FXCheckButton flags:
- CHECKBUTTON_AUTOGRAY - Automatically gray out when not updated
- CHECKBUTTON_AUTOHIDE - Automatically hide when not updated
- CHECKBUTTON_NORMAL - JUSTIFY_NORMAL|ICON_BEFORE_TEXT
- FXComboBox flags:
- COMBOBOX_NO_REPLACE - Leave the list the same
- COMBOBOX_REPLACE - Replace current item with typed text
- COMBOBOX_INSERT_BEFORE - Typed text inserted before current
- COMBOBOX_INSERT_AFTER - Typed text inserted after current
- COMBOBOX_INSERT_FIRST - Typed text inserted at begin of list
- COMBOBOX_INSERT_LAST - Typed text inserted at end of list
- COMBOBOX_STATIC - Unchangable text box
- COMBOBOX_NORMAL - Can type text but list is not changed
Introduction to scripting with TKS+TKFOX
- In general, I recommend putting scripts in dedicated .tks files if possible. On the other hand it may sometimes be handy to include small scripts (i.e. GUI logic) directly in the FXML file.
- The
<script>
element can be used to embed arbitrary script code (e.g. helper functions).
- Not all attributes of an element can be changed after it has been created. In fact, all attributes that are listed with a
fx.
prefix in this documentation can be changed using scripts.
- This is work in progress! The FOX toolkit is a huge project and it will take some weeks to wrap the most important interfaces.
the FXApp object
Upon initialization of the tkfox plugin, a static FXApp object is created in the global namespace. It currently has the following methods:
- create() - actually allocated resources for the widget tree
- run() - run event loop
- runModal() - run modal event loop
- stop() - quit event loop
"named" elements
Each (composite) element (i.e. buttons,sliders etc..) which has been assigned an unique name can be accessed in the (temporary) module namespace with the prefix fx_
.
the current FXObject
Each callback function has an implicit variable called fx
which stores a reference to the current FXButton,FXTextField.. element.
Object members are either addressable by using the "fx.<member>" syntax.
GUI startup script code
use fox;
function CreateRunGUIFromString(Pointer _s) {
String s<=_s;
FXPage p<=new FXPage;
TreeNode troot<=s.parseXML();
if(troot)
{
trace "tree has "+troot.numNodes+" nodes.";
p.createFromTree(troot);
FXApp.create();
FXApp.run();
}
}
String s; s.loadLocal("test.fxml",1);
CreateRunGUIFromString(s);
// :)
Examples
"hello, world":
font face="Courier New"><fxmainwindow><fxbutton text="&Hello, world." onLeftBtnRelease="FXApp.stop();"/></fxmainwindow>
- creates a top level window with a button in it that reads "hello, world". Clicking the button exits the application.
"Slider":
<fxmainwindow>
<fxfont id=fnText face=helvetica size=12/>
<fxlabel id=lbValue text="n/a" font="fnText"/>
<fxtextfield id=tfValue cols=32 flags="TEXTFIELD_INTEGER" text="0"
onKeyPress='
int i=tcint(fx.text);
fx_lbValue.text="Current value: "+i;
fx_sbValue.value=sqrt(i);
'
/>
<fxslider id=sbValue lo=0 hi=100 value=1 layoutHints="LAYOUT_FILL_X,LAYOUT_FIX_HEIGHT" h=21
onMotion='
int i=_value*_value;
fx_lbValue.text="Current value: "+i;
fx_tfValue.text=i;
'
/>
<fxbutton font="fnText" text="Quit" layoutHints="LAYOUT_RIGHT" onLeftBtnRelease='FXApp.stop();'/>
</fxmainwindow>
- creates a top level window with a label, a textfield, a slider and an exit-button. The label and textfields displays the square of the current slider value. Entering text in the textfield in turn updates the slider (square root of text typecasted to int). Clicking the button exits the application.
"MessageBox1":
<fxmainwindow id=main>
<fxbutton text="Open error dialog.." layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='FXMessageBox_error(fx_main, 0, "caption","..error..");'
/>
<fxbutton text="Open warning dialog.." layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='FXMessageBox_warning(fx_main, 0, "caption","..warning..");'
/>
<fxbutton text="Open information dialog.." layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='FXMessageBox_information(fx_main, 0, "caption","..information..");'
/>
<fxbutton text="Open question dialog.." layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='FXMessageBox_question(fx_main, 0, "caption","..question..");'
/>
<fxbutton text="Quit" layoutHints="LAYOUT_FILL_X" onLeftBtnRelease='FXApp.stop();'/>
</fxmainwindow>
- A simple FXMessageBox test application.
"FileDialog":
<fxmainwindow id=main>
<fxfiledialog id=myfile title="Open file"
filename ="test.txt"
pattern ="*.txt"
/>
<fxfiledialog id=mymultifile title="Open files"
filename ="test.txt"
pattern ="*.txt"
patternList ="All files (*)\nText files (*.txt)\nPNG Images (*.png)\n
TKScript source (*.tks)\nTKScript pak files (*.tkx)\nFXML files (*.fxml)\nC++ source (*.cpp)\nC++ header (*.h)"
currentPattern =4
selectMode ="SELECTFILE_MULTIPLE"
/>
<fxbutton text="Open single file dialog.." layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='
if(fx_myfile.execute())
{
trace "selected file=\""+fx_myfile.filename+"\"";
trace "selected dir=\""+fx_myfile.directory+"\"";
}
'
/>
<fxbutton text="Open multi file dialog.." layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='
if(fx_mymultifile.execute())
{
trace "selected files:";
StringArray fs<=fx_mymultifile.filenames;
trace " num="+fs.numElements;
String s; foreach s in fs trace " \""+s+"\"";
}
'
/>
<fxbutton text="Quit" layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y" onLeftBtnRelease='FXApp.stop();'/>
</fxmainwindow>
- Demonstrates single + multi select file dialogs.
"FourSplitter":
<fxmainwindow id=w w=512 h=384>
<fxverticalframe>
<fx4splitter id=split layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y">
<fxgroupbox text="sector 0" layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y">
<fxbutton text="expand sector 1" layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y"
onLeftBtnRelease='fx_split.expanded=1;'
/>
</fxgroupbox>
<fxgroupbox text="sector 1">
<fxbutton text="expand sector 2" layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y"
onLeftBtnRelease='fx_split.expanded=2;'
/>
</fxgroupbox>
<fxgroupbox text="sector 2">
<fxbutton text="expand sector 3" layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y"
onLeftBtnRelease='fx_split.expanded=3;'
/>
</fxgroupbox>
<fxgroupbox text="sector 3">
<fxbutton text="expand sector 0" layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y"
onLeftBtnRelease='fx_split.expanded=0;'
/>
</fxgroupbox>
</fx4splitter>
<fxbutton text="reset splitter" layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='fx_split.expanded=-1; fx_split.hSplit=5000;fx_split.vSplit=5000;'
/>
</fxverticalframe>
</fxmainwindow>
- Demonstrates the FX4Splitter layout manager.
"ColorDialog":
<fxmainwindow id=main>
<fxverticalframe>
<fxcolordialog id=dia title="Select color"
<!-- rgba ="#ffd78623"-->
opaqueOnly =0
/>
<fxbutton text="Open color dialog.." layoutHints="LAYOUT_FILL_X"
onLeftBtnRelease='
if(fx_dia.execute()) {
trace "selected color=\""+fx_dia.rgbaString+"\"";
fx_html.text=fx_dia.rgbaString;
}
else
trace "colordialog aborted.";
'
/>
<fxhorizontalframe>
<fxlabel text="HTML color (#aarrggbb):"/>
<fxtextfield id=html text="#ffd78623" onVerify='fx_dia.rgba=_text;'/>
</fxhorizontalframe>
<fxbutton text="Quit" layoutHints="LAYOUT_FILL_X,LAYOUT_FILL_Y" onLeftBtnRelease='FXApp.stop();'/>
</fxverticalframe>
</fxmainwindow>
- Demonstrates the FXColorDialog widget.
"CheckButton":
<fxmainwindow>
<fxcheckbutton text="check it out" check=1 checkButtonStyle="" boxColor=""
onLeftBtnRelease='trace "button has been "+(_check?"checked":"unchecked");'/>
</fxmainwindow>
- Demonstrates the FXCheckButton widget.
"ComboBox":
<script body='
function PickCategory(int _cat) {
trace "You picked category #"+_cat+" (\""+fx_main.getItemText(_cat)+"\")";
if(_cat)
fx_sub.items="red\ngreen\nblue\nalpha";
else
fx_sub.items="one\ntwo\nthree\nfour";
fx_sub.editable=true;
}
function PickItem(int _item) {
trace "You picked item #"+_item+" (\""+fx_sub.getItemText(_item)+"\")";
}
'/>
<fxmainwindow>
<fxverticalframe>
<fxgroupbox text="ComboBox-Test">
<fxhorizontalframe>
<fxverticalframe frameStyle="FRAME_NONE">
<fxlabel text="Category:"/>
<fxlabel text="Item:"/>
</fxverticalframe>
<fxverticalframe frameStyle="FRAME_NONE">
<fxcombobox id="main" numColumns="18" items="Numbers\nColor channels"
onListClicked='PickCategory(_item);'/>
<fxcombobox id="sub" numVisible="4" numColumns="18" text="Pick a category first!"
editable="0" onListClicked='PickItem(_item);'
/>
</fxverticalframe>
</fxhorizontalframe>
</fxgroupbox>
<fxbutton layoutHints="LAYOUT_FILL_X" text="&Quit" onLeftBtnRelease='FXApp.stop();'/>
</fxverticalframe>
</fxmainwindow>
- Demonstrates the FXComboBox widget.
Final notice: This project is discontinued. It should merely be considered as a proof-of-concept experiment although currently my work focuses on creating a new GUI addon. stay tuned :)
OpenGL is © 1992-2004 by Silicon Graphics and the OpenGL consortium <http://www.sgi.com/software/opengl/license.html
Mozilla is © 1998-2004 The Mozilla Organization / Netscape <http://www.mozilla.org/about/
XAML/Avalon is © 2002-2004 by Microsoft <http://www.microsoft.com
FOX is © 1997-2004 by Jeroen van der Zijp <http://www.fox-toolkit.org>
GLADE is © 1998-2004 by Damon Glade <http://glade.gnome.org>
TKScript, YAC and FXML are © 2001-2004 by Bastian Spiegel <http://tkscript.de>