Gtk2::Simple::* example/sample code




Here's the first cut, as a tarball.  You should be able to do this:

cd ~
tar zxf gtk2-simple.tar.gz
cd Gtk2
./bindtest.pl
./tietest.pl

The two examples work the same, essentially.  Hit the Update button and
see in the terminal window the contents of your local vars.  Hit the
reset and see what happens to the widgets when the local vars are
changed.

Note the ctor code for the widgets.  I prefer a generic
Gtk2::Simple::<Object>->new_from_widget() instead of more specific
new_from_entry (etc.).  This makes it easier to batch the ctor code
instead of writing it all out by hand (yes, I use this stuff for real in
some GUI scripts).

The multiselect lists are a bit inconsistent.  Tie'd versions have
essentially a bitset with selected indexes = 1, nonselected=0.  The Bind
version just has an array of selected indexes.  I.e.
Tied:  @sel = ( '',1,'','',1,'',1);
Bind:  @sel = (1,4,6);

This is more a problem of the interface for Tied objects.  As I write
this, I'm thinking of passing a ref to ref to array, and letting the
TiedScalar figure out if it points to a scalar or a ref->array, and do
the required magic there.  We'll see.  

Comments appreciated.

Also, whoever was talking about the OptionMenu/SimpleMenu integration,
feel free to munch this code to integrate.  Then we can all check it out
and discuss.



Regards,
Carl

PS - pod docs are invalid, I think they're just remnants from the
initial yank/paste.  Sorry.

PPS - ignore the CascadeList.pm stuff, that's something totally
different (hooking lists together to modify the contents of one
depending on the selection of the previous, hence the "Cascade"
moniker).  I could post that too, but it's just a duplication of
TreeView functionality in a different presentation, so I doubt it's
really useful to anyone.

PPPS  let me know if you have any problems...

Attachment: gtk2-simple.tar.gz
Description: application/compressed-tar



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