gettingstarted
[Top] [All Lists]

Re: MenuItems.

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: MenuItems.
From: Michael <mdeh at comcast dot net>
Date: Mon, 28 Feb 2005 14:16:29 -0800
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <9F493097D6CCD211B18F0008C7FA88CE0A4FBC92 at jnjausyexs1 dot ap dot jnj dot com>
Thank you Mike,
Michael.
On Feb 28, 2005, at 2:12 PM, POIDINGER, Michael [JJRAU] wrote:





-----Original Message-----
From: gettingstarted-bounces at lists dot realsoftware dot com
[mailto:gettingstarted-bounces at lists dot realsoftware dot com] On
Behalf Of Michael
Sent: Tuesday, March 01, 2005 7:27 AM
To: Getting Started
Subject: MenuItems.

Hi List,
I have a question about dynamic menuItems.
I am able to create them ok, but they are not enabled...and I
think the reason is they do not have menuhandler code. But, I
cannot create the code for this as the menuItems are not
created until run time. So, how does one create the code for
the menuhandlers for a menuItem which has not yet been created?
If this is not too articulate, then it is probably because I
do not yet fully understand the issue.
Thanks in advance.

You have two options
1) Create the dynamic menuItems as a control array, and have the menuhandler
code be able to handle the menu item based on its index

2) Subclass MenuItem, give it code in its action event, and add the dynamic menuItems as instances of your subclass, rather than just menuItem. In this
case you are obviously free to add other methods and properties to the
object, giving you greater flexibility as to what clicking on the menuitem
does.  As an example, I have created a WindowMenuItem as a subclass of
MenuItem.  The action event contains

  dim i as integer
  dim w as expwindow  //a subclassed window

  i = val(me.name)
  w = MainWindow.childWindows.value(i)   //a dictionary of windows that
hangs off the mainwindow
  w.show()


elsewhere I have
    m = MainMenuBar.child("myWindows")
    newM = new windowMenu
    newM.Name = str(eKey)
    newM.Text = t.title
    newM.autoEnable = true
    m.append(newM)

Mike
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>