From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Gtkada: attach signals to menus
Date: Mon, 20 Jun 2016 02:18:29 -0700 (PDT)
Date: 2016-06-20T02:18:29-07:00 [thread overview]
Message-ID: <298bb366-8ee4-4c62-a464-078c2bed8e8a@googlegroups.com> (raw)
In-Reply-To: <nk6ohs$5ot$1@gioia.aioe.org>
On Sunday, June 19, 2016 at 1:33:36 PM UTC-5, Dmitry A. Kazakov wrote:
> On 2016-06-19 17:02, Stephen Leake wrote:
> > Basic menus work, but I can't figure out how to compute the submenu on the fly.
> >
> > Here's my attempt:
>
> [...]
>
> > If I use "On_Activate" for On_Menu_Table, the submenu is not shown. So I tried "On_Select"; still no submenu, and it crashes with
>
> This is because you do not "show" submenu you create.
Arg. I keep expecting things to be shown by default.
> Here I changed your signal handler:
Right, but I want different results depending on some state. I ended up creating all the possible menu items in gtk_new, and using show/hide in On_Menu_Table:
procedure On_Menu_Table (Self : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class)
is
pragma Unreferenced (Self);
begin
case State is
when True =>
Table_Menu_Add.Show;
Table_Menu_Edit.Show;
Table_Menu_Delete.Hide;
when False =>
Table_Menu_Add.Hide;
Table_Menu_Edit.Hide;
Table_Menu_Delete.Show;
end case;
State := not State;
end On_Menu_Table;
That works nicely.
Thanks!
prev parent reply other threads:[~2016-06-20 9:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-18 17:05 Gtkada: attach signals to menus Stephen Leake
2016-06-18 18:07 ` Dmitry A. Kazakov
2016-06-18 18:21 ` Stephen Leake
2016-06-19 15:02 ` Stephen Leake
2016-06-19 18:33 ` Dmitry A. Kazakov
2016-06-20 9:18 ` Stephen Leake [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox