LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-10-2005, 07:46 AM   #1
johnnyde
LQ Newbie
 
Registered: May 2003
Location: India
Distribution: Fedora Core 1
Posts: 17

Rep: Reputation: 0
Unhappy gtk+ 2.x How to use lookup_widget ??


hi
we are trying to build interface for existing c appliation. gtk interface was choosen. but the problem is accessing the widgets . there is a function void message() which is need to display a message in a text box "entry1". the function is buried deep inthe code . Like in a onclick event a function is called and there is a large chain of calling function and finally void message is called. how to put the text in "entry1"
thanks in advance
johnny
 
Old 02-11-2005, 05:25 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You need to have the parent widget of the entry. It means, the dialog or window. If you're using Glade (or you're doing the same on your own), all widgets of that dialog are connected with it and can be accessed using lookup_widget. The call looks this way:
Code:
GtkWidget *entry;
entry = lookup_widget(parent_widget,"entry1");
Now you have the entry and can put text inside.
 
Old 02-14-2005, 11:41 AM   #3
johnnyde
LQ Newbie
 
Registered: May 2003
Location: India
Distribution: Fedora Core 1
Posts: 17

Original Poster
Rep: Reputation: 0
from where i'll get the parent pointer

The code is deep inside some file. So how should i be passing the pointer for the widget or the pointer.
I am not able the access the widget even if i pass the pointer to the widget.

can u sugget some links that actually edal with subjects like this
 
Old 02-14-2005, 03:08 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
If you program in GTK in C you need to deal with the pointers yourself. If you use C++ version, it's different.

My preferred solution for GTK with C is to have windows (only windows, not all widgets) as global variables. If you plan to have only one copy of every window open at one time it works nicely.
 
Old 02-15-2005, 10:59 AM   #5
johnnyde
LQ Newbie
 
Registered: May 2003
Location: India
Distribution: Fedora Core 1
Posts: 17

Original Poster
Rep: Reputation: 0
Global Pointers - Working !!!

Thanks
i am using global pointers. and it is working . thanks for the guidelines.
Thanks
Johnny
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Freerock uninstall stole GTK looking for up-to-date pango, atk, gtk, glib and xft tgz Oholiab Slackware 8 09-18-2005 11:57 AM
GTK source install doesn't give gtk-config Feebles Linux - Software 4 06-15-2005 12:51 PM
cant find gtk-config file or gtk-devel to install happychappy Linux - Software 2 02-16-2005 12:46 AM
GTK error when starting gtk-chtheme Dswissmiss Linux - Software 1 10-01-2004 11:53 PM
compiling gaim/ gtk error (two versions of gtk) webazoid Linux - Software 0 07-06-2004 06:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration