Page 1 of 1

Menu items...

Posted: Fri Jul 31, 2009 2:27 pm
by Quartermars
Hello ...
Now here is my question, I would like to post a menu bar as seen in most windows programs, File, Tools, etc.  As I hover over it, I should be able to see the menu items.

Now here is my problem, how do I do this?  THe times I have tried, well sorry I failed, well the compiler indicated a major crash.

Thank you for your help in advance.

Nick

Menu items...

Posted: Fri Jul 31, 2009 5:58 pm
by PaPi
Here  a sample, Nick :

PROGRAM BEGIN --------------

` menu_and_popupmenu_test by PaPi
` right mouse click = popmenu wrok
object myform as form
     object menu0 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 `menu0
     object pm as  popupmenu
           object s1 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


PROGRAM END -------------

best regards
PaPi

Menu items...

Posted: Fri Jul 31, 2009 8:13 pm
by Quartermars
Thank you for the help....
I was close, but now I will examine it more closely.