473,378 Members | 1,400 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,378 software developers and data experts.

tootip or microhelp for menu items

gs
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 I do that?
For example in outlook express, when one expand a main menu item and holds
mouse over one of the enable sub menu item, one would see some sort
microhelp text in the status bar in the bottom
Nov 1 '06 #1
8 2077
gs
I sort of find a way to make the tag value appear in a status bar but it is
far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance call and
use the tag. but with the shallow knowledge that I have vb, I don't have a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
>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 I do that?
For example in outlook express, when one expand a main menu item and holds
mouse over one of the enable sub menu item, one would see some sort
microhelp text in the status bar in the bottom

Nov 1 '06 #2

"gs" <gs@dontMail.teluswrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl...
>I sort of find a way to make the tag value appear in a status bar but it is
far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance call and
use the tag. but with the shallow knowledge that I have vb, I don't have a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
>>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 I do that?
For example in outlook express, when one expand a main menu item and
holds mouse over one of the enable sub menu item, one would see some sort
microhelp text in the status bar in the bottom
I'm not exactly sure if these are the same requests. Here is how to display
status text when someone hovers over the items in a menu strip or toolstrip.
This handles one level of dropdowns; if you have more, you need to use
recursion. Also, this only adds the events when the [tag] property is not
blank, and it displays the tag in the status strip.

You could enable tooltips on the menu items if you want tool tips. That's an
entirely different thing from displaying info in the status strip.

To do this, you need to add handlers for each item for the MouseEnter event
(to set the text) and the MouseLeave event (to blank it back out).

I am calling AddToolStripEventHandlers and AddMenuStripEventHandlers in my
Form_Load event. You could combine these.

Private Sub AddToolStripEventHandlers(ByVal tsToolStrip As ToolStrip)
For Each item As ToolStripItem In tsToolStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf MenuItem_MouseLeave
End If
Next
End Sub
Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As MenuStrip)
For Each item As ToolStripMenuItem In msMenuStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf MenuItem_MouseLeave
End If
'if you have dropdown menus inside your dropdown menus,
' you would probably want to make a recursive routine to handle
that
If item.DropDownItems.Count 0 Then
For i As Integer = 0 To item.DropDownItems.Count - 1
Dim ddItem As ToolStripItem
ddItem = item.DropDownItems(i)
If ddItem.Tag IsNot Nothing Then
AddHandler ddItem.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler ddItem.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End If
Next
End Sub

Private Sub MenuItem_MouseEnter(ByVal sender As Object, ByVal e As
EventArgs)
If TypeOf sender Is ToolStripButton Then
Dim ctrl As ToolStripButton = DirectCast(sender,
ToolStripButton)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
ElseIf TypeOf sender Is ToolStripMenuItem Then
Dim ctrl As ToolStripMenuItem = DirectCast(sender,
ToolStripMenuItem)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
End If
End Sub

Private Sub MenuItem_MouseLeave(ByVal sender As Object, ByVal e As
EventArgs)
Me.ToolStripStatusLabel.Text = String.Empty
End Sub

Robin
Nov 2 '06 #3
GS
thank you.

I tired to deal with next level but failed as toolStripItem does not have
dropdownItems, neither does menuStripItems.

I tried ctype but did not get to work either. all I need now is one more
level for ToolStripMenuItems.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:g6******************************@comcast.com. ..
>
"gs" <gs@dontMail.teluswrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl...
I sort of find a way to make the tag value appear in a status bar but it
is
far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance call
and
use the tag. but with the shallow knowledge that I have vb, I don't have
a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
>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 I do that?
For example in outlook express, when one expand a main menu item and
holds mouse over one of the enable sub menu item, one would see some
sort
microhelp text in the status bar in the bottom

I'm not exactly sure if these are the same requests. Here is how to
display
status text when someone hovers over the items in a menu strip or
toolstrip.
This handles one level of dropdowns; if you have more, you need to use
recursion. Also, this only adds the events when the [tag] property is not
blank, and it displays the tag in the status strip.

You could enable tooltips on the menu items if you want tool tips. That's
an
entirely different thing from displaying info in the status strip.

To do this, you need to add handlers for each item for the MouseEnter
event
(to set the text) and the MouseLeave event (to blank it back out).

I am calling AddToolStripEventHandlers and AddMenuStripEventHandlers in my
Form_Load event. You could combine these.

Private Sub AddToolStripEventHandlers(ByVal tsToolStrip As ToolStrip)
For Each item As ToolStripItem In tsToolStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf MenuItem_MouseLeave
End If
Next
End Sub
Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As MenuStrip)
For Each item As ToolStripMenuItem In msMenuStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf MenuItem_MouseLeave
End If
'if you have dropdown menus inside your dropdown menus,
' you would probably want to make a recursive routine to
handle
that
If item.DropDownItems.Count 0 Then
For i As Integer = 0 To item.DropDownItems.Count - 1
Dim ddItem As ToolStripItem
ddItem = item.DropDownItems(i)
If ddItem.Tag IsNot Nothing Then
AddHandler ddItem.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler ddItem.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End If
Next
End Sub

Private Sub MenuItem_MouseEnter(ByVal sender As Object, ByVal e As
EventArgs)
If TypeOf sender Is ToolStripButton Then
Dim ctrl As ToolStripButton = DirectCast(sender,
ToolStripButton)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
ElseIf TypeOf sender Is ToolStripMenuItem Then
Dim ctrl As ToolStripMenuItem = DirectCast(sender,
ToolStripMenuItem)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
End If
End Sub

Private Sub MenuItem_MouseLeave(ByVal sender As Object, ByVal e As
EventArgs)
Me.ToolStripStatusLabel.Text = String.Empty
End Sub

Robin


Nov 5 '06 #4
You're right; I tried to figure out how to do it, but it's not
inherently obvious. I've searched all over, and can't find
anything that tells how to enumerate through all the items
in all the levels of a MenuStrip.

Why don't you use tooltips instead? If you enable the property
"Show Item Tooltips" for the Menu Strip, and then fill in the
tool tips for each option, they will be displayed when you hover
over the menu option.

The only other thing I can think of is to add the options to
the menustrip programmatically, and as you do that, add the
events.

Good Luck.
Robin S.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
thank you.

I tired to deal with next level but failed as toolStripItem does not have
dropdownItems, neither does menuStripItems.

I tried ctype but did not get to work either. all I need now is one more
level for ToolStripMenuItems.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:g6******************************@comcast.com. ..
>>
"gs" <gs@dontMail.teluswrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl...
>I sort of find a way to make the tag value appear in a status bar but it
is
>far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance call
and
use the tag. but with the shallow knowledge that I have vb, I don't
have
a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
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 I do that?
For example in outlook express, when one expand a main menu item and
holds mouse over one of the enable sub menu item, one would see some
sort
>microhelp text in the status bar in the bottom


I'm not exactly sure if these are the same requests. Here is how to
display
>status text when someone hovers over the items in a menu strip or
toolstrip.
>This handles one level of dropdowns; if you have more, you need to use
recursion. Also, this only adds the events when the [tag] property is not
blank, and it displays the tag in the status strip.

You could enable tooltips on the menu items if you want tool tips. That's
an
>entirely different thing from displaying info in the status strip.

To do this, you need to add handlers for each item for the MouseEnter
event
>(to set the text) and the MouseLeave event (to blank it back out).

I am calling AddToolStripEventHandlers and AddMenuStripEventHandlers in
my
Form_Load event. You could combine these.

Private Sub AddToolStripEventHandlers(ByVal tsToolStrip As ToolStrip)
For Each item As ToolStripItem In tsToolStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf MenuItem_MouseLeave
End If
Next
End Sub
Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As MenuStrip)
For Each item As ToolStripMenuItem In msMenuStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf MenuItem_MouseLeave
End If
'if you have dropdown menus inside your dropdown menus,
' you would probably want to make a recursive routine to
handle
>that
If item.DropDownItems.Count 0 Then
For i As Integer = 0 To item.DropDownItems.Count - 1
Dim ddItem As ToolStripItem
ddItem = item.DropDownItems(i)
If ddItem.Tag IsNot Nothing Then
AddHandler ddItem.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler ddItem.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End If
Next
End Sub

Private Sub MenuItem_MouseEnter(ByVal sender As Object, ByVal e As
EventArgs)
If TypeOf sender Is ToolStripButton Then
Dim ctrl As ToolStripButton = DirectCast(sender,
ToolStripButton)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
ElseIf TypeOf sender Is ToolStripMenuItem Then
Dim ctrl As ToolStripMenuItem = DirectCast(sender,
ToolStripMenuItem)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
End If
End Sub

Private Sub MenuItem_MouseLeave(ByVal sender As Object, ByVal e As
EventArgs)
Me.ToolStripStatusLabel.Text = String.Empty
End Sub

Robin



Nov 5 '06 #5
GS
Thank you. Now that I have fully converted to menuStrip with
ToolStripMenuItems and that I was finally find the tooltips, I am using
tooltips.

For now the tooltips is good

Nonetheless I would love to find out how to iterate through all the items.
whyeventually I would want the menu text be from resource file for
multi-language interface.


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:1d******************************@comcast.com. ..
You're right; I tried to figure out how to do it, but it's not
inherently obvious. I've searched all over, and can't find
anything that tells how to enumerate through all the items
in all the levels of a MenuStrip.

Why don't you use tooltips instead? If you enable the property
"Show Item Tooltips" for the Menu Strip, and then fill in the
tool tips for each option, they will be displayed when you hover
over the menu option.

The only other thing I can think of is to add the options to
the menustrip programmatically, and as you do that, add the
events.

Good Luck.
Robin S.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
thank you.

I tired to deal with next level but failed as toolStripItem does not
have
dropdownItems, neither does menuStripItems.

I tried ctype but did not get to work either. all I need now is one
more
level for ToolStripMenuItems.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:g6******************************@comcast.com. ..
>
"gs" <gs@dontMail.teluswrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl...
I sort of find a way to make the tag value appear in a status bar but
it
is
far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance
call
and
use the tag. but with the shallow knowledge that I have vb, I don't
have
a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
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 I do that?
For example in outlook express, when one expand a main menu item and
holds mouse over one of the enable sub menu item, one would see some
sort
microhelp text in the status bar in the bottom



I'm not exactly sure if these are the same requests. Here is how to
display
status text when someone hovers over the items in a menu strip or
toolstrip.
This handles one level of dropdowns; if you have more, you need to use
recursion. Also, this only adds the events when the [tag] property is
not
blank, and it displays the tag in the status strip.

You could enable tooltips on the menu items if you want tool tips.
That's
an
entirely different thing from displaying info in the status strip.

To do this, you need to add handlers for each item for the MouseEnter
event
(to set the text) and the MouseLeave event (to blank it back out).

I am calling AddToolStripEventHandlers and AddMenuStripEventHandlers in
my
Form_Load event. You could combine these.

Private Sub AddToolStripEventHandlers(ByVal tsToolStrip As
ToolStrip)
For Each item As ToolStripItem In tsToolStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End Sub
Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As
MenuStrip)
For Each item As ToolStripMenuItem In msMenuStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
'if you have dropdown menus inside your dropdown menus,
' you would probably want to make a recursive routine to
handle
that
If item.DropDownItems.Count 0 Then
For i As Integer = 0 To item.DropDownItems.Count - 1
Dim ddItem As ToolStripItem
ddItem = item.DropDownItems(i)
If ddItem.Tag IsNot Nothing Then
AddHandler ddItem.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler ddItem.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End If
Next
End Sub

Private Sub MenuItem_MouseEnter(ByVal sender As Object, ByVal e As
EventArgs)
If TypeOf sender Is ToolStripButton Then
Dim ctrl As ToolStripButton = DirectCast(sender,
ToolStripButton)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
ElseIf TypeOf sender Is ToolStripMenuItem Then
Dim ctrl As ToolStripMenuItem = DirectCast(sender,
ToolStripMenuItem)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
End If
End Sub

Private Sub MenuItem_MouseLeave(ByVal sender As Object, ByVal e As
EventArgs)
Me.ToolStripStatusLabel.Text = String.Empty
End Sub

Robin



Nov 7 '06 #6
I'm glad that worked for you, the tooltips I mean. I would
also like to know how to iterate all the down, and if I ever
figure it out, I'll post it here just for grins.

I thought I saw something in a MSFT article that said
something about using ReadNext to go through them, but
couldn't find it again, so maybe I dreamed it.

Like I said before, the only other thing I could think of
is if you could build the menu from scratch and add the
eventhandlers as you go. What a pain.

You could certainly read the menu info from a file and
create the menu from scratch, complete with the tooltips,
in different languages. Seems like that would be the
kind of thing you'd want to look into that CultureInfo
class for.

Good luck.
Robin S.

"GS" <gs**********************@msnews.Nomail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Thank you. Now that I have fully converted to menuStrip with
ToolStripMenuItems and that I was finally find the tooltips, I am using
tooltips.

For now the tooltips is good

Nonetheless I would love to find out how to iterate through all the items.
whyeventually I would want the menu text be from resource file for
multi-language interface.


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:1d******************************@comcast.com. ..
>You're right; I tried to figure out how to do it, but it's not
inherently obvious. I've searched all over, and can't find
anything that tells how to enumerate through all the items
in all the levels of a MenuStrip.

Why don't you use tooltips instead? If you enable the property
"Show Item Tooltips" for the Menu Strip, and then fill in the
tool tips for each option, they will be displayed when you hover
over the menu option.

The only other thing I can think of is to add the options to
the menustrip programmatically, and as you do that, add the
events.

Good Luck.
Robin S.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
thank you.

I tired to deal with next level but failed as toolStripItem does not
have
dropdownItems, neither does menuStripItems.

I tried ctype but did not get to work either. all I need now is one
more
level for ToolStripMenuItems.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:g6******************************@comcast.com. ..

"gs" <gs@dontMail.teluswrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl...
I sort of find a way to make the tag value appear in a status bar but
it
is
far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance
call
and
use the tag. but with the shallow knowledge that I have vb, I don't
have
a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
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 I do that?
For example in outlook express, when one expand a main menu item
and
holds mouse over one of the enable sub menu item, one would see
some
sort
microhelp text in the status bar in the bottom

I'm not exactly sure if these are the same requests. Here is how to
display
status text when someone hovers over the items in a menu strip or
toolstrip.
This handles one level of dropdowns; if you have more, you need to use
recursion. Also, this only adds the events when the [tag] property is
not
>blank, and it displays the tag in the status strip.

You could enable tooltips on the menu items if you want tool tips.
That's
an
entirely different thing from displaying info in the status strip.

To do this, you need to add handlers for each item for the MouseEnter
event
(to set the text) and the MouseLeave event (to blank it back out).

I am calling AddToolStripEventHandlers and AddMenuStripEventHandlers
in
my
Form_Load event. You could combine these.

Private Sub AddToolStripEventHandlers(ByVal tsToolStrip As
ToolStrip)
> For Each item As ToolStripItem In tsToolStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
> AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
> End If
Next
End Sub
Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As
MenuStrip)
> For Each item As ToolStripMenuItem In msMenuStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
> AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
> End If
'if you have dropdown menus inside your dropdown menus,
' you would probably want to make a recursive routine to
handle
that
If item.DropDownItems.Count 0 Then
For i As Integer = 0 To item.DropDownItems.Count - 1
Dim ddItem As ToolStripItem
ddItem = item.DropDownItems(i)
If ddItem.Tag IsNot Nothing Then
AddHandler ddItem.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler ddItem.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End If
Next
End Sub

Private Sub MenuItem_MouseEnter(ByVal sender As Object, ByVal e As
EventArgs)
If TypeOf sender Is ToolStripButton Then
Dim ctrl As ToolStripButton = DirectCast(sender,
ToolStripButton)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
ElseIf TypeOf sender Is ToolStripMenuItem Then
Dim ctrl As ToolStripMenuItem = DirectCast(sender,
ToolStripMenuItem)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
End If
End Sub

Private Sub MenuItem_MouseLeave(ByVal sender As Object, ByVal e As
EventArgs)
Me.ToolStripStatusLabel.Text = String.Empty
End Sub

Robin




Nov 7 '06 #7
I got this is from PamelaFluente, and wanted to
post it as a response here in case you don't see
the other posting. The answer to your question
is below.
Thanks again to Pamela.
Robin S
-----------------------------------

Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As MenuStrip)
RecurseItems(Me.MenuStrip.Items)
End Sub

Sub RecurseItems(ByVal ToolStripItemCollection As ToolStripItemCollection)
Try
For Each ToolStripMenuItemChild As ToolStripMenuItem _
In ToolStripItemCollection
'Debug.Print("I am on " & ToolStripMenuItemChild.Text)
If ToolStripMenuItemChild.Tag IsNot Nothing Then
AddHandler ToolStripMenuItemChild.MouseEnter, _
AddressOf MenuItem_MouseEnter
AddHandler ToolStripMenuItemChild.MouseLeave, _
AddressOf MenuItem_MouseLeave
End If
RecurseItems(ToolStripMenuItemChild.DropDownItems)
Next ToolStripMenuItemChild
Catch ex As InvalidCastException
'ignore it; you'll get this for the separator lines
End Try
End Sub

---------------------------------

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:T9******************************@comcast.com. ..
I'm glad that worked for you, the tooltips I mean. I would
also like to know how to iterate all the down, and if I ever
figure it out, I'll post it here just for grins.

I thought I saw something in a MSFT article that said
something about using ReadNext to go through them, but
couldn't find it again, so maybe I dreamed it.

Like I said before, the only other thing I could think of
is if you could build the menu from scratch and add the
eventhandlers as you go. What a pain.

You could certainly read the menu info from a file and
create the menu from scratch, complete with the tooltips,
in different languages. Seems like that would be the
kind of thing you'd want to look into that CultureInfo
class for.

Good luck.
Robin S.

"GS" <gs**********************@msnews.Nomail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>Thank you. Now that I have fully converted to menuStrip with
ToolStripMenuItems and that I was finally find the tooltips, I am using
tooltips.

For now the tooltips is good

Nonetheless I would love to find out how to iterate through all the
items.
whyeventually I would want the menu text be from resource file for
multi-language interface.


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:1d******************************@comcast.com ...
>>You're right; I tried to figure out how to do it, but it's not
inherently obvious. I've searched all over, and can't find
anything that tells how to enumerate through all the items
in all the levels of a MenuStrip.

Why don't you use tooltips instead? If you enable the property
"Show Item Tooltips" for the Menu Strip, and then fill in the
tool tips for each option, they will be displayed when you hover
over the menu option.

The only other thing I can think of is to add the options to
the menustrip programmatically, and as you do that, add the
events.

Good Luck.
Robin S.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
thank you.

I tired to deal with next level but failed as toolStripItem does not
have
>dropdownItems, neither does menuStripItems.

I tried ctype but did not get to work either. all I need now is one
more
>level for ToolStripMenuItems.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:g6******************************@comcast.com ...

"gs" <gs@dontMail.teluswrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl...
I sort of find a way to make the tag value appear in a status bar
but
it
>is
far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance
call
>and
use the tag. but with the shallow knowledge that I have vb, I don't
have
a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
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 I do that?
For example in outlook express, when one expand a main menu item
and
holds mouse over one of the enable sub menu item, one would see
some
sort
microhelp text in the status bar in the bottom

I'm not exactly sure if these are the same requests. Here is how to
display
status text when someone hovers over the items in a menu strip or
toolstrip.
This handles one level of dropdowns; if you have more, you need to
use
recursion. Also, this only adds the events when the [tag] property is
not
>>blank, and it displays the tag in the status strip.

You could enable tooltips on the menu items if you want tool tips.
That's
>an
entirely different thing from displaying info in the status strip.

To do this, you need to add handlers for each item for the MouseEnter
event
(to set the text) and the MouseLeave event (to blank it back out).

I am calling AddToolStripEventHandlers and AddMenuStripEventHandlers
in
my
Form_Load event. You could combine these.

Private Sub AddToolStripEventHandlers(ByVal tsToolStrip As
ToolStrip)
>> For Each item As ToolStripItem In tsToolStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
>> AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
>> End If
Next
End Sub
Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As
MenuStrip)
>> For Each item As ToolStripMenuItem In msMenuStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
>> AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
>> End If
'if you have dropdown menus inside your dropdown menus,
' you would probably want to make a recursive routine to
handle
that
If item.DropDownItems.Count 0 Then
For i As Integer = 0 To item.DropDownItems.Count - 1
Dim ddItem As ToolStripItem
ddItem = item.DropDownItems(i)
If ddItem.Tag IsNot Nothing Then
AddHandler ddItem.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler ddItem.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End If
Next
End Sub

Private Sub MenuItem_MouseEnter(ByVal sender As Object, ByVal e
As
EventArgs)
If TypeOf sender Is ToolStripButton Then
Dim ctrl As ToolStripButton = DirectCast(sender,
ToolStripButton)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
ElseIf TypeOf sender Is ToolStripMenuItem Then
Dim ctrl As ToolStripMenuItem = DirectCast(sender,
ToolStripMenuItem)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
End If
End Sub

Private Sub MenuItem_MouseLeave(ByVal sender As Object, ByVal e
As
EventArgs)
Me.ToolStripStatusLabel.Text = String.Empty
End Sub

Robin




Nov 8 '06 #8
GS
Great! Thank you very much
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:zI******************************@comcast.com. ..
I got this is from PamelaFluente, and wanted to
post it as a response here in case you don't see
the other posting. The answer to your question
is below.
Thanks again to Pamela.
Robin S
-----------------------------------

Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As MenuStrip)
RecurseItems(Me.MenuStrip.Items)
End Sub

Sub RecurseItems(ByVal ToolStripItemCollection As ToolStripItemCollection)
Try
For Each ToolStripMenuItemChild As ToolStripMenuItem _
In ToolStripItemCollection
'Debug.Print("I am on " & ToolStripMenuItemChild.Text)
If ToolStripMenuItemChild.Tag IsNot Nothing Then
AddHandler ToolStripMenuItemChild.MouseEnter, _
AddressOf MenuItem_MouseEnter
AddHandler ToolStripMenuItemChild.MouseLeave, _
AddressOf MenuItem_MouseLeave
End If
RecurseItems(ToolStripMenuItemChild.DropDownItems)
Next ToolStripMenuItemChild
Catch ex As InvalidCastException
'ignore it; you'll get this for the separator lines
End Try
End Sub

---------------------------------

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:T9******************************@comcast.com. ..
I'm glad that worked for you, the tooltips I mean. I would
also like to know how to iterate all the down, and if I ever
figure it out, I'll post it here just for grins.

I thought I saw something in a MSFT article that said
something about using ReadNext to go through them, but
couldn't find it again, so maybe I dreamed it.

Like I said before, the only other thing I could think of
is if you could build the menu from scratch and add the
eventhandlers as you go. What a pain.

You could certainly read the menu info from a file and
create the menu from scratch, complete with the tooltips,
in different languages. Seems like that would be the
kind of thing you'd want to look into that CultureInfo
class for.

Good luck.
Robin S.

"GS" <gs**********************@msnews.Nomail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Thank you. Now that I have fully converted to menuStrip with
ToolStripMenuItems and that I was finally find the tooltips, I am using
tooltips.

For now the tooltips is good

Nonetheless I would love to find out how to iterate through all the
items.
whyeventually I would want the menu text be from resource file for
multi-language interface.


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:1d******************************@comcast.com. ..
You're right; I tried to figure out how to do it, but it's not
inherently obvious. I've searched all over, and can't find
anything that tells how to enumerate through all the items
in all the levels of a MenuStrip.

Why don't you use tooltips instead? If you enable the property
"Show Item Tooltips" for the Menu Strip, and then fill in the
tool tips for each option, they will be displayed when you hover
over the menu option.

The only other thing I can think of is to add the options to
the menustrip programmatically, and as you do that, add the
events.

Good Luck.
Robin S.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
thank you.

I tired to deal with next level but failed as toolStripItem does not
have
dropdownItems, neither does menuStripItems.

I tried ctype but did not get to work either. all I need now is
one
more
level for ToolStripMenuItems.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:g6******************************@comcast.com. ..

"gs" <gs@dontMail.teluswrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl...
I sort of find a way to make the tag value appear in a status bar
but
it
is
far cry form automatic use of tag.
For each submenu time I have an event handler for select..

will be nice to add select event for submenu item in the instance
call
and
use the tag. but with the shallow knowledge that I have vb, I
don't
have
a
clue yet.
any concrete suggestion?
"gs" <gs@dontMail.teluswrote in message
news:uL****************@TK2MSFTNGP03.phx.gbl...
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 I do that?
For example in outlook express, when one expand a main menu item
and
holds mouse over one of the enable sub menu item, one would see
some
sort
microhelp text in the status bar in the bottom

I'm not exactly sure if these are the same requests. Here is how to
display
status text when someone hovers over the items in a menu strip or
toolstrip.
This handles one level of dropdowns; if you have more, you need to
use
recursion. Also, this only adds the events when the [tag] property
is
not
blank, and it displays the tag in the status strip.

You could enable tooltips on the menu items if you want tool tips.
That's
an
entirely different thing from displaying info in the status strip.

To do this, you need to add handlers for each item for the
MouseEnter
event
(to set the text) and the MouseLeave event (to blank it back out).

I am calling AddToolStripEventHandlers and
AddMenuStripEventHandlers
>in
my
Form_Load event. You could combine these.

Private Sub AddToolStripEventHandlers(ByVal tsToolStrip As
ToolStrip)
For Each item As ToolStripItem In tsToolStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End Sub
Private Sub AddMenuStripEventHandlers(ByVal msMenuStrip As
MenuStrip)
For Each item As ToolStripMenuItem In msMenuStrip.Items
If item.Tag IsNot Nothing Then
AddHandler item.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler item.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
'if you have dropdown menus inside your dropdown menus,
' you would probably want to make a recursive routine
to
handle
that
If item.DropDownItems.Count 0 Then
For i As Integer = 0 To item.DropDownItems.Count -
1
> Dim ddItem As ToolStripItem
ddItem = item.DropDownItems(i)
If ddItem.Tag IsNot Nothing Then
AddHandler ddItem.MouseEnter, AddressOf
MenuItem_MouseEnter
AddHandler ddItem.MouseLeave, AddressOf
MenuItem_MouseLeave
End If
Next
End If
Next
End Sub

Private Sub MenuItem_MouseEnter(ByVal sender As Object, ByVal e
As
EventArgs)
If TypeOf sender Is ToolStripButton Then
Dim ctrl As ToolStripButton = DirectCast(sender,
ToolStripButton)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
ElseIf TypeOf sender Is ToolStripMenuItem Then
Dim ctrl As ToolStripMenuItem = DirectCast(sender,
ToolStripMenuItem)
Me.ToolStripStatusLabel.Text = ctrl.Tag.ToString
End If
End Sub

Private Sub MenuItem_MouseLeave(ByVal sender As Object, ByVal e
As
EventArgs)
Me.ToolStripStatusLabel.Text = String.Empty
End Sub

Robin





Nov 9 '06 #9

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

Similar topics

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...
8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
6
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect...
1
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
2
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more...
1
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Hi, friends, I am using C#.net 2005 to create a windows application. It has menu items, such as File, etc. Under File, there are more menu items, such as New Files, Working Files, etc. Under...
6
by: GS | last post by:
how can I set tooTip on ToolTip1 for a listbox?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.