Re: Dynamic Menus


Subject: Re: Dynamic Menus
From: Joaquin Cuenca Abela (cuenca@pacaterie.u-psud.fr)
Date: Sat Sep 15 2001 - 07:49:43 CDT


Martin wrote:
>
>
> On Thu, 13 Sep 2001, Joaquin Cuenca Abela wrote:
>
> > Jared wrote:
> > > Hrmn. I'm still pretty confused. Let me see if I can get some more
> > info...
> > >
> > > > The way to get a unused XAP_Menu_Id is to
> > > > ask EV_Menu_LayoutSet for a new one.
> > > >
> > > > Let's assume that you know:
> > > >
> > > > * The label that this item will carry (for instance: "Thesaurus")
<- I
> > > > will call it "stLabel"
> > > > * A position to put your item <- I will call it "nPos"
> > > > * A function to callback (to simplify, let's assume that we only
need
> > a
> > > > string with the name of the method to call back). <- I will call
it
> > > > "stCallback"
> > > > You start creating a new menu item doing:
> > > >
> > > > XAP_Menu_Id id = m_pLayout->addLayoutItem(nPos, EV_MLF_Normal);
> > >
> > > Ok, right here I need a time out. What is m_pLayout? How do I get to
it?
> >
> > Fair enough.
> >
> > The m_pLayout name is a fictive one. I was only trying to explain how
to
> > add a menu item *when* you have a pointer to the right EV_Menu_Layout,
etc.
> >
> > To your question about how can you get a
> > EV_Menu_{Layout,ActionSet,LabelSet}, I replied saying that right now
it's
> > *not* possible (if you're outside XAP_UnixFrame)
>
> Actually it is possible:
>
> XAP_App * pApp = XAP_App::getApp();
> XAP_Frame * pFrame = pApp->getLastFocussedFrame();
> XAP_UnixFrame * pUFrame = static_cast<XAP_UnixFrame *>(pFrame);

If my memory still serves me right, it's not possible.
This downcast has several disavantages, and still it doesn't achieves our
goal (to be able to change the EV_Menu_Layout)

* This code will only work on unix specific code, when really it should be
perfectly xp.
* If I remember right, there is no accesor to the layout & labels *even* in
a UnixFrame (I will check that later)
* Even with one accesor in UnixFrame, this way we will only change the menu
of the last focussed frame, and that's hardly desired behaviour (I guess
that we want to change the menu of *all* the frames).

Cheers,

--
Joaquin Cuenca Abela
e98cuenc@yahoo.com



This archive was generated by hypermail 2b25 : Sat Sep 15 2001 - 07:49:24 CDT