Re: GtkMenu ?

From: Date: Mon, 16 Jul 2001 18:35:30 +0000
Subject: Re: GtkMenu ?
References: 1 2  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-2218@lists.php.net to get a copy of this message
On Mon, 16 Jul 2001, Jonas Delfs wrote: > Sorry - the url is: http://delfs.dk/edit4-f.php Okay, what's happening is that your callback gets passed the numerical identifier of the menu item that you specified when defining the item factory. In your code you have: array('/File/New', '', array($this, 'newFileInst'), 0, ''), The menu item callbacks always are always passed that value so that they can figure out what action to take. This is done so that you can have one callback handling more than 1 menu item: array('/File/New', '', array($this, 'fileCB'), 0, ''), array('/File/Open', '', array($this, 'fileCB'), 1, ''), array('/File/Close', '', array($this, 'fileCB'), 2, ''), function fileCB($item) { if ($item == 0) { } else if ($item == 1) { } else if ($item == 2) { } } If you want to pass additional parameters to your callback, you need to specify them like this: array('/File/New', '', array($this, 'newFileInst'), 0, '', array($param1, $param2)), HTH, -Andrei * 2 + 2 = 5 for extremely large values of 2. *

« previous php.gtk (#2218) next »