Re: how to get entry from GtkComboBoxEntry?

2012-09-11 Thread David Nečas
On Tue, Sep 11, 2012 at 03:29:10PM +0400, Vlasov Vitaly wrote:
 I wanna use some ComboBox/Entry widget:
 It should contain tree model with language names and hidden ISO 639-1
 codes, for example English(en) German(de) Russian(ru) or
 other. And, in addition, it should allow to user write ISO 639-1
 language code from keyboard.
 
 So, with tree i can get selected value and respectively get lang code
 from tree.
 When in ComboBox is not selected values, it could mean: 1) User set it
 from keyboard 2) Entry is empty.
 
 It is possible to create ComboBox with tree model and separate entry,
 but i don't like that way.
 
 How to check, whether the user has entered a value from the keyboard or
 entry is empty?
 May be i should use other Entry/ComboBox widget? I used before
 GtkEntryCompletion. It work's, but it uncomfortable with two-letter ISO
 codes.
 
 Now i use gtk-2.0, but later will switch to 3.0. As i can see, in
 gtk-3.0 GtkComboBox and GtkComboxEntry is same thing. But i still can't
 get entry widget from gtk-3.0 ComboBox.

I don't quite get the difference between empty entry and user-typed text
(she could type something and then delete it, for instance).  Anyway, I
will try to answer the simple part:

Use gtk_bin_get_child(comboboxentry) to get the GtkComboBoxEntry's
GtkEntry widget.

Regards,

Yeti

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: how to get entry from GtkComboBoxEntry?

2012-09-11 Thread Vlasov Vitaly
Thank you!
 I don't quite get the difference between empty entry and user-typed
text (she could type something and then delete it, for instance).

Simple pseudo-code:
button_callback(save_lang_button, ComboBoxEntry)
if(combobox selected)
  do_work
else {
  if(entry is empty)
this_is_error()
  else
do_work_with_entry_val()
}

 Use gtk_bin_get_child(comboboxentry) to get the GtkComboBoxEntry's
GtkEntry widget.

Thank you, it should help.
Is gtk_bin_get_child() always return GtkEntry widget?

В Вт., 11/09/2012 в 13:38 +0200, David Nečas пишет:
 On Tue, Sep 11, 2012 at 03:29:10PM +0400, Vlasov Vitaly wrote:
  I wanna use some ComboBox/Entry widget:
  It should contain tree model with language names and hidden ISO 639-1
  codes, for example English(en) German(de) Russian(ru) or
  other. And, in addition, it should allow to user write ISO 639-1
  language code from keyboard.
  
  So, with tree i can get selected value and respectively get lang code
  from tree.
  When in ComboBox is not selected values, it could mean: 1) User set it
  from keyboard 2) Entry is empty.
  
  It is possible to create ComboBox with tree model and separate entry,
  but i don't like that way.
  
  How to check, whether the user has entered a value from the keyboard or
  entry is empty?
  May be i should use other Entry/ComboBox widget? I used before
  GtkEntryCompletion. It work's, but it uncomfortable with two-letter ISO
  codes.
  
  Now i use gtk-2.0, but later will switch to 3.0. As i can see, in
  gtk-3.0 GtkComboBox and GtkComboxEntry is same thing. But i still can't
  get entry widget from gtk-3.0 ComboBox.
 
 I don't quite get the difference between empty entry and user-typed text
 (she could type something and then delete it, for instance).  Anyway, I
 will try to answer the simple part:
 
 Use gtk_bin_get_child(comboboxentry) to get the GtkComboBoxEntry's
 GtkEntry widget.
 
 Regards,
 
 Yeti
 


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: how to get entry from GtkComboBoxEntry?

2012-09-11 Thread David Nečas
On Tue, Sep 11, 2012 at 04:14:52PM +0400, Vlasov Vitaly wrote:
 Is gtk_bin_get_child() always return GtkEntry widget?

For a GtkComboBoxEntry?  Yes.  But in general, it returns the only child
of a GtkBin container, whatever it is for that container.

Yeti

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list