Hiding Menus (OpenInsight 32-Bit)
At 10 NOV 2009 08:42:31PM Colin Rule wrote:
There are all sorts of nasty surprises when hiding menus, and making them visible again, but this will be the subject of a later post.
For now I am making specific menus invisible on the Create event of the main screen Form, where the menu options launch screens. Some users don't want to see the menus they are not going to use.
If we have separators, and the menus are hidden around these separators, it could be the case that there are two separators next to each other, with each of the menu options between these being hidden.
Is there any way to refer to the separators, and make these invisible too, in code.
Using OI8
Thanks
Colin
At 11 NOV 2009 08:32AM Bob Orsini wrote:
Separators also have object names. You can make these invisible also with a set_property call.
At 11 NOV 2009 07:01PM Colin Rule wrote:
Interesting, how do I find these.
In the menu designer, they just say with the Popup Id as null.
Looking through the debugger properites, there is no object for these.
Any ideas?
Colin
At 12 NOV 2009 05:12AM [email protected] wrote:
Colin,
There's an undocumented Send_Message method called MENU_DELETE that you can use to remove menu items. It's been in the product since OI3.x and if you look at the old WORKSPACE stored procedure you'll see where it's used when setting up the MRU (this is where I found out about it many moons ago).
Basically you give it the name of an existing menu item and then specify an offset from this item of the *actual* item you want to delete.
E.g.
.bpPre {
font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;}
.bpComment {
font-style:italic;color:#008000;}
.bpDirective {
color:#808000;}
.bpKeyword {
color:#0000FF;}
.bpNumber {
color:#800000;}
.bpString {
color:#008080;}
.bpSymbol {
color:#800040;}
.bpSysVar {
color:#8000FF;}
.bpDebug {
font-size:12pt;font-weight:bold;color:#FF0000;}
.bpDict {
color:#FF8000;}
.bpLabel {
font-size:11pt;font-weight:bold;}
.bpLineNo {
font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;}
0001 * // Example of MENU_DELETE 0002 * // 0003 * // Assume the following menu structure: 0004 * // 0005 * // File 0006 * // New 0007 * // Open 0008 * // Save 0009 * // Sep1 0010 * // Sep2 0011 * // Exit 0012 * // 0013 * // And I wanted to delete Sep2 I could specify to delete 0014 * // the second item along from the Save item like so: 0015 0016 call send_Message( @window, | 0017 "MENU_DELETE", | 0018 @window : ".MENU.FILE.SAVE" : @fm : 2 )Likewise there's also a MENU_INSERT message which works in a similar fashion - specify an "anchor" item and an offset to insert at along with the details.
E.g.
0001 * // Example of MENU_INSERT 0002 * // 0003 * // Assume the following menu structure: 0004 * // 0005 * // File 0006 * // New 0007 * // Open 0008 * // Save 0009 * // Exit 0010 * // 0011 * // And I wanted to insert a separator after Save 0012 0013 equ MF_SEPARATOR$ to 0x00000800 0014 0015 * // Insertion item structure is: 0016 * // 0017 * // <1> Anchor item 0018 * // <2> Offset 0019 * // <3> Text 0020 * // <4> Menu style 0021 0022 item = @window : ".MENU.FILE.SAVE" | 0023 : @fm : 1 | 0024 : @fm : "" | 0025 : @fm : MF_SEPARATOR$ | 0026 0027 call send_Message( @window, | 0028 "MENU_INSERT", | 0029 item )Basically MENU_INSERT is only really useful for inserting separators at the moment - in a future version of OI I hope to expand the menu item interface to make it a little more versatile :)
Battlestar Sprezzatura - BSG 77
Colonial leaders in all things RevSoft