GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Sep 20, 2014 7:59 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: associate each entry with a variable?
PostPosted: Wed Nov 07, 2012 1:19 pm 
Offline
Familiar Face

Joined: Fri Oct 26, 2012 10:49 am
Posts: 37
Hello
I have a dialog with n GtkEntries, that have been created dynamically.
When an Entry has been edited, the signal activate is connected.
g_signal_connect(G_OBJECT(value),"activate",G_CALLBACK(cb_valueEdited),(gpointer)&re_local.userdata);

How can I associate each entry with a variable?
If I edit the first Entry it has to change the variable "speed"
The second one should change the variable "acceleration" and so on.

For sure I'm not the only one who has to put an edited value into a variable.
Can somebody say me how to do it smart?

Thank you!
MBoerner


Top
 Profile  
 
 Post subject: Re: associate each entry with a variable?
PostPosted: Wed Nov 07, 2012 9:08 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
I'm not too sure exactly what the question is you are asking, as there seems to be a number of different aspects.
Firstly you probably really don't want to connect activate. This is only when the user starts to possibly edit the entry. It is better to update the variable when you want it rather than try to keep them synced.
Secondly the variables you suggest seem to imply that it is just numeric rather than text values you are after. In this case gtk_spin_button is a much better widget. It has a value changed signal which is likely exactly what you want. It can then be obtained with the _get_value or _get_value_as_int functions.
Lastly make sure that any spinbutton and its label are related with something like gtk_label_set_mnemonic_widget or atk_object_add_relationship


Top
 Profile  
 
 Post subject: Re: associate each entry with a variable?
PostPosted: Thu Nov 08, 2012 7:16 am 
Offline
Familiar Face

Joined: Fri Oct 26, 2012 10:49 am
Posts: 37
thank you! It sounds good.
I never used spin buttons.
I'm going to study them and their possibilities
Thanks a lot.
MBoerner


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group