473,722 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Menu Item Access Keys Programmaticall y...

Hello. My app uses user-based menu generation where all of the menu items are loaded from a SQLServer 2k database when the user logs in to the app. All is well except I cannot get an Access Key to load programmaticall y. That is, one of my entries in the database is &File, so when the menu item loads it should display in the Main Menu with the "F" underlined, but it doesn't. If I edit the Main Menu via it's interface, it works... but that goes against the data driven model. Any advice would be appreciated

Regards

Kevin
Nov 20 '05 #1
4 2914
* "=?Utf-8?B?S2V2aW4=?=" <an*******@disc ussions.microso ft.com> scripsit:
Hello. My app uses user-based menu generation where all of the menu
items are loaded from a SQLServer 2k database when the user logs in to
the app. All is well except I cannot get an Access Key to load
programmaticall y. That is, one of my entries in the database is &File,
so when the menu item loads it should display in the Main Menu with the
"F" underlined, but it doesn't. If I edit the Main Menu via it's
interface, it works... but that goes against the data driven model. Any
advice would be appreciated.


Should work. Do the menmonics show up after pressing the Alt key?

<http://groups.google.d e/groups?selm=eV0 TwGBCDHA.2376%4 0TK2MSFTNGP10.p hx.gbl>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Yes they do, "Alt+F" will open the File Menu, but from reading MSDN, that is
the default behavior. That is, if there are no mnemonics assigned, then you
get "default" mnemonics assigned in top-down, left-to-right order. I'm
trying to explicitly assign a mnemonic that has the visual cue, but I cannot
get the "F" in File to be underlined.

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:OI******** ********@TK2MSF TNGP09.phx.gbl. ..
* "=?Utf-8?B?S2V2aW4=?=" <an*******@disc ussions.microso ft.com> scripsit:
Hello. My app uses user-based menu generation where all of the menu
items are loaded from a SQLServer 2k database when the user logs in to
the app. All is well except I cannot get an Access Key to load
programmaticall y. That is, one of my entries in the database is &File,
so when the menu item loads it should display in the Main Menu with the
"F" underlined, but it doesn't. If I edit the Main Menu via it's
interface, it works... but that goes against the data driven model. Any
advice would be appreciated.
Should work. Do the menmonics show up after pressing the Alt key?

<http://groups.google.de/groups?selm=...TNGP10.phx.gbl

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
* "Kevin" <kr*****@nospam .com> scripsit:
Yes they do, "Alt+F" will open the File Menu, but from reading MSDN, that is
the default behavior. That is, if there are no mnemonics assigned, then you
get "default" mnemonics assigned in top-down, left-to-right order. I'm
trying to explicitly assign a mnemonic that has the visual cue, but I cannot
get the "F" in File to be underlined.


"Post your code!"

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Herfried,

After the user has been authenticated, EnableMenus runs. It calls a
recursive method

Private Sub EnableMenus(ByV al authenticated As Boolean)
menuMain.MenuIt ems.Clear()

If authenticated Then
'menuList is a list object based on Rockford Lahotka's CSLA.NET
(www.lhotka.net)
'it returns a list based on a table... this is the basis for my menu
list...
'Table is as follows:
'Col1: ID (int, pk)
'Col2: Text (varchar) Text of menu item
'Col3: ParentID (int) - self referential field... if = 0 then
top-level menu item (File, Edit, View, etc)
' if not = 0 then it is a "child" item of ID (so you can have
File|Open, etc)

'For simplicity, just think of menulist as a datatable and
liamMenuItem as a dataRow...
Dim menuList As LiamMenuItemLis t =
LiamMenuItemLis t.GetLiamMenuIt emList()
Dim liamMenuItem As New LiamMenuItemLis t.LiamMenuItem

For Each liamMenuItem In menuList
Dim mi As MenuItem
mi = New MenuItem
If liamMenuItem.Pa rentId = 0 Then
'IF IAMMENUITEM.TEX T = &File THEN MI.TEXT SHOULD SHOW
THE VISUAL MNEMONIC
'THIS IS WHERE I AM STUCK

mi.Text = liamMenuItem.Te xt()

If mi.Text = "Window" Then
mi.MdiList = True
End If

If mi.Text = "Open Windows List" Then
mi.Checked = True
End If

'Load Child Menus allows n-level sub menus... called
recursively
LoadChildMenus( menuList, liamMenuItem.id , mi)

menuMain.MenuIt ems.Add(mi)
End If
Next

Else
'If not authenticated, just show the ability to attempt to login
again... not shown here for clarity and brevity
End If
End Sub

Private Sub LoadChildMenus( ByVal list As LiamMenuItemLis t, ByVal parentId As
Integer, _
ByVal owner As MenuItem)
Dim liamMenuItem As LiamMenuItemLis t.LiamMenuItem
For Each liamMenuItem In list
Dim mi As New MenuItem

If liamMenuItem.Pa rentId = parentId Then
mi.Text = liamMenuItem.Te xt
LoadChildMenus( list, liamMenuItem.id , mi)
AddHandler mi.Click, New System.EventHan dler(AddressOf
menuMain_Click)
owner.MenuItems .Add(mi)
End If
Next
End Sub
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uo******** ******@TK2MSFTN GP10.phx.gbl...
* "Kevin" <kr*****@nospam .com> scripsit:
Yes they do, "Alt+F" will open the File Menu, but from reading MSDN, that is the default behavior. That is, if there are no mnemonics assigned, then you get "default" mnemonics assigned in top-down, left-to-right order. I'm
trying to explicitly assign a mnemonic that has the visual cue, but I cannot get the "F" in File to be underlined.


"Post your code!"

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5

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

Similar topics

0
1440
by: john | last post by:
I would like to programmatically (from VB.NET or C#), manage items in the windows explorer 'folder' context menu (right click menu). I need an entry to be able to pass the folder path to my application. If I can configure this using the .NET framework then that would be ideal, using Win32 a close second. Modifying the registry would be ok but not sure how safe this would be on future versions of windows. Any help much appreciated.
0
1387
by: Claire | last post by:
When I run the following code through on the first round, my sub-menu (branched off mnuOpenPorts menuitem) shows a nice list of ports. When it gets run through on the 2nd pass, the sub menu indicates that it should be there but there's no items appearing in it. (ie a small indicator arrow is there showing there should be a sub menu but nothing pops up) When I step through the code, I have 5 items in Comports. After adding all the sub menu...
1
3317
by: Mike | last post by:
I am trying to programmatically change the text of a menu item in a submenu of context menu. The menu item starts off as "Play" and I later execute this.menuItem1.Text = "Stop"; I can confirm with the debugger that the field value changes as expected yet this is not actually reflected in the menu itself. Any ideas? Mike
7
2247
by: brian | last post by:
I am looking at purchasing or creating a dynamic navigational menu system that would be binded to SQL server 2000 data. The users id is stored in the SQL server and based on the id is what the navigational menu would show. I would perfer to gain the experieance of building it myself but theres not much documentation out there on that subject. If anyone has any please guide me to it.
10
21320
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles mnuTopics_Show.Select Dim mShowMenuItem As MenuItem mShowMenuItem = DirectCast(sender, MenuItem)
2
1268
by: Peter Proost | last post by:
Hi group, I've got this ownerdraw menu module which I got from a site and modified to my personal needs, but the only problem I'm having is with the lines in a menu, when you type - as text, it normaly becomes a full line and the height of the menuitem is reduced but when you set a menu to ownerdraw and use my draw and measure item handlers this doesn't work anymore, has anyone worked out a good sloution for this before? Greetz Peter
8
2109
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 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
6
1482
by: JJ | last post by:
Question: Which controls to use as menus: ============================= I must be approaching this the wrong way, as it clearly must be possible. I am writing a very basic CMS. At the top of the page will be a menu 'main categories' and at the side will be a menu 'sub categories'. The page being viewed is calculated from the querystring. A bit of code then gets the relevent main category and subcategory for that pageID.
8
2083
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I created a user control that handles certain keystrokes, e.g. Ctrl-C for cut, Ctrl-V for paste, plus other more specialized keystrokes. I want to list these in the menubar like any other menu items. Once I assign a Shortcut Key to the menu item, that menu sees the event before the control, as one would expect. The question is, then, inside the menu item handler what code do I need to pass on the keystroke to a control? This is slightly...
0
9386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9158
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6685
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5996
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3208
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2606
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2148
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.