GUIKIT PACKAGE TUTORIAL

GUIKit Example: ActionApp

Code
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Definition
In[4]:=
Click for copyable input
Out[4]=

Example

This example illustrates how to take advantage of objects and easily connect and construct typical user interface elements, such as menu items, toolbars, contextual popup menus and buttons.

This example also highlights the following:

  • Using icon resources relative to the widget definition
  • Constructing menu item widgets
  • Assigning a contextual popup menu (alternate mouse clicking) to another widget
    • Defining names, tooltips, accelerator keystrokes, and icons for an action reused by all other widgets and globally controlling application state though the action widgets
    In[3]:=
    Click for copyable input
Optional: Localization Example

Since the ActionApp example centralizes most definitions of the user interface with the action widgets, it is also relatively easy to add localized versions of the application for many languages and locales. The following variant of the ActionApp widget definition demonstrates one way in which to organize localized data for a widget definition.

Note: The localized strings for the sample languages are not accurate and are only implemented to illustrate how a localized version might appear. Some localizations may not display completely on your machine if certain language fonts and resources are not installed.

Click for copyable input
Click for copyable input
Click for copyable input
Click for copyable input

In this sample technique for localizing content, you add a function that uses Mathematica to load and find localized definitions in the filesystem relative to the widget definition. One benefit of the definition itself being a Mathematica expression is that you can write tools to identify what keys you are using to implement a localized resource.

In[4]:=
Click for copyable input
In[5]:=
Click for copyable input
Out[5]=
Definition
In[6]:=
Click for copyable input
Out[6]=
New to Mathematica? Find your learning path »
Have a question? Ask support »