Example of PopupMenu and MainMenu

In this category you can exchange your programming questions and solutions.
Post Reply
falsam
Posts: 5
Joined: Tue Nov 08, 2005 3:00 pm

Example of PopupMenu and MainMenu

Post: # 145Post falsam
Mon Aug 06, 2007 2:06 pm

Bonjour :),
Is it  possible to have an example of a popupmenu and a mainmenu. Thank you.

PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

Example of PopupMenu and MainMenu

Post: # 146Post PaPi
Mon Aug 06, 2007 6:00 pm

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

falsam
Posts: 5
Joined: Tue Nov 08, 2005 3:00 pm

Example of PopupMenu and MainMenu

Post: # 147Post falsam
Mon Aug 06, 2007 6:09 pm

Very simple, Thank you very much :)

Post Reply