Re: (no subject)



On lør, 2002-05-11 at 16:41, D vid wrote:

I'd like to know if there are functions that could help you to set up 
a kind of a log for a widget : for an option menu , which menu item
was 'activate'
last , for a combo the last strings entered in the entry , for a clist
which rows were selected last , etc ?

I'm not sure what you are asking here...
I guess you could keep the data in the widget itself (see further down).

In the same idea , how do you know the number of rows in a clist ? 

$clist->rows should do the trick.

Of course , you create the clist initially , you allow the user to add
or remove rows , so you might be able to monitor what's in it . But
forcibly the clist knows what's composing itself , so is there no
fonction to easily retrieve the numer of rows , and so forth knowing
everything that's in it without keeping a track , callback after
callback , of all the alterations ?

$clist->rows...
 
Continuing on this track , if this is not implemented natively and that
i really want this kind of feature , i'll need a place to store the
informations . I saw on the C documentation that there are two methods
of the Gtk::Object class : set_data , set_user_data ( the former
doesn't seem to be ported in Gtk-Perl ) . Can i use this , or can it
just hold a string ( and not , for instance a hash , itself containing
references and hashes according to my needs ) ? 


set_data and get_data are indeed not exposed to the perl side (I have a
patch for that - but thats another matter). But you don't really need
them. Because all gtk-perl objects are perl hash'es so to store
something you just stick it in the hash:
    $clist->{foo}= "bar";

You only need set_data and get_data if you mix C and perl.
 
If i can't , it seems that Gtk-Perl uses a hash ( in regard of the
informations given when you make a "print" on a widget ) , could i
create ( cautiously ) just one entry ( a hash reference ) in it that
would hold afterwards all the informations needed ? What's its little
name ?

That you can, see above.


Last question leading to a , truly ( i swear ! ;-) , ultimate one : 
aren't this kind of features implemented in Gnome ( as it seems that
Gnome is , among other things , another layer intended to automate a
few things for the programmer ) ?

As far as I can tell you are only asking for thinks allready present in
Gtk, so no...
The glue added by the gnome libs are rather higher level things.

Hence , if i ask this question , it's because i can't seem to find
a good tutorial or documentation on Gnome-Perl ( and i reaaally don't
understand a thing in C , i'm not sure i know enough of it to code a
"Hello world" ...;-) , could you indicate an URL ?


Stephen Wilhelm has written a really good tutorial:
    http://personal.riverusers.com/~swilhelm/gtkperl-tutorial/
    
Also "perldoc Gtk::cookbook" will give you a few of the basics.

./borup




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