gnope php gtk gui gnope.org  

GtkComboBox or GtkComboBoxEntry

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
kingrs



Joined: 15 Jan 2006
Posts: 30
Location: Stafford, UK

PostPosted: Tue Apr 11, 2006 5:38 pm    Post subject: GtkComboBox or GtkComboBoxEntry Reply with quote

Hi Christian,
I understand that the GtkComboBox is depricated according to the glade design tool, does this mean I should continue with the GtkComboBoxEntry?

Two issues that may have been already covered:
1. Is there a property to stop entry in the box but still allow drop down?
2. Can I assign a key value to the each line in the combo box?

At the moment I am can populate the drop down and set the default text:

Code:
   $itemType = $glade->get_widget('cmbItemType');
   $toe = array();
   foreach ($localToeRs as $toe_row) {
      $itemType->append_text($toe_row['description']);
      $toe[$toe_row['id']] = $toe_row['description'];
   }
//   $itemType->get_child()->set_text('Type your own or select from the list.');


Bear in mind I am using glade to design the form.

Regards

Rob
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Tue Apr 11, 2006 10:05 pm    Post subject: Reply with quote

GtkCombo is deprecated (See the note: http://php-gtk2.de/manual/en/html/gtk/gtk.gtkcombo.html), GtkComboBox not.

Quote:
2. Can I assign a key value to the each line in the combo box?

I made a class for this, and it is in PEAR:
Gtk2_IndexedComboBox, http://pear.php.net/package/Gtk2_IndexedComboBox
Back to top
kingrs



Joined: 15 Jan 2006
Posts: 30
Location: Stafford, UK

PostPosted: Wed Apr 12, 2006 12:17 am    Post subject: Reply with quote

I fixed the first issue:

Code:
$itemType->get_child()->set_property('editable',false);


Glade design tool has the GtkComboBox in the depricated toolbox, should I just ignore this?

I can create an array to hold the keys in.
I may be able to figure out the correct way at some stage.

Regards

Rob
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Wed Apr 12, 2006 6:35 am    Post subject: Reply with quote

Quote:
Glade design tool has the GtkComboBox in the depricated toolbox

Glade2 doesn't distinct between GtkCombo and GtkComboBox. It labels both with "Combo Box", but means "GtkCombo" in the deprecated section.
You really should use GtkComboBox if you don't need the entry.

Quote:
I can create an array to hold the keys in.

As I said: Using an array has many disadvantages, e.g. if you have values twice but with a different key. When using glade, you could just replace the combobox with the indexedcombobox after loading (by cleaning its parent and re-adding the indexed one)
Back to top
kingrs



Joined: 15 Jan 2006
Posts: 30
Location: Stafford, UK

PostPosted: Wed Apr 12, 2006 11:05 am    Post subject: Reply with quote

I installed the GtkIndexedComboBox package and tried the demo, only problem is the GtkComboBox drop down requires you to keep you finger on the left mouse button while you select an entry where the GtkComboBoxEntry stays there until you select an entry.

The GtkComboBox does stay dropped down once in a blue moon.
Is there a property to specify the style of drop down?

Regards

Rob
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Wed Apr 12, 2006 3:43 pm    Post subject: Reply with quote

Quote:
GtkComboBox drop down requires you to keep you finger on the left mouse button while you select an entry

If the combobox has the focus, I can press <space> and the selection menu pops up, without having to press the mouse button.
Further, if I click on the dropdown once, it stays open (at least for me on Linux). It could be that it's a problem with the Gtk implementation on windows.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.