LinuxQuestions.org
Visit Jeremy's Blog.
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 10-18-2005, 11:47 AM   #1
prabhakar_kushwaha
LQ Newbie
 
Registered: Oct 2005
Location: New Delhi
Posts: 26

Rep: Reputation: 15
gtk+ to connect GtkEntry


hi
evert body
i am making a GUI application with GTK+.
i have a problem
I have three GtkEntry widgets in a dialog box with one GtkButton(OK).
i want to get the text written in the GtkEntry when the OK button is pressed through a Callback function.
please tell me code for that Signal connectivity and also call back function prototype.
bye

__________________
prabhakar
 
Old 10-18-2005, 02:30 PM   #2
pita
LQ Newbie
 
Registered: Oct 2005
Posts: 2

Rep: Reputation: 0
hi!

im not quite shure, if i got u right, but here are some general advises using text-entries:

you can set the text of an entry with:
entry.set_text("your text here")

retriving the typed text in an entry works quite similar:
entry.get_text()

connecting a callback method to a button works this way:

button.connect(event, callback_meth [,usr_data])
where usr_data is optional

where event might be in your case: "clicked"

callback_meth(self, widget, event, data=None):
your method here


im working with gtk binding for python, so there might some slight differences in the syntax
but i think the direction is right

greetz
pita
 
Old 10-19-2005, 05:36 AM   #3
prabhakar_kushwaha
LQ Newbie
 
Registered: Oct 2005
Location: New Delhi
Posts: 26

Original Poster
Rep: Reputation: 15
my problem is that
i want a single callback function which take all three GtkEntry widget as argument .
also this callback function is connected by OK button.

so when i press OK button , all Three GtkEntry widget get passed simultanesouly into the callback function ,so that i can store the text of gtkEntry into a dynamically allocated structure.
 
Old 10-20-2005, 12:59 AM   #4
rrs_matrix
LQ Newbie
 
Registered: Oct 2005
Location: India
Posts: 7

Rep: Reputation: 0
Quote:
Originally posted by prabhakar_kushwaha
my problem is that
i want a single callback function which take all three GtkEntry widget as argument .
also this callback function is connected by OK button.

so when i press OK button , all Three GtkEntry widget get passed simultanesouly into the callback function ,so that i can store the text of gtkEntry into a dynamically allocated structure.

what u can do is make all three entry widgets as global. then u will be able to access the widgets in the callback
without even passing it a a parameter to the callback.
or..
u can declare a structure that takes pointer to the three widgets and pass the structure as a parameter to the callback..
this can solve ur problem..

keep clicking...
 
  


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
gtk-gnutella won't connect ubuntu 5.10 garyozzy Linux - Software 1 12-12-2005 04:03 PM
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
cant find gtk-config file or gtk-devel to install happychappy Linux - Software 2 02-16-2005 12:46 AM
Gtk-Gnutella can't connect... it's been 5 hours. Trinity22 Linux - Software 3 04-12-2004 02:59 AM
gtk-gnutella wont connect disciple061 Linux - Software 0 01-18-2004 01:04 AM

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

All times are GMT -5. The time now is 01:35 PM.

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