GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Dec 22, 2014 1:22 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Digging into ComboBox[Entry]
PostPosted: Wed Oct 03, 2007 12:26 pm 
Hello, I'm working on an widgetset abstraction layer and we're trying to "unify" event models above the widgetsets.

I'm currently having a lot of trouble with GtkComboBox[Entry] because of the quite limited signals and access.

For example, I need a "OnDropDown" event to trigger whenever the combobox opens it's list of items. How do you go about this? I noticed that in 2.12 a signal was added for, am I to understand this was impossible to do [without Private struct hacks] before?

Another thing is for example "OnSelect". This should trigger whenever the active entry is changed, but only by outside. For example, it should trigger if you click on the combobox, and select something, or if you press "up" or "down" and change the active event. But it SHOULD NOT trigger when user writes something into the Entry (if there's one).

I get it there's no way to get this directly, only emulate by some state-machine?

Also I noticed, that in 2.10, when you have a GtkComboBoxEntry, and click into the entry area, press "down" it doesn't work. But in 2.12 it does. Was this a bug?

Sorry for the swamping, but I'm pretty frustrated by the lack of control over Gtk widgets which is presented via the public interfaces...

I've been using mostly hacks to get things done (eg: the private struct members), but I really hope there's a better way.

Thanks


Top
  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 3:09 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
From the API:

Quote:
A GtkComboBoxEntry is a widget that allows the user to choose from a list of valid choices or enter a different value. It is very similar to a GtkComboBox, but it displays the selected value in an entry to allow modifying it.

In contrast to a GtkComboBox, the underlying model of a GtkComboBoxEntry must always have a text column (see gtk_combo_box_entry_set_text_column()), and the entry will show the content of the text column in the selected row. To get the text from the entry, use gtk_combo_box_get_active_text().

The changed signal will be emitted while typing into a GtkComboBoxEntry, as well as when selecting an item from the GtkComboBoxEntry's list. Use gtk_combo_box_get_active() or gtk_combo_box_get_active_iter() to discover whether an item was actually selected from the list.

Connect to the activate signal of the GtkEntry (use gtk_bin_get_child()) to detect when the user actually finishes entering text.

The convenience API to construct simple text-only GtkComboBoxes can also be used with GtkComboBoxEntrys which have been constructed with gtk_combo_box_entry_new_text().

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 3:31 pm 
Well using the get_active is one way, but requires state-keeping. Still doesn't solve the OnDropDown for Gtk older than 2.12.

Thanks anyway, I didn't notice it before.


Top
  
 
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 5 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