Re: GtkMenu ?
| From: | Jonas Delfs | Date: | Mon, 16 Jul 2001 16:44:19 +0000 |
| Subject: | Re: GtkMenu ? | ||
| References: | 1 2 3 4 5 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-2209@lists.php.net to get a copy of this message | ||
Sure:
$this->gui['accel'] = &new GtkAccelGroup;
$this->gui['window']->add_accel_group($this->gui['accel']);
$this->gui['menu_items'] = array(array('/File', '', NULL, 0,
'<Branch>'),
array('/File/New', '', 'newFileInst', 0, ''),
array('/File/Open', '', 'openFile', 0,''),
array('/File/Save', '', 'saveFile', 0,''),
array('/File/Close', '', 'closeFile', 0,''),
array('/File/Shutdown', '', 'shutDown', 0,''),
array('/Edit', '', NULL, 0, '<Branch>'),
array('/Edit/Copy', '', NULL, 0, ''),
array('/Edit/Paste', '', NULL, 0, ''),
array('/About', '', 'showAboutBox', 0, '<Item>'));
$this->gui['bar'] = &new GtkMenuBar;
$this->gui['item_factory'] = &new
GtkItemFactory($this->gui['bar']->get_type(), '<mbar>',
$this->gui['accel']);
$this->gui['item_factory']->create_items($this->gui['menu_items']);
$this->gui['menubar'] =
$this->gui['item_factory']->get_widget('<mbar>');
$this->gui['menubar']->set_usize(0,30);
$this->gui['vpaned']->add1($this->gui['menubar']);
$this->gui['menubar']->show();
----- Original Message -----
From: "Steph" <Steph.Fox@btinternet.com>
To: "Jonas Delfs" <jonas@delfs.dk>
Sent: Monday, July 16, 2001 6:38 PM
Subject: Re: [PHP-GTK] GtkMenu ?
show us what you have code-wise, it's easier that way (just the relevant part)
----- Original Message -----
From: "Jonas Delfs" <jonas@delfs.dk>
To: "Steph" <steph.fox@btinternet.com>
Cc: <php-gtk@lists.php.net>
Sent: Monday, July 16, 2001 5:38 PM
Subject: Re: [PHP-GTK] GtkMenu ?
Thats very interesting! Especially the list of options i have to define item_type.
It just do not give me a precise answer - how can i call my function?
--
Mvh./Best Regards
Jonas Delfs, http://delfs.dk
----- Original Message -----
From: "Steph" <Steph.Fox@btinternet.com>
To: "Jonas Delfs" <jonas@delfs.dk>; "Geoff A. Virgo"
<wig@mithril.ca>
Cc: <php-gtk@lists.php.net>
Sent: Monday, July 16, 2001 6:25 PM
Subject: Re: [PHP-GTK] GtkMenu ?
I've just been looking at the original GTK+ docs cos the explanation of how this works
isn't very good (anywhere) at present.
The arrays you're passing with create_items contain the following fields:
string path
string accelerator
GtkItemFactoryCallback callback
int callback_action
string item_type
/* possible values for item_type:
* NULL -> "<Item>"
* "" -> "<Item>"
* "<Title>" -> create a title item
* "<Item>" -> create a simple item
* "<CheckItem>" -> create a check item
* "<ToggleItem>" -> create a toggle item
* "<RadioItem>" -> create a radio item
* <path> -> path of a radio item to link against
* "<Separator>" -> create a separator
* "<Branch>" -> create an item to hold sub items
* "<LastBranch>" -> create a right justified item to hold sub items
*/
- HTH, I'm fiddling here too ;)
Steph
----- Original Message -----
From: "Jonas Delfs" <jonas@delfs.dk>
To: "Geoff A. Virgo" <wig@mithril.ca>
Cc: <php-gtk@lists.php.net>
Sent: Monday, July 16, 2001 5:20 PM
Subject: Re: [PHP-GTK] GtkMenu ?
Hi HTH
> The easiest way to do what you're looking for is to use
> GtkItemFactory. There are a couple good tutorials on it out there:
>
> 1) http://www.deafcat.f2s.com/gubbins.php?class=GtkItemFactory
Thanks. I use this eksample.
I just have one little problem:
In the item-array, i specifi a funktion to be executed when a button is clicked. The problem is that
when i click on one of theese buttons i get an error:
<br>
<b>Warning</b>: unable to call item factory callback 'newFileInst' specified
in C:\backup\PROGRA~1\php-gtk\edit4-f\edit4-f.php on line 53 in
<b>C:\backup\PROGRA~1\php-gtk\edit4-f\edit4-f.php</b> on line
<b>17</b><br>
How do i then call another function in my class?
Thanks!
--
Mvh./Best Regards
Jonas Delfs, http://delfs.dk
--
PHP GTK Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net
For additional commands, e-mail: php-gtk-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net