RE: [gtkmm] How to capture Enter pressed on a Entry?



Oops, my mistake.  It appears that you cannot use set_events after the
widget has been realized.  The documentation says the following:

******************
	The event mask determines which events a widget will receive. Keep
in mind that different widgets have different default event masks, and by
changing the event mask you may disrupt a widget's functionality, so be
careful. This function must be called while a widget is unrealized. Consider
add_events() for widgets that are already realized, or if you want to
preserve the existing event mask
*******************

Try using add_events() instead of set_events().

-----Original Message-----
From: Javier Vilarroig [mailto:jvilarroig terra es]
Sent: Wednesday, September 11, 2002 11:40 AM
To: Dale Hirt
Cc: GTKMM Mailing List
Subject: RE: [gtkmm] How to capture Enter pressed on a Entry?


Thanks.

	I tried but doesn't worked. I don't know what do you mean with
realized. I moved it out of the constructor and tried whe I cans see the
form. The error message is exactly the same.


El mié, 11-09-2002 a las 20:15, Dale Hirt escribió:
> Have you tried doing a {entry_widget}.show() before calling set_events()?
> >From the error, it looks like there is a need to realize the widget
first.
> 
> -----Original Message-----
> From: Javier Vilarroig [mailto:jvilarroig terra es]
> Sent: Wednesday, September 11, 2002 11:04 AM
> To: GTKMM Mailing List
> Subject: [gtkmm] How to capture Enter pressed on a Entry?
> 
> 
> Hi.
> 
> 	I'm writing my first app with gtkmm and I have a doubt.I love gtkmm
> but
> have no knowledge of gtk+.
> 
> 	I supose it's a silly question, but I have not found any clue on the
> docs.
> 
> 	I'm trying to capture when a user presses the Enter key on a Entry.
> I
> tried to capture GDK_KEY_PRESS, but calling set_events, inerited from
> Widget, from the constructo gives me this error:
> 
> --------------
> Gtk-CRITICAL **: file gtkwidget.c: line 3824 (gtk_widget_set_events):
> assertion `!GTK_WIDGET_REALIZED (widget)' failed
> --------------
> 
> 	Cold be this is not the correct way, but I don't see any other
> option.
> 
> Thanks in advance.
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




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