473,698 Members | 2,029 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 2910
* "=?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
1433
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
1383
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
3316
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
2244
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
21313
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
1262
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
2108
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
1481
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
8672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8600
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
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...
0
9021
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8860
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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
5860
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();...
1
3038
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

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.