realbasic-nug
[Top] [All Lists]

Re: Menu Arrays Bug - Please Verify

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Menu Arrays Bug - Please Verify
From: Karen <keatk at comcast dot net>
Date: Thu, 30 Nov 2006 20:53:21 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <456F04CC dot 2020402 at free dot fr> <p06110402c194c0523704 at [10 dot 0 dot 0 dot 3]> <219F838A-12DA-49E3-8417-10485F2F68C8 at cuci dot nl> <20061130224246 dot VIXN9669 dot aa03 dot charter dot net at CB56611-T dot chickensys dot com> <2608014A-07A6-41E9-98C5-1FF5AD807BB6 at declareSub dot com> <20061130234825 dot IEEX10028 dot aa02 dot charter dot net at CB56611-T dot chickensys dot com> <87CF2005-C682-46A5-B434-A05FFA198758 at declareSub dot com>

On Nov 30, 2006, at 7:48 PM, Charles Yeomans wrote:

OK, so, wonderful, so how do you set up an Event that has code?

Write a MenuItem subclass in which you implement the Action and EnableMenu event handlers.


But you don't HAVE to subclass to use dynamic MenuItems created in code...


1) New Project

2) To the Default window open event add:

Sub Open()
  Dim MI as New MenuItem

  MI.Name = "Test"
  MI.Text = "test"
  MI.AutoEnable = True
  EditMenu.Append MI
End Sub

3) Then add a MenuHandler to the default window just using the MenuItem name:

Function Test() As Boolean
  MsgBox "called"
  Return True
End Function

4) Run the project and Select "test" from the EditMenu... The MsgBox appears

- Karen

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

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


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