|
-
December 20th, 1999, 07:56 AM
#1
Pull down Menu
I have written an program witch has a pull down menu. I want to make at run time new etries in the pull down menu. At the moment I have 10 etries witch are hidden. When I want to make a new one, I set it to not hidden. But with this methode I can only add 10 new entries.
How can I add more entries. Is there an add methode or any other methode witch I can use.
mfG Pueromane
-
December 20th, 1999, 10:12 AM
#2
Re: Pull down Menu
If you define menu as an array (in menu editor change Index field to something other than zero) you can add/remove additional menu items with Load/Unload
Jean Spector
Tech Support Team Leader, CET
[email protected]
(in VB from 11/1999)
-
December 20th, 1999, 01:18 PM
#3
Re: Pull down Menu
I have an array but how can I use the Load/Unload functions. Can you give me an example.
mfG Puermane
-
December 20th, 1999, 04:54 PM
#4
Re: Pull down Menu
Here's a quick example - take a new project and to Form1, add a menu (mnuFile), then add a menu item below it called mnuItem with an index of 0.
Dim lCount as Long
for lCount = 1 to 10
Load mnuItem(lCount)
mnuItem(lCount).Caption = "Menu item " & lCount
mnuItem(lCount).Visible = true
next
You can now check which menu item was clicked in the mnuItem_Click event :
private Sub mnuItem_Click(Index as Integer)
MsgBox "Menu " & mnuItem(Index).Caption & " clicked"
End Sub
- of course, you might want to place something in the 'tag' property of each menu item to identify them a little better.
The 'Unload' function simply removes the items at runtime :
Dim lCount as Long
for lCount = 10 to 1 step -1
Unload mnuItem(lCount)
next
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
December 21st, 1999, 05:37 AM
#5
Re: Pull down Menu
thanks Chris.
It works great. That's the thing I was searching for.
mfG Pueromane
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|