Inferno Contribution: tkeg1

TK Examples

These two programs from Tad Hunt show how to create a scrollable entry widget and also how to display a list of windows.

Scrollable Entry Widget

Oftentimes, you may want an entry widget that is a certain number of characters wide, and you want to allow an arbitrary length input into it. There is a problem: There is no way to scroll back and forth to see the text that has scrolled out of view.

The attached Limbo program, "EScroll" is an example of how to implement scrollable entry widgets.

Compile it with "limbo -gw escroll.b".

When you run it, it will open a new window containing nothing except the titlebar and an entry widget. Enter enough text in the window to cause it to scroll.

Holding the left mouse button down while moving left or right will cause the entry widget to scroll so the text to the left or right, respectively will become visible.

Window List

The attached limbo program uses the Tk builtin module to get a list of all of the current windows, which it traverses and prints out

window-id: (minx, miny) (maxx, maxy)

for each window. This is useful to come up with '-x %x -y %y' command line options to place the windows popped up from the start menu where you like them. It is trivial to extend it to output width and height for each window as well.

It will report 'nil image' for any windows that are hidden in the task bar.


The following files are available for downloading:
escroll.b (1236 bytes)
windows.b (672 bytes)