AddToolMenu method
AddToolMenu(Title$, First, Search$, SearchAfter)
AddToolMenu
The AddToolMenu(Title, First, Search, SearchAfter) method creates a persistent popup menu that will be common to all forms that display a menu. The Search parameter defines the text of a menu that the tool menu will be placed next to. If SearchAfter is TRUE the tool menu will appear to the right of the search menu, otherwise it will appear to the left. If the search menu is not found or Search is NULL then the tool menu will be the very first or last item in the menu depending on the boolean First parameter. Once created, items can be added to the tool menu using the AddTool, AddToolFile and AddToolAlert methods.
Selecting a tool menu item fires a LeftToolClick(Click) event. The Click parameter is the ID of the selected item given when it was created.
DIM IDMail=0 DIM IDDiary=1 REM Get client and forms interfaces. Use the DEFEVENT form of CREATE as we REM will process events OBJECT Client = CREATE "ClientCOM", "KClient", DEFEVENT ClientEvents OBJECT Forms = Client.GetForms() REM Copy diary image to KClient cache COPY OBJECT "/myimages/diary.png" TO "diary.png" REM Create a tool menu containing Mail and Diary Options. REM The tool menu will appear before the Help menu if one exists otherwise REM it will be the last item on the menu bar. Forms.AddToolMenu("&Tools", FALSE, "&Help", FALSE) REM This item uses the stock mail icon Forms.AddTool("&Mail ", IDMail, ENUM Mail) REM This item uses a custom image Forms.AddToolFile("&Diary", IDDiary, "Diary.png") REM Handle the click event. Note this event handler is independent of any form DEFEVENT ClientEvents.LeftToolClick(Click) SELECT CASE Click CASE IDMail MailForm.Open() CASE IDDiary DiaryForm.Open() END SELECT END EVENT