On Feb 20, 2006, at 1:33 PM, Chuck Pelto wrote:
Okay....
I'm using the example in the Language Reference (LR) RectControl Class
to get a better handle on ContextualMenus (CM).
I've created a test bed application and loaded in the example code for
Handling Contextual Menus from page 562 of the LR into the
ConstructContextualMenu and ContextualMenuAction methods,
respectively.
Nothing happens to build the contextual menu as recommended in the
example project NewContextualMenu. Which, by the by, doesn't use
EITHER of those Event Handlers in order to demonstrate how to do a
new-concept ContextualMenu.
Sooooo.....
...how DOES one access those Event Handlers or, if the CM is in a
listbox, Control methods to build/manage CMs from inside of them?
I've tried calling them from the OPEN event handler, but the compile
just tells me that no such method or property exists.
Correct. Event handlers are called in the class in which they are
declared. They are implemented in a subclass. ConstructContextualMenu
is called when a request to display a contextual menu has been made.
ContextualMenuAction is the menu handler, and is called if a menu item
was selected.
Here is the simplest possible example. Starting from a new project,
open the Window1 code editor. Add the following code to the
ConstructContextualMenu event handler.
dim item1 as new MenuItem
item1.Text = "In"
base.Append item1
item1 = nil
dim item2 as new MenuItem
item2.Text = "Out"
base.Append item2
Return true
Now add the following code to the ContextualMenuAction event handler.
MsgBox hitItem.Text
Return true
Then run the project and control-click on the window. If a contextual
menu pops up, select a menu item and see what happens.
--------------
Charles Yeomans
_______________________________________________
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>