Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 15 OCT 2004 05:20:48AM Le wrote:

Hi, I've already asked abt context menus here and I've been said to read some info in Knowledge Base. I've done it. There is a very useful article there, but the theme is how to create a right-click context menu for any controls. I'd like to use it for EditTable, and I want the menu to appear near the selected cell. I think i can pass the coordinates of click to "omnievent" and then to execute subroutine "utility" with MenuStruct. But i do not know the structure of "MenuStruct", that was used in that example. Where can i read about it? Or maybe you know better way to solve this problem? :) Thank you!


At 15 OCT 2004 01:07PM Richard Hunt wrote:

Le,

A couple steps to follow…

1) In the window create event you must enable the right click event for the edittable.

RESULT=SEND_MESSAGE(EDITTABLE_FOCUS,'QUALIFY_EVENT','528',1)

2) Within the edittable winmsg event (here is what you might be missing).

DECLARE FUNCTION POSTMESSAGE

IF WPARAM EQ 516 THEN

RESULT=POSTMESSAGE(HWND,516,0,LPARAM)

END

RETURN 1

3) The LPARAM variable is how to position the menu. Use this formula to set the position. The LEFT and TOP variables are relevant to the EDITTABLE left and top positions. You would put this code just before the POSTMESSAGE statement within the EDITTABLE WINMSG event.

LPARAM=LEFT + (65536 * TOP)

NOTE: A little help to understanding of the menu structure.

FALSE$=0

TRUE$=1

NOTHING$='

WINDOW=@WINDOW

STRUCTURE=NOTHING$

STRUCTURE=WINDOW:'.MENU' * The name of the control. STRUCTURE=NOTHING$ * The class of the control.

STRUCTURE=MENU' * The type of the control. STRUCTURE=WINDOW * The parent of the control.

STRUCTURE=NOTHING$ * Leave blank. - - - - - - - - - - - - - - - - Now values 6 and beyond are for the actual menu items. - - - - - - - - - - - - - - - - Here is the menu item structure information you need to know about… ITEM=NOTHING$ ITEM=POPUP' or 'ITEM' * Popup for the horizontal menu item. Item for the vertical menu item.

ITEM=FALSE$ * True / false flag if this is the last popup or item. ITEM=FILE' * The name of the menu item control.

ITEM=File' * The display text of the menu item. ITEM=FALSE$ * True / false flag for disabled.

ITEM=FALSE$ * True / false flag for checked (check mark before text). ITEM=FALSE$ * True / false flag for hidden.

ITEM=1024 + 70 * Accelerator key (1024 for ALT) (70 for F). ITEM=Help for file.' * Help text for menu item.

ITEM=2*':APPID:'*OMNIEVENT*':WINDOW:'.ET_1' * The event handler for the menu item. ITEM=NOTHING$ * The menu item style. I just leave this blank.

- - - - - - - - - -

So code for a simple menu would be like this…

* Declare statements.

DECLARE FUNCTION UTILITY

*

* Set program variables. FALSE$=0 TRUE$=1 NOTHING$=' WINDOW=@WINDOW *

* Set up main menu structure.

STRUCTURE=NOTHING$

STRUCTURE=WINDOW:'.MENU'

STRUCTURE=NOTHING$

STRUCTURE=MENU'

STRUCTURE=WINDOW

STRUCTURE=NOTHING$

*

* Set up vertical menu item one. ITEM=NOTHING$ ITEM=POPUP' ITEM=FALSE$ ITEM=P1 ITEM=Popup One' ITEM=FALSE$ STRUCTURE=ITEM *

* Set up horizontal menu item 1 for vertical menu item 1.

ITEM=NOTHING$

ITEM=ITEM'

ITEM=TRUE$

ITEM=P1I1'

ITEM=Popup 1 Item 1'

ITEM=FALSE$

ITEM=TRUE$

ITEM=FALSE$

ITEM=256 + 65

ITEM=Help text for popup one, item one.'

ITEM=2*':@APPID:'*OMNIEVENT*':@WINDOW:'.EDITLINE_1'

STRUCTURE=ITEM

*

* Set up vertical menu item 2. ITEM=NOTHING$ ITEM=POPUP' ITEM=FALSE$ ITEM=P2 ITEM=Popup 2' ITEM=FALSE$ STRUCTURE=ITEM *

* Set up horizontal menu item 1 for vertical menu item 2.

ITEM=ITEM'

ITEM=FALSE$

ITEM=P2I1

ITEM=Popup 2 Item 1'

ITEM=FALSE$

STRUCTURE=ITEM

*

* Set up horizontal menu item 2 for vertical menu item 2. ITEM=ITEM' ITEM=TRUE$ ITEM=P2I2 ITEM=Popup 2 Item 2' ITEM=FALSE$ STRUCTURE=ITEM *

* Set up vertical menu item 3.

ITEM=NOTHING$

ITEM=POPUP'

ITEM=TRUE$

ITEM=Popup 3'

ITEM=Popup 3'

ITEM=FALSE$

STRUCTURE=ITEM

*

* Set up horizontal menu item 1 for vertical menu item 3. ITEM=ITEM' ITEM=FALSE$ ITEM=P3I1' ITEM=Popup 3 Item 1' ITEM=FALSE$ STRUCTURE=ITEM *

* Set up horizontal menu item 2 for vertical menu item 3.

ITEM=ITEM'

ITEM=FALSE$

ITEM=P3I2'

ITEM=Popup 3 Item 2'

ITEM=FALSE$

STRUCTURE=ITEM

*

* Set up horizontal menu item 3 for vertical menu item 3. ITEM=ITEM' ITEM=TRUE$ ITEM=P3I3' ITEM=Popup 3 Item 3' ITEM=FALSE$ STRUCTURE=ITEM *

* Create the menu control.

RESULT=UTILITY('CREATE',STRUCTURE)


At 15 OCT 2004 03:00PM Le wrote:

Thank you a lot for such comprehensive answer :)


At 15 OCT 2004 04:22PM Richard Hunt wrote:

You are welcome. I did forget to mention that Don Bakke did help me on the EDITTABLE WINMSG event part of it.

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/a13d5621e13779d385256f2e003357db.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1