Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Is LablTk extensible?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-05-05 (18:56)
From: Matt Gushee <mgushee@h...>
Subject: [Caml-list] Is LablTk extensible?
Hi, all--

I have been experimenting with compound widgets in LablTk (a simple
example would be something like a scrolled text window, consisting of a
regular Text widget with horizontal and vertical scroll bars gridded
into a frame), and have come up with a puzzle:

Is there a way to create compound widgets that will fit seamlessly into
the LablTk API? In other words, they will respond to all functions in
the appropriate way? Taking the scrolled text example, in most cases the
behavior should match that of the built-in Text widget: e.g., 

  ScrolledText.insert index text widget

should insert text in the text window, just as Text.insert does. But in
other cases, such as configuring width and height, the outer frame
should be the target of the operation.

Well, it is easy enough to create module-specific functions that forward
their actions to the appropriate sub-widgets. But what about global
functions such as 'pack' and 'grid'? I am not yet familiar enough with
the Tk widget types to be sure, but it seems that they are a closed set,
so that new widgets cannot be recognized as LablTk widgets. Or is there
a straightforward way to 'register' a new widget, so that it can be
passed to 'pack', 'grid', and so on?

By the way, I'm also curious why LablTk doesn't use an object oriented
architecture. Though I'm not an OO fanatic by any means, it seems to me
that OO fits rather naturally with GUI programming, especially for
complex applications where you need to maintain state beyond what is
contained in the widgets themselves. A fully-OO widget library would
also be easier to extend, wouldn't it?

Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through           its fields;   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                            --Lao Tzu (Peter Merel, trans.)

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: