Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 26 JAN 2012 09:34:14PM Kimberley Lao wrote:

How to programmatically modify the menu of the MDI Frame?


At 27 JAN 2012 04:55AM Carl Pates wrote:

Kimberley,

That depends what you mean by "modify".

If you wish to insert new items into a menu at runtime then it's not so easy in OI as this is not really exposed in the current version (though you can insert a separator).

Probably the most common way of modifying menus is to design the menu with ALL the options you need and hide/disable them at runtime by using their VISIBLE and ENABLED properties. If you just want to change the text then you can use the TEXT property.

There are other ways to modify menus but they are more complex and involve creating a menu structure at runtime and attaching it to a form, but you need a good working knowledge of OI window structures and event handlers to do this.

Regards

Carl


At 27 JAN 2012 10:33AM Kimberley Lao wrote:

Thank you.


At 23 FEB 2012 04:25AM Kimberley Lao wrote:

1) Yes, you are right, I need to know how to insert a separator.

2) Will it be complicated to insert new items into a menu at runtime like the Procedure Names are inserted below the EXIT in the file menu of the System Editor?


At 23 FEB 2012 01:27PM Richard Hunt wrote:

Kimberly,

I have done what you have stated in your item 2. Basically as noted above, it is easiest if you build your menu structure at development time as follows (this is a brief description to help you start)…

Add 10 items below the "EXIT". Then for all those ten items SET_PROPERTY their focuses as VISIBLE being 0, ENABLED being 0.

Once the user enters an item that you want to include in the menu, then SET_PROPERTY the focus of the menu item TEXT to what ever text you want, VISIBLE being 1 and ENABLED being 1. This will allow the menu item to show up and accessible.

What I did was to have ten previous records (or invoices) be displayed just like the SYSTEM EDITOR does. I set it up in the READ event. The MENU event is used when the menu item is clicked. I extract the invoice number from the TEXT property of the menu focus and send a READ event. Mine kinda looks like this…

1 > 12345

2 > 12346


At 25 FEB 2012 02:10AM Kimberley Lao wrote:

During development, I Added 10 items below the "EXIT" and set 0 to properties (VISIBLE & ENABLED ) as you instructed.

The EXIT is on the 9th position and the top most is the File Open. During runtime, I set "1" to properties VISIBLE and ENABLED to these ten items but they are moved to the position above the File Open. How can I move these 10 items below the EXIT as the way I put them during the development?


At 27 FEB 2012 12:56PM Richard Hunt wrote:

I have never had that happen to me. I have never had menu items move when using SET_PROPERTY to set the VISIBLE and ENABLED properties of a menu.

First thing I would do is to see what the menu looks like before you set the properties VISIBLE and ENABLED to 0.

I would also check the SET_PROPERTY sentences in your code to verify you are using them correctly. The "OBJECTNAME", "PROPERTY" and "VALUE" arguments have the same number of values. Otherwise I could not imagine why it works for me and not for you.

Are you saying that all the menu items are there, just that the "10 items" are in the wrong place? Or are there menu items missing once the "10 items" are visible?


At 28 FEB 2012 08:32PM Kimberley Lao wrote:

Thanks for your advice. I finally did it by following your instructions.

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/beb6d2640004f865bd53ed900.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1