Re: how to open menus with alt + .. ?
| From: | Malk0 | Date: | Tue, 26 Jul 2005 06:20:13 +0000 |
| Subject: | Re: how to open menus with alt + .. ? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6102@lists.php.net to get a copy of this message | ||
Hi,
I had the same problem and i think that using 'activate_item' instead
of 'activate' when adding the accelerator will normally do the trick.
$header->add_accelerator("activate_item", $accelgroup,$_key,GDK_MOD1_MASK,0);
$header->connect("activate", 'show_menu');
Generally i do this for all parent menus you can see a full sample in the wiki.
regards,
nathan
2005/7/26, anthony <antonixyz@gmx.net>:
> Hi there,
>
> what I want is (should be ..) quite simple, use alt + f to open the
> "file" menu for example, however I've run into problems.
>
> Consider the following example:
>
> $menubar=&new gtkmenubar();
> global $header; global $menu;
> $header = &new GtkMenuItem("");
> $menubar->append($header);
> $menu = &new GtkMenu();
> $header->set_submenu($menu);
>
> $alabel = $header->child;
> $_key = $alabel->parse_uline("_File");
> $header->add_accelerator("activate", $accelgroup,$_key,GDK_MOD1_MASK,0);
> $header->connect("activate", 'show_menu');
>
> function show_menu1(){
> global $header;global $menu;
> # Alternatives:
> $header->activate(); // 0.
> #$menu->select_item($header); // 1.
> #$menu->activate_item($header,true); // 2.
> #$menu->set_active(1); // 3.
> #$menu->popup(null, null, 'position',0,0 ); // 4.
> #$header->select(); // 5.
> }
>
> Alternatives 0., 1. and 2. shutdown the application, 3. doesn't do
> anything, 4. opens the menu but not where it should, but at the mouse
> pointer position or, alternatively, at a position x,y on the screen
> defined by a function "position", 5. opens the menu but then you can't
> move into it because the downarrow key doesn't work.
>
> Any suggestions?
>
> Anthony
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>