Page 1 of 1

Example of PopupMenu and MainMenu

Posted: Mon Aug 06, 2007 2:06 pm
by falsam
Bonjour :),
Is it  possible to have an example of a popupmenu and a mainmenu. Thank you.

Example of PopupMenu and MainMenu

Posted: Mon Aug 06, 2007 6:00 pm
by PaPi
Hi!
This is for you:
[code]
` menu_and_popupmenu_test by PaPi

object myform as form
     object fomenu as mainmenu
           object menu1 as menuitem
           AutoCheck=True
           Caption="menu_1"
           object menu3 as menuitem
           Caption="menu_3"
           onclick=menuclick3
           end object
           object menu4 as menuitem
           Caption="menu_4"
           onclick=menuclick4
           end object
           end object
           object menu2 as menuitem
           AutoCheck=True
           Caption="menu_2"
           onclick=menuclick2
           end object
     end object `fomenu
     object m as  popupmenu
           object s as menuitem
                 caption="sub1"
                 onclick=clicked
           end object
           object s2 as menuitem
                 caption="sub2"
                       object s3 as menuitem
                             caption="subsub3"
                             onclick=clicked
                       end object
           end object
     end object
end object` myform


myform.showmodal

sub menuclick2(sender as menuitem)
     if sender=menu2 then showmessage "menu2 clicked"
end sub
sub menuclick3(sender as menuitem)
     if sender=menu2 then showmessage "menu3 clicked"
end sub
sub menuclick4(sender as menuitem)
     if sender=menu2 then showmessage "menu4 clicked"
end sub
sub clicked(sender as menuitem)
   showmessage sender.caption+" clicked"
end sub
[/code]

best regards
PaPi

Example of PopupMenu and MainMenu

Posted: Mon Aug 06, 2007 6:09 pm
by falsam
Very simple, Thank you very much :)