Hi
I am developing a testing program. I am building a menu.The menus caption is "File". It has a sub menu
called tests. Under tests I want to create sub menus
dynamically. The caption of the sub menus will be kept in
the database and i will retreive it at form load and
then build the sub menus of the test item. Does anyone know how to
do this?
thanking you in advance
PORRASTAR
create a submenu with it's index set to 0 and at run time load subsequent menus
If you have mnuFirstTest as first submenu and its index set to 0 then you can load other menus by
Originally posted by abhid create a submenu with it's index set to 0 and at run time load subsequent menus
If you have mnuFirstTest as first submenu and its index set to 0 then you can load other menus by
VB Code:
Load mnuFirstTest(1)
mnuFirstTest(1).Visible = True
As far as I can tell, you have to use API to create Sub Menus. VB lets you do a control array for the 1st levels, but another lower, you need to use... some kinda of API. It was answered a few days ago... but whether they got it working or not, is another question
It was asked several days ago but there was no controlarray on the form, therefore it needed api to load the menu.
Here you can load submenu's like abhid mentioned.
For the first menu set its caption to a seperator - and its visible property to false.
When you load (add) menuItems to it set its visible property to true.
When loading menu's (objects) at runtime you have to unload them when they are no longer needed (from unload)
Last edited by swatty; Oct 16th, 2002 at 05:08 AM.
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
There are literally loads of threads on this forum which will detail exactally what you want to do, using techneques from menu arrays, external menu controls and API...
Just do a search for "add menus at runtime", or something along those lines...
Here's a test project I have been working on. Nowhere near complete yet, but it may help you with your menus as it creates menus at runtime using API...
This example is actually supposed to be for adding items into the SysTray, but it has code in it to create menus...
If you right click on the World icon it adds to the systray you can see the menu that pops up...