Re: Active widgets



Don't listen to any of them :-)

If you want to change the behaviour of progress bar significantly, I think it's
best to wrap it up as a new widget. GTK makes building widgets very easy (at
least, easier than many other toolkits), plus if you end up with something
useful, it's then very easy to reuse the code, or to share it with other
developers.

There's a section in the tutorial about this:

	http://www.gtk.org/tutorial/ch-writingyourownwidgets.html

John

Chris Phelps wrote:
> 
> Dont listen to either of them :-)
> Any "windowed" widget (basically everything other than a GtkLabel)
> has the "button_press_event" which you can register a handler for.
> 
> to connect:
> gtk_signal_connect(GTK_OBJECT(progress), "button_press_event",
> GTK_SIGNAL_FUNC(button_press_callback), NULL);
> 
> the callback:
> 
> gint button_press_callback(GtkWidget *widget, GdkEventButton *event,
> gpointer data)
> {
>    ...handle the event...
> }
> 
> Later,
> Chris
> 
> On Wed, 2001-09-26 at 13:45, John Hitt wrote:
> > No No No.. That makes things too complicated.  You should be able
> > to get those mouse-click events from placing an event_box widget
> > in or around your widget of choice..
> >
> > See http://www.gtk.org/tutorial/ch-containerwidgets.html#SEC-EVENTBOX
> >
> > -john
> >
> > On Wed, Sep 26, 2001 at 10:10:33AM -0700, rsteinke w-link net wrote:
> > > > From: Marco Lettere <lettere di unipi it>
> > > >
> > > > how can I obtain a widget which is able to respond to mouse-click events
> > > > even if it is not a gtk button.
> > > > I would like to create a progress bar which grows on a click of mouse
> > > > button 1 and shrinks on a click of mouse button 2.
> > > > is this possible with gtk/gdk? how?
> > > > thanx,
> > > > M.
> > >
> > > This should be possible. Basically, you need to write your own widget,
> > > probably derived from the existing progress bar widget, which handles
> > > button_press events.




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