Re: Interdependent widgets



The way to handle this is to have a function doing the update and two handlers with the right signature calling it.

Prewitt, Nathan C ERDC-ITL-MS Contractor wrote:

   This is my first try developing with GTK+ and I seem to have missed what
I think is a very basic thing after looking through the tutorial, the
examples, and the online manual.  I am using glade to design the gui and I
have a main application window and several other dialogs including a file
selection dialog.  My main application window has a menu bar, a tool bar, a
status bar, an opengl drawing area (using gtkGLExt) and a notebook that
contains many interdependent widgets.

   When a file is selected (OK is clicked), a handler catches that signal
to open the file and read the contents.  The widgets on the main application
widget need to be updated to reflect what was read from the file.  These
updates including doing things like setting the ranges on sliders and
spinners.  The problem lies partially in the fact that the file selection
widget is separate from the main application widget.  And, since glade tries
to keep all data private, there seems to be no easy way to identify widgets
in the main application widget when the signal handler is called in response
to a signal initiated by the file selection widget.

   My solution was to make the main application window a global variable.
I have a routine that sets the ranges of several widgets in the main
application widget.  I made this routine a handler for the clicked signal
from the OK button of the file selection widget.  I then tried to make this
also a handler for a signal from a spinner in the main application widget so
that I don't duplicate code (and maybe introduce bugs).  But this would
require a different function prototype for the handler.  I would rather be
able to cause a signal to be generated that will cause the widgets to be
updated without there being any indication of what caused that signal.  Any
clues?

thank you

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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