473,396 Members | 2,061 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,396 software developers and data experts.

Set control to the first option in menu bar

274 100+
Hi All
I have a menu bar in vb6 project. I want to set default control to the first option.
If the menu bar has following (File Edit Purchase Report...) I want to set default control on first option of File. So that user may press Alt button to do that.
Can someone help?
Oct 22 '07 #1
11 1532
debasisdas
8,127 Expert 4TB
What do you mean by set default control on first option

What exactly you are trying to do ?

Please pas on few more details .
Oct 22 '07 #2
creative1
274 100+
Well I have a traditional menu with following options (Purchase, Reports, Maintenance.... ) with pullup menus. Like this

Purchase Reports
CashQ Account Statement
Account Balance Sheet

I want to do something like this: when I open software and hit an Enter Key from the keyboard, it start CashQ which is first option in menu.

If user don't want to do Cash-Q he can use arrow keys to scroll between menu options. How I can do this?
I hope now you understand this.
Oct 22 '07 #3
debasisdas
8,127 Expert 4TB
try to call the click event of the first item of the file menu in the keydown event of the form.
Oct 22 '07 #4
Killer42
8,435 Expert 8TB
try to call the click event of the first item of the file menu in the keydown event of the form.
Or perhaps you could use SendKeys to send Alt, then down arrow.
Oct 22 '07 #5
Killer42
8,435 Expert 8TB
try to call the click event of the first item of the file menu in the keydown event of the form.
I don't think that will do the trick. I think the OP just wants to highlight the option, not activate it.
Oct 22 '07 #6
creative1
274 100+
I just want to highlight the first option (or you can say I need to send ALT only)
In fact old system was DOS-based and my supervisor wants me to give it the same look and feel as old.
Please help me with code too... All that is happening on MDI form.
Thanks,
Farhana.
Oct 22 '07 #7
Killer42
8,435 Expert 8TB
I just want to highlight the first option ...
Have you tried any of our suggestions?
Oct 22 '07 #8
creative1
274 100+
As I told you I want to this on an MDIForm so I can't work on KeyDown event. I used a picture box on it and then setcontrol to its KeyDown event. I achieved one of the thing by hitting Enter Key on keydown event of picturebox. Now I want to pass ALT if anykey other than Enter is pressed.
I am trying this.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
  2. If KeyAscii = 13 Then
  3.   Call mnuPurchasefrmQuickCash_Click
  4. ElseIf KeyCode = vbKeyP Then
  5.     If Shift And vbAltMask Then
  6.       MsgBox "Alt-S was pressed!"
  7.     End If
  8. End If
  9. End Sub
Oct 22 '07 #9
Killer42
8,435 Expert 8TB
In case you're interested, you can check for KeyCode = 18 to detect ALT pressed, though this is probably not what you want. Just use an Else to detect anything other than Enter.

Also, what's the problem with sending your ALT? Have you tried SendKeys?

By the way, the message you're displaying is misleading. It's activated by Alt-P and says Alt-S was pressed. :-)
Oct 23 '07 #10
creative1
274 100+
I have been using following code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
  2. If KeyCode = 13 Then
  3.     Call mnuPurchasefrmQuickCash_Click
  4. Else
  5.    SendKeys ("%{DOWN}")
  6. End If
  7. End Sub
It activates the menu but call in infinite. The control keeps on moving through the menu.......any idea?
If I use only sendkeys(% ) it does nothing simply no effect.
Oct 23 '07 #11
Killer42
8,435 Expert 8TB
Well since you're sending a key (effectively telling Windows that the user pressed it) then I suppose it activates the KeyDown event. Just set a flag and don't do anything until control comes back. Or do nothing if the time is too short since the event was last activated. Use your imagination.

Also, you don't want to send the Alt-Down combination. You want to send Alt first, then Down. It's not the same. Check the SendKeys documentation, I think there's a way to send Alt.
Oct 23 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Randi | last post by:
Hi all, I have this project to use the ADODB control to acces and manipulate the Access DB. I amd the mistake of first doing this project with just the data control. It worked fine with this...
1
by: Yves PEYSSON | last post by:
Ji, my problem is simple. I would like to set dynamically the pressed item of a menu of a form in javascript. First, how to get the value of the item that has been selected with the mouse. Then how...
2
by: Pete | last post by:
I have some funky form/event behavior. Access 97. Split frontend/backend, using Access security. I have the same behavior (or lack of behavior) for the pag_Click() event of two separate pages...
3
by: bardo | last post by:
I am running into the following problem would like to know if this a bug or me doing something wrong. Using C# with visual studios 2003. I make a form and add a mainMenu Control. Now I type in...
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...
5
WebDunce
by: WebDunce | last post by:
hey all, i'm building a custom control. it contains a treeview and a context menu. each tree node's context menu property is set to the control's context menu. it works good...except... if...
0
by: john_mcmahon | last post by:
I'm having issues populating a second drop down menu that's dependent upon a selection in the first menu. When I select an option from the first menu, the second menu remains disabled, i.e. unable...
1
by: veteranwebdesign | last post by:
Hello, I have a main form. I want forms to open in a subform control box. What is the code for the option group to open the subforms in the control box. I didn't create subforms, I created...
3
by: =?Utf-8?B?VG9tIFc=?= | last post by:
When I mouse over a Menu Control based navigation area the drop-down selection list appears instantaneously. Is there a way to make it less sensitive, so that it delays (even a fraction of a second...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
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
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,...
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.