|
-
Dec 19th, 2001, 09:32 AM
#1
Thread Starter
Banned
adding to menu during runtime
how can i make my program add something to a menu bar during runtime?
-
Dec 19th, 2001, 09:40 AM
#2
Thread Starter
Banned
-
Dec 19th, 2001, 09:42 AM
#3
Frenzied Member
You'll need to use API calls. VB creates your menu using those calls.
-
Dec 19th, 2001, 09:43 AM
#4
Thread Starter
Banned
-
Dec 19th, 2001, 09:44 AM
#5
Lively Member
You don't need to use API calls to dynamically create menu items (or delete them) if you can wait a few hours when I get back from work I will post the code here
Everytime
"I'm not normally a religious man, but if you're up there, save me, Superman!" Homer Simpson
Visit my site
-
Dec 19th, 2001, 09:47 AM
#6
Thread Starter
Banned
if you could just give me an
idea now, i only have like an hour left
-
Dec 19th, 2001, 09:47 AM
#7
Frenzied Member
-
Dec 19th, 2001, 09:53 AM
#8
Lively Member
This is the idea. The specifics might not be right. I am tryiong to check.....
Adding Menu Controls at Run Time
A menu can grow at run time. eg menu items are dynamically created to display the path names of the most recently opened files.
Use the menu editor to create a menu entry that has an index so is part of an array
You must use a control array to create a control at run time. Because the mnuRecentFile menu control is assigned a value for the Index property at design time, it automatically becomes an element of a control array — even though no other elements have yet been created.
add an extra menu by load(mnurecentfile)
delete it by unload(mnurecentfile)
you can set the mnurecentfile.caption and other properties
Everytime
"I'm not normally a religious man, but if you're up there, save me, Superman!" Homer Simpson
Visit my site
-
Dec 19th, 2001, 04:03 PM
#9
Lively Member
Sorry about the delay...
mnuItem is the menu item name created with the menu editor
In the code i refers to a particular menu item
Code:
'To create a menu item
Load mnuItem (i)
With mnuItem (i)
.Caption = "open file a"
.Visible = True
End With
'unload a menu item to remove it
Unload mnuItem (i)
Everytime
"I'm not normally a religious man, but if you're up there, save me, Superman!" Homer Simpson
Visit my site
-
Dec 20th, 2001, 09:29 AM
#10
Thread Starter
Banned
i keep getting a error
Here is my code i want to make an add to favorites for my webbrowser.
favoritename = InputBox("What Would you like to name your favorite?", "Add Favorite")
Load mnufavs(i)
With mnfavs(i)
.Caption = favoritename
.Visible = True
End With
'unload a menu item to remove it
Unload mnuitem(i)
-
Dec 21st, 2001, 05:22 AM
#11
Lively Member
what error do you get?
Things to check
1. Have you used the menu editor to create a menu entry that has an index value of 0. Set it to invisible so it cannot be seen yet
2. When you first want to add a menu item do
Code:
with menuitem(0)
.caption = "test"
.visible = true
end with
when a new entry is required...
Note that i is a number of a menutiem in the array
i should be one higher than the number of the last loaded menuitemn
Code:
load menuitm(i)
with menuitem(i)
.caption = "test entry number " & i
.visible = true
end with
Everytime
"I'm not normally a religious man, but if you're up there, save me, Superman!" Homer Simpson
Visit my site
-
Dec 21st, 2001, 09:35 AM
#12
Thread Starter
Banned
ok what that does is
changes the caption on one menu item, i want it to create a new menu item under mnufavs
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
|