Re: Newbie question about signal handler args

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

 



Hi Larry,

"lookup_widget eliminates the need to pass all possible pointers used
in processing but instead just pass around one, the root (i.e. main
window) widget, and use lookup_widget() to locate all the others.
Actually any widget can be passed as the routine will traverse the
tree to first find the root ans then scan the tree. One must assign
widget names using the Glade macro GLADE_HOOKUP_OBJECT. Glade will
generate these associations in the generated file src/interface.c."

take a look at this peice of code :

    /* Store pointers to all widgets, for use by lookup_widget(). */
    GLADE_HOOKUP_OBJECT_NO_REF(mainWindow, mainWindow, "mainWindow");
    GLADE_HOOKUP_OBJECT(mainWindow, vbox1, "vbox1");
    GLADE_HOOKUP_OBJECT(mainWindow, mainMenuBar, "mainMenuBar");
    GLADE_HOOKUP_OBJECT(mainWindow, fileMenuitem, "fileMenuitem");
    GLADE_HOOKUP_OBJECT(mainWindow, fileMenuitem_menu, "fileMenuitem_menu");
    GLADE_HOOKUP_OBJECT(mainWindow, quitMenuItem, "quitMenuItem");
...
..

    At the heart of the GLADE_HOOKUP_OBJECT macro is the GObject call
g_object_set_data_full. This enables the association of text labels to
widget pointers. One may add an association directly by using this
routine.

The widget pointer can then be found using the widget identifier. i.e.:

..
...
    GtkWidget *widgetPtrToBefound = lookup_widget(window,
"name_of_widget_ie_vbox1");
    assert(widgetPtrToBefound != NULL);

So , are you using the lookup_widget correctily, i mean, populating it
in a proper way to future retrieve its content ?!

Best regards 

On 4/21/05, Ansell, Larry <Larry_Ansell@xxxxxxxxxx> wrote:
> 
> Hi Antonio,
> 
> { snip }
> 
> >hummm ... but are connecting the singnal into the array of buttons, or
> >into each button ?!
> 
> Into each button individually,
> 
> >>for ( ii = 0; ii < 24; ii++ )
> >>{
> >>  sprintf( button, "button%d", ii+11 );
> >>>>>>>>>is this peice of code correct ?! <<<<<
> 
> My bad - I didn't show you enough, I'm doing:
> for loop
> {
>    // construct the name
>    sprintf( button, ... );
> 
>    // to get the pointer to the button
>    portButton = lookup_widget( window1, button );
> 
>    gtk_signal_connect( GTK_OBJECT( portButton ), "focus-in-event",
>    GTK_SIGNAL_FUNC( buttonHandler ), (gpointer *) &ii );
> }
> 
> >shouldn't be something like:
> 
> >gtk_signal_connect( GTK_OBJECT( BUTTON_ARRAY [INDEX] ),
> >"focus-in-event", GTK_SIGNAL_FUNC (buttonHandler ), (gpointer *) ii );
> >}
> 
> I have the project output from glade, the glade output xml. Do you have glade installed?
> 
> Otherwise, I have the following files, that I could attempt to cut down
> 
> callbacks.h, callbacks.c, support.h, support.c, interface.h, interface.c, main.c
> 
> What do you think?
> 
> Thanks,
> 
> Larry
> 


-- 
Antonio Gomes
E-mail: antonio.gomes@xxxxxxxxxxx
Embedded Linux Lab - 10LE
INdT - Instituto Nokia de Tecnologia (Manaus/Br)
NOKIA's Technology Institute
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux