473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to fine an menu item?

Hi

I have a contextmenu and i want to add to one of the items a submenu
item. I only have the name of item and want to know the index value.
How to do that?
Peter
Nov 20 '05 #1
5 1264
"Peter van der Veen" <pv***************@no.spam.ming.vanbrug.nl>
schrieb
I have a contextmenu and i want to add to one of the items a
submenu item. I only have the name of item
A MenuItem does not have a Name property. You mean the variable name? There
might be several variables with different names pointig to the same
MenuItem.
and want to know the index
value. How to do that?


The MenuItem has an Index property.
--
Armin

Nov 20 '05 #2
I know, but i need to find that index nummer.

an example

i've create a vew menu items

contextmenu1.items.add("Test1")
contextmenu1.items.add("Test2")
contextmenu1.items.add("Test3")

(in the prorgram the names are from a recordset)

so i've 3 menu items

now i want later in the code add an submenu to lets say test2.
I don't know the index and want to know it. than i can use it to add
the submenu

How do i find the indexnumber of the menuitem with the text "Test2"


On Thu, 23 Oct 2003 11:50:16 +0200, "Armin Zingler"
<az*******@freenet.de> wrote:
"Peter van der Veen" <pv***************@no.spam.ming.vanbrug.nl>
schrieb
I have a contextmenu and i want to add to one of the items a
submenu item. I only have the name of item


A MenuItem does not have a Name property. You mean the variable name? There
might be several variables with different names pointig to the same
MenuItem.
and want to know the index
value. How to do that?


The MenuItem has an Index property.


Nov 20 '05 #3
"Peter van der Veen" <pv***************@no.spam.ming.vanbrug.nl>
schrieb
I know, but i need to find that index nummer.

an example

i've create a vew menu items

contextmenu1.items.add("Test1")
contextmenu1.items.add("Test2")
contextmenu1.items.add("Test3")

(in the prorgram the names are from a recordset)

so i've 3 menu items

now i want later in the code add an submenu to lets say test2.
I don't know the index and want to know it. than i can use it to
add the submenu

How do i find the indexnumber of the menuitem with the text
"Test2"

dim Item as menuitem
item = contextmenu1.items.add("Test2")
'later:
item.menuitems.add ....
Why do you identify the item by the text? If the text changes, you mustn't
forget to change the code when finding the Item by it's text because the
string can not be evaluated by the compiler. Isn't there a logic that tells
you to which item the subitems have to be added? Something like "It is the
item that...". Currently the answer is "..that shows the text 'Test2'".
--
Armin
Nov 20 '05 #4
The menu and submenus are dynamilcaly genereted at runtime. These were
just examples.
The menus and submenus are stored in a database and users can change
them so i don't know the position of the menus (indexnumber)
On Thu, 23 Oct 2003 12:58:37 +0200, "Armin Zingler"
<az*******@freenet.de> wrote:
"Peter van der Veen" <pv***************@no.spam.ming.vanbrug.nl>
schrieb
I know, but i need to find that index nummer.

an example

i've create a vew menu items

contextmenu1.items.add("Test1")
contextmenu1.items.add("Test2")
contextmenu1.items.add("Test3")

(in the prorgram the names are from a recordset)

so i've 3 menu items

now i want later in the code add an submenu to lets say test2.
I don't know the index and want to know it. than i can use it to
add the submenu

How do i find the indexnumber of the menuitem with the text
"Test2"

dim Item as menuitem
item = contextmenu1.items.add("Test2")
'later:
item.menuitems.add ....
Why do you identify the item by the text? If the text changes, you mustn't
forget to change the code when finding the Item by it's text because the
string can not be evaluated by the compiler. Isn't there a logic that tells
you to which item the subitems have to be added? Something like "It is the
item that...". Currently the answer is "..that shows the text 'Test2'".


Nov 20 '05 #5
"Peter van der Veen" <pv***************@no.spam.ming.vanbrug.nl>
schrieb
The menu and submenus are dynamilcaly genereted at runtime. These
were just examples.
The menus and submenus are stored in a database and users can
change them so i don't know the position of the menus
(indexnumber)


So you probably have a primaryKey in your database identyfing the MenuItem?
You might add the menuitems to a hashtable using the PK as the key.

--
Armin

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Marek Mand | last post by:
How to create a functional *flexible* UL-menu list <div> <ul> <li><a href=""></li> <li><a href=""></li> <li><a href=""></li> </ul> </div> (working in IE, Mozilla1.6, Opera7 (or maybe even...
4
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
4
by: Bob Homes | last post by:
In VB6, I used a system, which I loved, whereby I assigned a "helpId" to each menu item; that way, you could rest the cursor on the item (without actually running it) and then press F1 to get...
8
by: gs | last post by:
I was able to set tooltips on objects other than main menu. I would like to get the effect of tooltip or microhelp in the bottom status bar when the mouse is hovering over a submenu item. How do...
1
by: Kayvine | last post by:
Hi guys, this is a question I have for an assignment, it is pretty long, but I am not asking for the code(well if someone wants to write I'll be really happy, lol), but I just want to know how to...
4
by: stuckagain | last post by:
Hi, I have a page with a scrollable DIV, and within that DIV, I have a few asp.net menu controls. The idea being, the user mouses over the small icons and is presented with a list of options. ...
13
by: Stever1975 | last post by:
I'm working on something similiar to a shopping cart item page. There is a table of items. Each item has an image, a textbox for the qty and an image for the add button. When the add image is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.