Menu topic in consolidated help needs help.

Started by George Vagenas, July 20, 2013, 10:39:23 AM

Previous topic - Next topic

George Vagenas

Navigate: Home > Windows Interface Language Reference > Menu Files > Menu File Structure

QuoteSame level menu items must be separated by WIL code.

In the example below, Option #1 and Option #2 are separated by the WIL code which is to be executed.

The menu structure shown will not work, the indentation is wrong.
Code (winbatch) Select
&Top Menu (Lvl 1)

Option 1 (Lvl 2)

Submenu of Option 1 (Lvl 3)

Submenu of Option 1 (Lvl 4)

      WIL code

Option 2 (Lvl 2)

Submenu (Lvl 3)

      WIL code


This fixes the indentation to coincide with the levels tags.
Code (winbatch) Select
&Top Menu (Lvl 1)

Option 1 (Lvl 2)

  Submenu of Option 1 (Lvl 3)

   Submenu of Submenu of Option 1 (Lvl 4)
      ; WIL code
      pause('','')


Option 2 (Lvl 2)

  Submenu (Lvl 3)
      ; WIL code
      pause('','')

Not to be too nit picky but
QuoteSame level menu items must be separated by WIL code.
Should read:
QuoteSame level menu items must be separated by WIL code or submenus.

Thanks

George

Deana

Thanks George. We will look into improving that topic in the help file. We appreciate the input!
Deana F.
Technical Support
Wilson WindowWare Inc.

George Vagenas

Perhaps the revised topic could include an example of using pipes in a menu?  I've played around with it but never been able to change the appearance of a menu.
Thanks

George

Deana

Quote from: George Vagenas on July 24, 2013, 03:06:04 PM
Perhaps the revised topic could include an example of using pipes in a menu?  I've played around with it but never been able to change the appearance of a menu.

George,

  • Ampersand (&) is used to defines an option Alt-key combination for the entry.
  • Underscore (_) which causes a horizontal separator line to be drawn above the associated menu title.
  • Vertical bar (|) (also known as a pipe), which causes the associated menu title to appear in a new column.

This example in the help file shows the use of &, _ and |.

Code (winbatch) Select
&Applications
&Editors   
  &Notepad
    Run("notepad.exe", "")   
  &Studio
    Run("WinBatchstudio.exe", "")   
|&Spreadsheets   
  &Windows-based   
   &Excel
    Run("excel.exe","")   
  _&DOS-based   
   &Quattro
    Run("q.exe", "")


Try adding this code to the PopMenu to see how the Pipe option works.
Deana F.
Technical Support
Wilson WindowWare Inc.

George Vagenas

As you suggested I pasted the example from the help file at the top of WSPopup.mnu, two points:
1. The indentation for sample code is incorrect, here's the fixed indentation:
Code (winbatch) Select
&Applications

&Editors
  &Notepad 
       Run("notepad.exe", "")
  &Studio
       Run("WinBatch studio.exe", "")

|&Spreadsheets
;&Spreadsheets
  &Windows-based
   &Excel
          Run("excel.exe", "")

  _&DOS-based
   &Quattro
          Run("q.exe", "")


2. I didn't have a question about the use of "_" or "&" in menus. Commenting out "|&Spreadsheets" and using "&Spreadsheets" has no effect on the appearance of the menu that I can discern.  May I suggest that you paste the modified code into PopMenu and try it with and without the "|".
Thanks

George

Deana

Quote from: George Vagenas on July 26, 2013, 03:56:37 PM
2. I didn't have a question about the use of "_" or "&" in menus. Commenting out "|&Spreadsheets" and using "&Spreadsheets" has no effect on the appearance of the menu that I can discern.  May I suggest that you paste the modified code into PopMenu and try it with and without the "|".

The Pipe does have an effect on how the menus are displayed in Popmenu.mnw. See below
Deana F.
Technical Support
Wilson WindowWare Inc.

George Vagenas

You say Popup.mnw, I say WSPopup.mnu and yes it does work in Popup.mnw but my question was about WSPopup.mnu where it does not have any effect.  Is WSPopup.mnu not a drop down menu even though the use of "_" does create a separator?
Sorry, I'm not trying to be difficult but with Winbatch now offering Menubar and context menus in dialogs I'm just want to have a better understanding of menus.  The menu topic mentions three types of menus, main, drop down and pop-up, but it seems to me the only type of menu we have access to in Studio are drop down.  Why mention menu types that are not applicable to Studio or Winbatch?
It also states that "Generally, these files have an extension of .MNW."  If the "mnu" extension is used to designate a different type of menu file then what type of menu file is it?  On the assumption that the extension denotes a different menu type I pasted the sample menu into "FileMenu for all filetypes.mnw" and discovered that just like WSPopup.mnu it has no effect.
Again, not trying to be difficult, what type of menus are the new dialog menus.  The use of the "&" has the ALT functionality, but using "|" or  "_" does not.  In fact adding either of these symbols to to any of the title field items causes the item to be displayed with symbol as part of its name, e.g. "|SubMenu One".
I've avoided this so far but I may as well mention it now, the sample code provided in "Dialog Menu Example:" is wrong.
Code (winbatch) Select

#DefineFunction MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,rsvd)
   MSG_INIT = 0
   MSG_BUTTONPUSHED=2        ; Pushbutton or Picturebutton
   MSG_MENUITEM=15           ; MenuItem selected
   RET_DO_CANCEL=0           ; Cancels dialog
   RET_DO_DEFAULT= -1        ; Continue with default processing for control
   RET_DO_NOT_EXIT= -2       ; Do not exit the dialog
   ON_EQUAL = @TRUE                                         ; Initialize variable ON_EQUAL
   Switch MyDialog_Message                                  ; Switch based on Dialog Message type
      Case MSG_INIT                                         ; Standard Initialization message
         DialogProcOptions(MyDialog_Handle,MSG_BUTTONPUSHED,@TRUE)
         DialogProcOptions(MyDialog_Handle,MSG_MENUITEM,@TRUE)
         Return(RET_DO_DEFAULT)
     Case MSG_BUTTONPUSHED
        Switch ON_EQUAL
           Case MyDialog_Name == "PushButton_RightClickMe"           ; Right Click Me!
              Pause('Notice','You Left-Clicked the button')
              Return(RET_DO_NOT_EXIT)
           Case MyDialog_Name == "PushButton_Cancel"       ; Cancel
              Pause('Notice','You pressed Cancel')
              Return(RET_DO_CANCEL)
        EndSwitch                                          ; MyDialog_Name
        Return(RET_DO_DEFAULT)
     Case MSG_MENUITEM
        Switch ON_EQUAL
           Case MyDialog_Name == "cmi1_PushButton_RightClickMe"      ; PushButton_RightClickMe Context Menu One
              Pause('You Selected:','Context Menu One')
              Return(RET_DO_NOT_EXIT)
           Case MyDialog_Name == "cmi3_PushButton_RightClickMe"      ; cmi1_PushButton_RightClickMe Subcontext Menu One
              Pause('You Selected:','Subcontext Menu One')
              Return(RET_DO_NOT_EXIT)
           Case MyDialog_Name == "cmi2_PushButton_RightClickMe"      ; PushButton_RightClickMe Context menu Two
              Pause('You Selected:','Context menu Two')
              Return(RET_DO_NOT_EXIT)
           Case MyDialog_Name == "mbi1_MyDialog"           ; Dialog_Bar Menu Item One
              ;NOTICE : The user-defined callback is not called in response to the mouse selection of menu
              ;item that have an associated dropdown menus or submenus. The associated dropdown or submenu
              ;is displayed instead. Hot-keys should not be used with menu items that display a dropdown
              ;or submenu.
              Return(RET_DO_NOT_EXIT)
           Case MyDialog_Name == "mbi2_MyDialog"           ; mbi1_MyDialog SubMenu Item One
              Pause('You Selected:','SubMenu Item One')
              Return(RET_DO_NOT_EXIT)
           Case MyDialog_Name == "mbi3_MyDialog"           ; Dialog_Bar Menu Item Two
              Pause('You Selected:','Menu Item Two')
              Return(RET_DO_NOT_EXIT)
        EndSwitch                                          ; MyDialog_Name
        Return(RET_DO_DEFAULT)
   EndSwitch                                                ; MyDialog_Message
   Return(RET_DO_DEFAULT)
#EndFunction
                                                ; End of Dialog Callback MyDialogCallbackProc
;MENUITEMs can be displayed on a menu bar or as a menu item associated with a drop-down, context menu or submenu.
;
;Dropdown menus are created by placing the name of a MENUITEM displayed in the menu bar in the parent attribute
;of the menu item's template entry.  A submenu is started by placing the name of a MENUITEM other than a menu bar
;displayed menu item in the parent attribute.
;
;Context menus are usually activated by right-clicking the client area of a control or dialog.  Create context
;menus by specifying the name of a control in the parent attribute.  If you use the DEFAULT keyword as the
;MENUITEM parent, the context menu will by associated with the dialog and display when the user right clicks on
;an 'empty' area of the dialog or on any control that does not already have a system or template supplied context
;menu.
MyDialogFormat=`WWWDLGED,6.2`
MyDialogCaption=`Menu Sample`
MyDialogX=241
MyDialogY=080
MyDialogWidth=242
MyDialogHeight=117
MyDialogNumControls=009
MyDialogProcedure=`MyDialogCallbackProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0
MyDialog001=`073,047,078,012,PUSHBUTTON,"PushButton_RightClickMe",DEFAULT,"Right Click Me!",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`093,093,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`000,000,000,000,MENUITEM,"cmi1_PushButton_RightClickMe","PushButton_RightClickMe","Context Menu One",DEFAULT,10,DEFAULT`
MyDialog004=`000,000,000,000,MENUITEM,"cmi3_PushButton_RightClickMe","cmi1_PushButton_RightClickMe","Subcontext Menu One",DEFAULT,10,DEFAULT`
MyDialog005=`000,000,000,000,MENUITEM,"cmi2_PushButton_RightClickMe","PushButton_RightClickMe","Context menu Two",DEFAULT,20,DEFAULT`
MyDialog006=`000,000,000,000,MENUBAR,"Dialog_Bar"`
MyDialog007=`000,000,000,000,MENUITEM,"mbi1_MyDialog","Dialog_Bar","Menu Item One",DEFAULT,10,DEFAULT`
MyDialog008=`000,000,000,000,MENUITEM,"mbi2_MyDialog","mbi1_MyDialog","SubMenu Item One",DEFAULT,10,DEFAULT`
MyDialog009=`000,000,000,000,MENUITEM,"mbi3_MyDialog","Dialog_Bar","Menu Item Two",DEFAULT,20,DEFAULT`
ButtonPushed=Dialog("MyDialog")

"Case MyDialog_Name == "cmi1_PushButton_RightClickMe" as the documentation states will never fire because cm1 has a submenu.
Thanks

George

td

FileMenu and WinBatch Studio use context menus.  (MSFT documentation sometimes uses the term context menus and other times uses the term popup menu.) PopMenu (note that is not called PopUpMenu) uses a main menu and drop down menus. 

Dialog menus are not implemented in menu files but in WIL dialog templates and as such follow the dialog template syntax.  The reason for this should be self evident.  A WIL dialog menu can be implemented as a menu bar with drop down menus or a context menu.  Dialog menu usage and syntax is documented in the WIL Dialog function topic and not in the Menu File reference. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Deana

Yes, the pipe symbol really has no effect on the WinBatch Studio Context menu (wsp-user.mnu). This is expected behavior. This is because the Menu File Structure documentation really only applies to Windows Interface Language Menu Utilities: FileMenu And PopMenu.

Lets discuss the various menus in WinBatch:

  • FileMenu Utility (FileMenu For ___.mnw) - FileMenu is a menu utility DLL for the Windows Explorer. It allows you to add custom menu items to the context menus that appear when you right-click on a file in the Windows Explorer.
  • PopMenu Utility (PopMenu.mnw) - PopMenu is a WinBatch desktop interface to Windows batch files written in WIL, the Windows Interface Language. It appears as an icon on the Windows Task Bar.
  • WinBatch Studio Context Menu (wsp-user.mnu/wspopup.mnu)-  a configurable context menu accessed by clicking the right mouse button anywhere within an open file in WinBatch Studio. Using the Windows Interface Language, and WinBatch Studio specific commands, you can write your own macros and place them on this menu for easy access.
  • WIL Dialog Menus - WIL Dialog function supports MENUBAR and MENUITEM controls. Which allows the user to create drop down or context menu ype controls in WIL Dialogs.


As you can see the first two tools (FileMenu and PopMenu) both have a file extension .MNW. The information in the WIL help file under "Menu File Structure" is specific to these two utilities: FileMenu and PopMenu.

Whereas, the WinBatch Studio Context Menu is discussed in the WinBatch Studio Help file under the topic 'Context Menu'. And the WIL Dialog Menus are discussed in the WinBatch Help file under the topic 'WIL Dialog - Menu Editor' and the Windows Interface Language help file under the 'Dialog' function.

In short, those special symbols ( &, | and _ ) only apply to FileMenu And PopMenu Utilities.

Hope this helps clarify the situation.
Deana F.
Technical Support
Wilson WindowWare Inc.

td

As far as I know, accelerators (&), breaks (|), and the separator (_), work when used in WinBatch Studio's context menu menu files.  At least they have always worked for me.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Deana

Quote from: td on July 30, 2013, 02:13:10 PM
As far as I know, accelerators (&), breaks (|), and the separator (_), work when used in WinBatch Studio's context menu menu files.  At least they have always worked for me.

It does seem as though the & accelerator and the  _ separator work the same with all three:  FileMenu, PopMenu and WinBatch Studio Context menus. However the | (pipe) does not seem to create a new column when using the FileMenu and WBSTUDIO  (Context menus),  like it does when using PopMenu ( Main Menu ).

Tony: what effect do you expect for the context style menus when using the pipe symbol?
Deana F.
Technical Support
Wilson WindowWare Inc.

td

That is likely because you are attempting to use it on a sub menu.  The break will only work on a top level (0 level) menu when used with context menus.  For example, if you open Wspopup.mnu and place vertical bar in front of 'Insert Unicode Text' so you end up with '|Insert Unicode Text', save the file and then right click on the WBS editing area, you will see a context menu with two columns.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

George Vagenas

Okay, thank you both for your time and enough of all our time I think.

In general, I have found Studio/Winbatch/WIL documentation to be first rate and I have often copied examples from the help files into scripts and noodled about with the code to better understand it.  Unfortunately, the Menu File documentation does not live up to this standard, on the upside having copied/pasted/noodled with the help file examples I now know what works and what doesn't. 

In no particular order problems with the documentation that I've discovered. 

Given Tony's input it obvious that the Navigate: Home > Windows Interface Language Reference > Menu Files > Menu Items topic needs to be changed. 

Also, using the break symbol in Filemenu has no effect, which at one level makes sense, as Filemenu does not have exclusive access to the Explorer context menu.

Consolidated Help and the old WIL help both show an example of the menu that results from this code:
&Top Menu (Lvl 1)
Option 1 (Lvl 2)
  Submenu of Option 1 (Lvl 3)
   Submenu of Option 1 (Lvl 4)
      WIL CODE

Option 2 (Lvl 2)
  Submenu (Lvl 3)
      WIL CODE

When pasted into Popup.mnw it does not look like the menu shown in the help file.  This is as expected because there are no pipe symbols used to give this appearance. Perhaps the graphic could be updated or the menu code revised?

And as I have pointed out numerous times the indentation of examples in the menu topic needs to be fixed. 

And as always thanks for your time and input.
Thanks

George

td

Quote from: George Vagenas on July 31, 2013, 07:21:54 PM

Also, using the break symbol in Filemenu has no effect, which at one level makes sense, as Filemenu does not have exclusive access to the Explorer context menu.

FileMenu is a bit the outlier in that it does not display the WinBatch parsed menus as returned.  It does some additional processing on each menu item before handing it over to the shell for display.   For what ever reason FileMenu simply ignores menu breaks when doing its additional processing and the shell is never informed of the presents of a break bit.  It would require some investigating to determine whether this is because of an oversight or because of necessity.     
     
Quote
And as I have pointed out numerous times the indentation of examples in the menu topic needs to be fixed. 

I am sure it has been noted and investigated but help files are converted to compiled HTML by a tool and that HTML is then rendered by whatever HTML engine your particular version of Windows happens to have on board at the moment.  Because of the nature of the ever evolving HTML standards and other reasons, there is very limited control over how consistently that HTML gets placed in the clipboard and then pasted into a text editor.  It would be best to assume that the indentation of help file  menu file examples in always going to be wrong and you will need to apply your own indentation.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

George Vagenas

Navigate: Home > Windows Interface Language Reference > Menu Files > Menu File Structure

I'm not talking about the text placed in the clipboard.  When reading the help topic it was immediately apparent that the indentation shown is not correct.  When I copied it I got the indentation that shows in the help file.  The original WIL help has the proper indentation.
Thanks

George

td

As Deana mentioned way back near the top of this topic, the incorrect indentation issue will be looked into.  That should be sufficient to end the discussion.  I have no idea which help file you are referring to as the 'original' help file but the tools to create and read help files have changed several times over the years.  In fact, WinBatch help files did not even consist of compiled HTML until relatively recently.

And I am certainly glad that you get representative indentation when you past examples from help file examples.  My results have not always been so stellar.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade