Re: Creating GTKList elements

From: Date: Sat, 23 Feb 2002 09:17:37 +0000
Subject: Re: Creating GTKList elements
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-1316@lists.php.net to get a copy of this message
have a look at this, it has examples of combos and listboxes. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/modules/midgard/module_midgard.class?rev=1.14&content-type=text/vnd.viewcvs-markup for the combo attach a $widget = new gtkcombo() $list = $widget->list; then load the combo up with values (and remember them as an array -> in the example below it is popup_assoc $list->connect('select-child', array(&$this,'combo_select')); function combo_select($list,$listitem) {
             $id = $list->child_position($listitem);
       $value = $this->popup_assoc[$id];
       $this->combovalue = $value;
    }
for clists and ctrees the trick is to add extra data to the nodes $row = $clist->append(array($title)); $clist->set_row_data($row ,$id); then on a row select you do $clist->get_row_data($row); for ctrees http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/modules/bookmark_browser/module_bookmark_browser.class?rev=1.37&content-type=text/vnd.viewcvs-markup $node = $ctree->insert_node(
                   $parent, $sibling,
                    array("SOME TEXT"), 5,
                          $pixmap_closed,  $mask_closed,
                         $pixmap_open, $mask_open,
                         false, false);
$nodedata = array ("KEY"=>"some value");         $clist->node_set_row_data( $node, $nodedata);
and retreive it on select row by function callback_select_row($clist,$node) { $nodedata = $clist->node_get_row_data($node);
       
regards alan Richard Samar wrote:
Hi, my aim is to create a List in GTK similiar to: http://selfhtml.teamone.de/html/formulare/anzeige/select.htm in HTML. I figured out, that I should use the GTKList element, but it takes Items from GTKListItem which I could not create. Actually, what I need are two things the item should have #1 a string which is presented in the list #2 an id or hadnler so I can access this or know which item was selected, clicked on etc. the GtkListItem Element hast a function in C which is called gtk_list_item_new_with_label() which allows at list the string I want (although I wouldn't know how to identify each Item yet). Nevertheless, I couldn't figure out how to use this either. insert_items() of a GtkList object actually "says" that an element of GtkListItem is needed. In addtion to all of t hat, the GTK documentation itself says that gtk_list_insert_items() needs a GList element. I was not able to create an instance of GList element. Any help, advice, source sample would be very helpful. Thanks a lot -moh


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