Simple-?? classes



Speaking of the SimpleList class, I've implemented similar classes for
OptionMenu, ToggleButton, Entry, and SpinButton.  The primary reason was
to implement Tk-esque system for letting the widget keep a variable
updated with the widget state (and vice-versa) in a much simpler
fashion.

There are two versions of each, one using tied variables, and one bound
to variable references.  The tied vars are simple, but the widget needs
to be around for the var to be able to access it (ie. widget state is
only grabbed when the var is accessed).  

The bound-ref version keeps the var updated with widget state, but you
need to call an explicit update_widget() function if you change the var
contents and expect the widget to reflect that.  This is useful if
you're switching data around and you need the widget to update from
different vars/hashes/etc, you can rebind the var to the widget.  (You
can re-tie a var as well, but that destroys the connection to the
widget, so it's not quite as nice).

bound-ref version is nice for transient stuff, tie is for more permanent
widget structure.


Hierarchy:

SimpleGtk2::Entry
      +-- SimpleGtk2::Tie::Entry
      +-- SimpelGtk2::Bind::Entry
identical for SimpleGtk2::ToggleButton/OptionMenu/SpinButton

One note about OptionMenu, it implements the same simplified interface
of the SimpleList with name=>value pairs.  The values get stored in the
var, and get looked up on var assignment.

The widgets also implement the same ::new/::new_from_widget interface as
in SimpleList.

If this is interesting to anyone, I can post some examples.  The code is
pretty simple.

Regards,
Carl




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]