[Glade-users] Setting text from one application window to ano ther
- From: RPADALIA qatargas com qa (Rajesh Padalia)
- Subject: [Glade-users] Setting text from one application window to ano ther
- Date: Mon, 24 Sep 2001 11:47:18 +0300
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C144D5.848A3F20
Content-Type: text/plain
Thank you Rikke and Jeff.
It worked, I simply followed steps in FAQ as suggested by Jeff.
I appreciate the help by both of you. It is great thing about free
software/linux community that you get all help you need!!
Thanks once again.
Rajesh
-----Original Message-----
From: jbrite [SMTP:jbrite webdsi com]
Sent: Monday, September 24, 2001 7:03 AM
To: Rajesh Padalia; 'glade-users ximian com'
Subject: Re: [Glade-users] Setting text from one application
window to another
This is from the Glade FAQ http://glade.gnome.org
Try this out first and see how it works. I'll try to help it you
get stuck.
-Jeff
////////////////////////////////////////////////////////////////////////////
////////////
4.6 How do I get a pointer to a widget in another window?
You need to keep track of pointers to all your toplevel windows.
For simple applications you can just use global variables to store
these
pointers.
For more complicated applications you can use the
gtk_object_set_data() and
related functions to store a pointer to one window inside another
window.
For example, if you want to create a dialog which needs to access
widgets in
the main window you can do this:
dialog = create_dialog1 (); /* Call the function generated by
Glade. */
gtk_object_set_data (GTK_OBJECT (dialog), "main_window",
main_window);
Then when you need to access the main window from within the dialog
code,
you can do this:
main_window = gtk_object_get_data (GTK_OBJECT (dialog),
"main_window");
NOTE: You need to be careful to ensure that the pointer is always
valid.
If the window being pointed to is destroyed, make sure you no longer
use the
pointer to it or your application may crash.
///////////////////////////////////////////////////////////////
On Sunday 23 September 2001 05:00 am, Rajesh Padalia wrote:
> > Hi everybody,
>
> I am new to Glade and this list as well. Glade is fantastic tool
for
> development! I have one query on how to set text form one app to
another.
>
> I have created two application windows in glade: app1 and app2. A
button on
> app1 opens app2 window. I have "clist" on app2 and want to set
text in
> "text entry" area of app1 when row in "clist" in app2 is selected
and OK
> button on app2 is clicked. While I am able to read data from
"clist" and I
> too know how to write in "text_entry" area. The problem is - I
don't know
> how to reference GtkWidget from app2 to app1. Is "lookup_widget"
ok for
> this? Can any body give example of code for it.
>
> I would appreciate any help on this matter. Thanks in advance.
>
> Best Regards,
>
> Rajesh Padalia
----------------------------------------
Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1"
Content-Transfer-Encoding: quoted-printable
Content-Description:
----------------------------------------
------_=_NextPart_001_01C144D5.848A3F20
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [Glade-users] Setting text from one application window to =
another</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2 FACE=3D"Arial">Thank you Rikke and Jeff.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">It worked, I simply followed steps in =
FAQ as suggested by Jeff.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I appreciate the help by both of you. =
It is great thing about free software/linux community that you get all =
help you need!!</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Thanks once again.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Rajesh</FONT>
</P>
<UL>
<P><A NAME=3D"_MailData"><FONT SIZE=3D2 FACE=3D"Arial">-----Original =
Message-----</FONT></A>
<BR><B><FONT SIZE=3D2 FACE=3D"Arial">From: jbrite =
[SMTP:jbrite webdsi com]</FONT></B>
<BR><B><FONT SIZE=3D2 FACE=3D"Arial">Sent: </FONT></B> <FONT =
SIZE=3D2 FACE=3D"Arial">Monday, September 24, 2001 7:03 AM</FONT>
<BR><B><FONT SIZE=3D2 =
FACE=3D"Arial">To: </FONT></B> <FONT SIZE=3D2 =
FACE=3D"Arial">Rajesh Padalia; 'glade-users ximian com'</FONT>
<BR><B><FONT SIZE=3D2 =
FACE=3D"Arial">Subject: </FONT>=
</B> <FONT SIZE=3D2 FACE=3D"Arial">Re: [Glade-users] Setting text from =
one application window to another</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">This is from the Glade FAQ <A =
HREF=3D"http://glade.gnome.org" =
TARGET=3D"_blank">http://glade.gnome.org</A></FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Try this out first and see how it =
works. I'll try to help it you get stuck.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">-Jeff</FONT>
</P>
<BR>
<P><FONT SIZE=3D2 =
FACE=3D"Arial">/////////////////////////////////////////////////////////=
///////////////////////////////</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">4.6 How do I get a pointer to a =
widget in another window?</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">You need to keep track of pointers to =
all your toplevel windows.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">For simple applications you can just =
use global variables to store these</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">pointers.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">For more complicated applications you =
can use the gtk_object_set_data() and</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">related functions to store a pointer =
to one window inside another window.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">For example, if you want to create a =
dialog which needs to access widgets in</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">the main window you can do =
this:</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"> dialog =3D create_dialog1 =
(); /* Call the function generated by Glade. */</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> gtk_object_set_data =
(GTK_OBJECT (dialog), "main_window", main_window);</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Then when you need to access the main =
window from within the dialog code,</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">you can do this:</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"> main_window =3D =
gtk_object_get_data (GTK_OBJECT (dialog), =
"main_window");</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">NOTE: You need to be careful to ensure =
that the pointer is always valid.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">If the window being pointed to is =
destroyed, make sure you no longer use the</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">pointer to it or your application may =
crash.</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">/////////////////////////////////////////////////////////=
//////</FONT>
</P>
<BR>
<BR>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">On Sunday 23 September 2001 05:00 am, =
Rajesh Padalia wrote:</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">> > Hi everybody,</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> I am new to Glade and this list =
as well. Glade is fantastic tool for</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> development! I have one query on =
how to set text form one app to another.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> I have created two application =
windows in glade: app1 and app2. A button on</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> app1 opens app2 window. I have =
"clist" on app2 and want to set text in</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> "text entry" area of =
app1 when row in "clist" in app2 is selected and OK</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> button on app2 is clicked. While =
I am able to read data from "clist" and I</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> too know how to write in =
"text_entry" area. The problem is - I don't know</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> how to reference GtkWidget from =
app2 to app1. Is "lookup_widget" ok for</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> this? Can any body give example =
of code for it.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> I would appreciate any help on =
this matter. Thanks in advance.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> Best Regards,</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">> Rajesh Padalia</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial">----------------------------------------</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Content-Type: text/html; =
charset=3D"iso-8859-1"; name=3D"Attachment: =
1"</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Content-Transfer-Encoding: =
quoted-printable</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Content-Description: </FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">----------------------------------------</FONT>
</P>
</UL>
</BODY>
</HTML>
------_=_NextPart_001_01C144D5.848A3F20--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]