View previous topic :: View next topic |
Author |
Message |
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sun Jan 26, 2003 4:59 pm Post subject: Using SSmenu.dll |
|
|
This demo script shows how to hide menuBar menus and reshow them
when a specific event occurs. For this demo, by selecting the File ->
New -> Html file menu item, will insert the "Insert" and "Format" menus
into the menuBar. By selecting the File -> New -> Text file menu item,
the "Insert" and "Format" menus will be hidden again.
Code: |
external @path(%0)SSmenu.dll
dialog create,Menu Test,-1,0,300,100,CLASS MenuTest
dialog add,MENU,&File,&Open|Ctrl+O,&Save|Ctrl+S,Save &As...,-,&Print|Ctrl+P,-,&Exit|Alt+X
dialog add,MENU,&Edit,&Undo|Ctrl+Z,-,Cu&t,&Copy|Ctrl+C,&Paste|Ctrl+V,Select &All|Ctrl+A
dialog add,MENU,Insert,&Bookmark,&Hyperlink,Horizontal &line
dialog add,MENU,Format,&Background,&Font,&Paragraph
dialog add,MENU,&Help,&Contents,-,&About
dialog add,MENU,New,&Text file,&Html file
menu class,MenuTest
rem Gets the handle of the MenuBar
%%menubar = @menu(menubarId)
rem Gets the handle of the File menu
%%fileMenu = @menu(getsubMenu,%%menuBar,0)
rem Gets the handle of the New menu
%%newMenu = @menu(hideMenu,%%menuBar,5)
rem Inserts New menu as a submenu to File menu
menu insertMenu,%%fileMenu,%%newMenu,0,&New
dialog add,Text,Text1,30,5,290,90,Select a menu item from the File -> New menu
dialog show
goto Text fileMENU
:Evloop
wait event
goto @event()
:Text fileMENU
if @null(%%insertMenu)
menu uncheck,%%newMenu,1
menu check,%%newMenu,0
%%formatMenu = @menu(hideMenu,%%menuBar,3)
%%insertMenu = @menu(hideMenu,%%menuBar,2)
end
goto Evloop
:Html fileMENU
menu uncheck,%%newMenu,0
menu check,%%newMenu,1
menu insertMenu,%%menuBar,%%insertMenu,2,&Insert
menu insertMenu,%%menuBar,%%formatMenu,3,For&mat
%%insertMenu =
goto Evloop
:OpenMENU
:SaveMENU
:Save As...MENU
:PrintMENU
goto Evloop
:UndoMENU
:CutMENU
:CopyMENU
:PasteMENU
:Select AllMENU
goto Evloop
:ContentsMENU
:AboutMENU
goto Evloop
:BookmarkMENU
:HyperlinkMENU
:Horizontal lineMENU
goto Evloop
:BackgroundMENU
:FontMENU
:ParagraphMENU
goto Evloop
:ExitMENU
:CLOSE
exit
|
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sun Feb 02, 2003 11:05 pm Post subject: Another SSmenu.dll Demo |
|
|
This demo script shows how to use SSmenu.dll to hide and show menubar
menus.
Code: |
rem This script demonstrates how to hide and show menubar submenus
rem for varying purposes. For this example, although no file is actually opened,
rem we use the File -> Open menus to hide the original File menu
rem and to insert a modified File menu and Edit menu. We'll use the
rem File -> Close menu to hide the modified File menu and Edit menu and
rem to reinsert the original File menu back into the menubar.
rem
rem This is just a very basic example of how to manipulate menus. Much more complex
rem menu operations can be performed if desired.
TITLE SSmenu.dll MenuBar Demo
external @path(%0)SSmenu.dll
dialog create,SSmenu.dll MenuBar Demo,-1,0,400,300,CLASS WinDemo
dialog add,MENU,&File,&Open|Ctrl+O,-,E&xit|Alt+X
dialog add,MENU,&Help,&About
dialog add,MENU,File1,&New|Ctrl+N,&Open|Ctrl+O,C&lose|Ctrl+F4,&Save|Ctrl+S,Save &As,-,&Print|Ctrl+P,-,E&xit|Alt+X
dialog add,MENU,Edit,&Undo|Ctrl+Z,-,Cu&t|Ctrl+X,&Copy|Ctrl+C,&Paste|Ctrl+V,Select &All|Ctrl+A
menu class,WinDemo
%%menuBar = @menu(menubarid)
%%fileMenu = @menu(getSubMenu,%%menuBar,0)
%%helpMenu = @menu(getSubMenu,%%menuBar,1)
%%editMenu = @menu(hideMenu,%%menuBar,3)
%%file1Menu = @menu(hideMenu,%%menuBar,2)
dialog show
:Evloop
wait event
%E = @event()
goto %E
:OpenMENU
gosub DocOpen
goto Evloop
:CloseMENU
gosub DocClose
goto Evloop
:AboutMENU
:NewMENU
:SaveMENU
:Save AsMENU
:PrintMENU
:UndoMENU
:CutMENU
:CopyMENU
:PasteMENU
:Select AllMENU
info You clicked the @substr(%E,1,-4) menu!
goto Evloop
:ExitMENU
:CLOSE
exit
:DocOpen
if @null(%%open)
%%fileMenu = @menu(hideMenu,%%menuBar,0)
menu insertMenu,%%menuBar,%%file1Menu,0,&File
menu insertMenu,%%menuBar,%%editMenu,1,&Edit
dialog add,EDIT,Ed1,0,0,400,300,,,MULTI,SCROLL,TABS
%%open = 1
end
exit
:DocClose
if %%open
%%editMenu = @menu(hideMenu,%%menuBar,1)
%%file1Menu = @menu(hideMenu,%%menuBar,0)
menu insertMenu,%%menuBar,%%fileMenu,0,&File
dialog remove,Ed1
%%open =
end
exit
|
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|