[Glade-users] remove and create new objects (events)...
- From: duarteduque yahoo com br (duarte)
- Subject: [Glade-users] remove and create new objects (events)...
- Date: Tue, 28 Jan 2003 13:07:54 -0000
This is a multi-part message in MIME format.
------=_NextPart_000_00EC_01C2C6CE.450AE620
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Dear List Members,
=20
I am trying to remove dynamically some objects from an gtk based program =
and replace them with new objects. The problem occurs when I try to set =
some events to the new objects that will be created.
=20
There is what I am doing:
=20
/********************************************************/
GtkWidget* create_window (void)
{
GtkWidget *window1;
GtkWidget *alarm;
gint z;
.
=20
alarm =3D gtk_drawing_area_new ();
gtk_widget_ref (alarm);
gtk_object_set_data_full (GTK_OBJECT (window1), "alarm", alarm, =
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (alarm);
gtk_fixed_put (GTK_FIXED (fixed1), alarm, 20, 40);
gtk_widget_set_uposition (alarm, 20, 40);
gtk_widget_set_usize (alarm, 10, 10);
z =3D 1;
gtk_object_set_user_data (GTK_OBJECT (alarm), (void *) z);
=20
gtk_widget_set_events (alarm, GDK_BUTTON_PRESS_MASK | =
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gtk_widget_set_extension_events (alarm, =
GDK_EXTENSION_EVENTS_CURSOR);
signal_disconnect_alarm[0] =3D gtk_signal_connect (GTK_OBJECT =
(alarm), "realize", .
signal_disconnect_alarm[1] =3D gtk_signal_connect (GTK_OBJECT =
(alarm), "button_press_event", .
signal_disconnect_alarm[2] =3D gtk_signal_connect (GTK_OBJECT =
(alarm), "enter_notify_event", .
signal_disconnect_alarm[1] =3D gtk_signal_connect (GTK_OBJECT =
(alarm), "leave_notify_event", .
=20
.
=20
return window1;
}
/********************************************************/
=20
I can draw the new objects in the window, but the button_press_event, =
the enter_notify_event and the leave_notify_event don't work.
=20
The stdout prints this errors messages when I try to create new objects:
Gtk_CRITICAL **: file gtkwidget.c: line 3824 (gtk_widget_set_events): =
assertion '!GTK_WIDGET_REALIZED (widget)' failed
=20
Any ideas?
=20
Best Regards,
Duarte Duque
------=_NextPart_000_00EC_01C2C6CE.450AE620
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman">Dear=20
List Members,<?xml:namespace prefix =3D o ns =3D=20
"urn:schemas-microsoft-com:office:office" =
/><o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman">I am=20
trying to remove dynamically some objects from an gtk based program and =
replace=20
them with new objects. The problem occurs when I try to set some events =
to the=20
new objects that will be created.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman">There=20
is what I am doing:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New =
Roman">/********************************************************/<o:p></o=
:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman">GtkWidget* create_window=20
(void)<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman">{<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>GtkWidget=20
*window1;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>GtkWidget=20
*alarm;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>gint=20
z;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman">=85<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>alarm =3D =
gtk_drawing_area_new=20
();<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>gtk_widget_ref=20
(alarm);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>gtk_object_set_data_full=20
(GTK_OBJECT (window1), =93alarm=94, alarm, (GtkDestroyNotify)=20
gtk_widget_unref);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>gtk_widget_show=20
(alarm);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>gtk_fixed_put =
(GTK_FIXED=20
(fixed1), alarm, 20, 40);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>gtk_widget_set_uposition=20
(alarm, 20, 40);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>gtk_widget_set_usize (alarm,=20
10, 10);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>z =3D=20
1;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>gtk_object_set_user_data=20
(GTK_OBJECT (alarm), (void *) z);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>gtk_widget_set_events=20
(alarm, GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK |=20
GDK_LEAVE_NOTIFY_MASK);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =20
</SPAN>gtk_widget_set_extension_events (alarm,=20
GDK_EXTENSION_EVENTS_CURSOR);<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>signal_disconnect_alarm[0] =3D=20
gtk_signal_connect (GTK_OBJECT (alarm), =93realize=94,=20
=85<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>signal_disconnect_alarm[1] =3D=20
gtk_signal_connect (GTK_OBJECT (alarm), =93button_press_event=94,=20
=85<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>signal_disconnect_alarm[2] =3D=20
gtk_signal_connect (GTK_OBJECT (alarm), =93enter_notify_event=94,=20
=85<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> =
</SPAN>signal_disconnect_alarm[1] =3D=20
gtk_signal_connect (GTK_OBJECT (alarm), =93leave_notify_event=94,=20
=85<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman">=85<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman"><SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>return=20
window1;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman">}<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New =
Roman">/********************************************************/<o:p></o=
:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman">I can=20
draw the new objects in the window, but the button_press_event, the=20
enter_notify_event and the leave_notify_event don=92t=20
work.<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman">The=20
stdout prints this errors messages when I try to create new=20
objects:<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman">Gtk_CRITICAL **: file gtkwidget.c: line 3824=20
(gtk_widget_set_events): assertion =91!GTK_WIDGET_REALIZED (widget)=92=20
failed<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman">Any=20
ideas?<o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-ansi-language: EN-GB"><FONT size=3D3><FONT face=3D"Times =
New Roman">Best=20
Regards,<o:p></o:p></FONT></FONT></SPAN></P><SPAN=20
style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; =
mso-ansi-language: EN-GB; mso-fareast-font-family: 'Times New Roman'; =
mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Duarte=20
Duque</SPAN></FONT></DIV></BODY></HTML>
------=_NextPart_000_00EC_01C2C6CE.450AE620--
_______________________________________________________________________
Busca Yahoo!
O servi�o de busca mais completo da Internet. O que voc� pensar o Yahoo! encontra.
http://br.busca.yahoo.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]