|
-
Aug 5th, 2000, 05:27 AM
#1
Thread Starter
Junior Member
Can anyone tell me how to get information about menu hierarchy of a vb form at run time. All i could do is get all the menu items by using for each control in form1.controls.. method but is there a way to find what a menu item has relation with other.
-
Aug 5th, 2000, 10:50 AM
#2
Please explain further, I do not quite understand
-
Aug 5th, 2000, 07:57 PM
#3
Thread Starter
Junior Member
OK, i simply created menu using vb menu editor. first item is &File(mnuFile) and other items are &New(mnuFileNew) and &Open(mnuFileOpen) that come under &File(mnuFile). How can know at run time which menus comes under &File(mnuFile). And how can I get the parent (mnuFile) of mnuFileNew. All I could do so far is scan all controls of the forms for type as Menu, but there is no other information.
-
Aug 6th, 2000, 08:57 AM
#4
Monday Morning Lunatic
I think there may be something in the API for this - I'll have a look.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 6th, 2000, 06:08 PM
#5
Fanatic Member
A manual way of doing it could be implemented by using the TAG property to mark each level, and if the first menu and submenus are 1 to 9 then the second menu and ITS submenus could be 10 to 19 and the third could be 20 to 29 etc etc
Code:
'So on file a file menu and edit menu - for example...
File
New File
Open File
Close File
Edit
Cut
Copy
Paste
'you could set the tag properties as..
File '1
New File '1/0
Open File '1/1
Close File '1/2
Edit '10
Cut '10/0
Copy '10/1
Paste '10/2
I've used a backslash to sepearate the parent menu from the child menu
Which means no backslash = Top level menu
1 backslash = level 1 submenu
2 backslash's = level 2 submenu
etc etc etc
All thats required is a little routine to read (and if you want - write) the TAG property.
Its may not be the best way but its logical and makes use of an already existing property, so therefore does not add (too much) to your exe's final size.
DocZaf
{;->
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
|