Re: GtkCombo, GtkEntry question

From: Date: Tue, 28 Jun 2005 22:51:29 +0000
Subject: Re: GtkCombo, GtkEntry question
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5905@lists.php.net to get a copy of this message
Ben - Did you get Nathan's email detailing the solution on extracting the entry? Turns out I was wrong, there is a way to do just that. I didn't see it come across the list, just to me, so I am posting it again here. Apologies if it actually did get to you already. I think his first option is the one you're looking for. Madeleine D. --------------------------- Hi ben, the problem is that the entry is already contained in the gtkcombo. you have 2 solutions but as madeleine i'm not sure that the second sweet you needs. first way: remove the entry from it's actual parent: <?php $combo=&New GtkCombo(); $combo->set_popdown_strings(array('a','b','c')); $entry = $combo->entry; $combo->remove($entry); $entry->Set_Text('foo'); $win=&New GtkWindow(); $win->Set_Usize(200, 200); $win->Add($entry); $win->Show_All(); gtk::main(); ?> but you still can edit the content but perhaps that's what you want, don't know. in an other hand if you want to get it uneditable at all you can add the combo to the window as always and simply set it insensitive: <?php $combo=&New GtkCombo(); $combo->set_popdown_strings(array('a','b','c')); $combo->set_sensitive(FALSE); $entry = $combo->entry; $entry->Set_Text('foo'); $win=&New GtkWindow(); $win->Set_Usize(200, 200); $win->Add($combo); $win->Show_All(); gtk::main(); ?> hope this will help, nathan ------------------ At 03:29 PM 6/28/05 -0700, Benjamin Smith wrote: >On Tuesday 28 June 2005 14:14, Madeleine D. wrote: >> Ben - >> Can you clarify a little what you're trying to achieve here? You can set >> the combo box so it the content can't be changed, but I'm not sure if that >> is the same thing as what you're after. > >I have a list of options available to users for a particular account. >Depending on the type of account being viewed, the options may be >user-selectable, or determined by a database on another server. > >I've not yet come up with a way to say that a GtkCombo widget (which may >contain N options) may not be changed, unless I'm just missing something >fundamental. The only thing I've seen so far is to take the GtkEntry property >out of the GtkCombo and $entry->Set_Editable(false); but this still allows >the user to select other options on the list. > >Since there's callback code that requires a GtkCombo widget along with the >values of list N that I'd rather not have to audit, I figured I could pull >the entry property out of GtkCombo and display it, instead of the full >GtkCombo widget - but it seems that's not in the cards. > >Is there a way to say that a GtkCombo widget, containing list N, and set to >value Y cannot be changed? > >Pseudo: >$combo=&NewGtkCombo(); >$combo->Set_Popdown_Strings($N); >$entry=$combo->entry; >$entry->Set_Editable(false); >$entry->Set_Text($N[$i]); > ># this is where it gets interesting: >$combo->Set_User_Selectable(false); > >..... > >-Ben > >> At 01:24 PM 6/28/05 -0700, Benjamin Smith wrote: >> >Why doesn't this code work as expected? >> > >> >I'm expecting to see a window with a GtkEntry widget in the middle - but >the >> >GtkEntry widget seems to be a no-show. It works fine if I put the Combo >into >> >$win, but I want to just put the $entry widget... >> > >> ><? >> >$combo=&New GtkCombo(); >> >$entry=$combo->entry; >> >$entry->Set_Text('foo'); >> > >> >$win=&New GtkWindow(); >> >$win->Set_Usize(200, 200); >> >$win->Add($entry); >> >$win->Show_All(); >> >?> >> > >> >(The reason is that I have a selection list that people can choose from, >> >unless the record wasn't manually entered. Then, I want to populate the >> field >> >from the database, and make it so you can't change the GtkCombo widget. >> Since >> >there appears to be no method in GtkCombo() to do that, I'd like to just >> >display the GtkEntry widget, without breaking other callbacks that depend >on >> >the GtkCombo widget) >> > >> >-Ben >> >-- >> >"The best way to predict the future is to invent it." >> >- XEROX PARC slogan, circa 1978 >> > >> >-- >> >PHP-GTK General Mailing List (http://gtk.php.net/) >> >To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> >> -- >> PHP-GTK General Mailing List (http://gtk.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > >-- >"The best way to predict the future is to invent it." >- XEROX PARC slogan, circa 1978 >

« previous php.gtk.general (#5905) next »