maemoTk manual

2007/06/19 (c) Tez Ono

News

2007/06/19 : maemoTk-0.3 is now available.
Replace /usr/bin/maemoTk with new one.

What is maemoTk

MaemoTk is a Tcl/Tk script wrapper for NOKIA N800/770.
MaemoTk enables Tcl/Tk scripts to work with almost full-function on NOKIA N800/770.
The main features of maemoTk are shown below

Notice

MaemoTk is not a pure Tcl/Tk interpreter.
It is much slower than plain Tcl/Tk. To be precise, it takes extra time for embedding window. Running speed is almost same.
And also maemoTk consumes more memory than plain Tcl/Tk.

Hildonized plain Tcl/Tk 8.4 is now available.
If you need quick start-up, you should use plain Tcl/Tk.

Requirement

MaemoTk is written in gnocl and Tcl/Tk.
MaemoTk is included in gnocl-0.9.90-3_armel.deb or later. This package requires tcl8.5_0.6-1_armel.deb and tk8.5_0.6-1_armel.deb

Start-up

If you start up maemoTk without any argument, script selector will pop-up.

Script selector of maemoTk has a history function. Tap located at the right of the entry, you can select a script from scripts history list.


If you start up maemoTk with a script name like below

maemoTk /usr/lib/tk8.5/demos/widget
The specified script will directly be loaded and start up.

Display

After selection of script, you have to wait a few second until the window of the script displays.
Tool bar will appear at the bottom of screen along with the embeded toplevel window.
If -menu option has been specified at the toplevel window, "script menu" button will appear at the left side of the tool bar instead of appending a menu bar on the toplevel window.

If another window open, tabs will appear at left side of the screen.
If the size of the window is specified like canvas widget and application area of the screen is smaller than the window size, scroll bar will apear.

If you feel application area is too small, you can specify full screen mode and tools to be invisible.

Menu

By pushing the menu key (binded to F4 key) or tapping the title bar, maemoTk's menu will pop-up.

By tapping script menu button, the script menu will pop up.

Opening a window

If a toplevel window except for "." newly opens, a new page will be added on application area with tab and the window will be embedded to the page.
Popup windows like menus and dialogs will not embedded, but user made popup window may be embedded. If you want to avoid the window to be embedded, you should specify the window's class as dialog. See Tips for details.

Most of wm command functions are disabled, but some are enabled. For example "wm title" is functional.

Switching windows

By tapping a tab, the displayed window will be quickly switched.
If tabs are not shown, you can select "previous page" and "next page" on the maemoTk's menu.

Closing a window

When a toplevel window except for "." is closed, the page where the window is embedded will be also closed.
If the toplevel window "." is closed, maemoTk will quit. Be careful.

"Close the current page" on maemoTk menu is available for forcing to close the current toplevel window.

Text edit

Text edit on text widget and entry widget is available via text edit box.
Text edit box has two modes.
One is a "buffer mode", and the other one is a "key event mode". If text edit box is empty, "key event mode" is on, otherwise "buffer mode" is on.
When you input some string on the text edit box, the string will not be directly appended on text/entry widget but stocked on a buffer. When enter key is pressed or enter button is tapped, the buffer will be released.
By using buffer mode, even if text/entry widget is not displayed, you can edit the string properly.

As another benefit by using buffer mode, input method is available.

If you want to delete strings on text/entry widget, or if you want to input 'enter' key, 'tab' key or short-cut keys such as 'control-c' and 'control-v', key event mode is useful.
Key event mode is available for every widget.
If you want to edit text with key event mode, combination with virtual screen is recommended.

Virtual screen

In some scripts, the area size of toplevel window is not specified or not valid on Gtk window. In that case, if the window size is larger than application area, the entire toplevel window can not be displayed. For example, the image shown below is one of Tkzinc demo scripts. As you can see, the lower part of the famous tiger is not shown.

In this situation, fullscreen mode with hiding tabs and tool bar may be useful. But, a part of the tiger has still been hided.

By specifing "Virtual screen" on maemoTk menu, the window will be scrollable. By scrolling the window, finally you can see the chin of the tiger.

3 button mouse emulation

By tapping 'M' button on tool bar, "tap" event will be binded to middle button event of 3 button mouse.
By tapping 'R' button on tool bar, "tap" event will be binded to right button event of 3 button mouse.
The emulation is not perfect. For example, paste of selection binded to <ButtonPress-2> is not available.

Hardware key event support

Hardware key events of NOKIA N800/770 are supported. The events of menu key (F4) and fullscreen key (F6) are intercepted by maemoTk, but the other keys pass through maemoTk to Tcl/Tk script.
If you want to make good use of zoom-in key and zoom-out key on your Tcl/Tk script, bind <KeyPress-F7> and <KeyPress-F8> to functions.

Tips

Most of applications and extensions don't support embedding itself.
Some programs may work fine without editing the code, but the other programs may have some kind of troubles. When a toplevel window which should not be embedded is embeded, something trouble will occur.

MaemoTk distinguish whether a toplevel window should be embeded or not by the attribute class. If the toplevel window is given -class option, and if the class is any one of "*Dialog", "*Dlg", "Balloon" and "noembed", the toplevel window will not embedded.
Because standard Tk dialogs such as tk_dialog belong to Dialog class, maemoTk does not embed them. If you want to avoid a toplevel window to be embedded, you should find a line containing "toplevel" comand within the script and add a class option such as "-class Dialog" or "-class noembed". If the toplevel window already belong to another class, you have to modify maemoTK. But it is rare case.