Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 10th, 2003, 09:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default accelerator keys and the tab control

I have a problem with providing accelerator keys for buttons on a tab control.

Keeping it simple to save me typing, if I have a tab control with, say, 3 tabs and each tab has an Update button on it, how can I make it so that the user can hit <alt>U and that will fire the click event of the Update button on the tab that has focus. Needless to say each of the buttons has to have the caption [u]U</u>pdate.

Anyone got any neat tricks for this? Would be much appreciated.
Reply With Quote
  #2 (permalink)  
Old July 10th, 2003, 10:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Cardiff, , United Kingdom.
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could change the caption of the appropriate button when the tab is selected from "Update" to "&Update", and change all the other button caption's to "Update"

For example, if you have all 3 buttons in a control array cmdUpdate (cmdUpdate(0), cmdUpdate(1) etc.), you could do something like this:

Code:
cmbUpdate(0).Caption = "Update"
cmbUpdate(1).Caption = "Update"
cmbUpdate(2).Caption = "Update"

cmdUpdate(TabSelected).Caption = "&Update"
I hope that helps.

Regards
Owain Williams
Reply With Quote
  #3 (permalink)  
Old July 10th, 2003, 10:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Cardiff, , United Kingdom.
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could always put that into a loop if you have more buttons:

Code:
For lngCount = cmdUpdate.LBound To cmdUpdate.UBound
   cmdUpdate(lngCount).Caption = "Update"
Next

cmdUpdate(TabSelected).Caption = "&Update"
There may be more efficient ways of doing this though.

Regards
Owain Williams
Reply With Quote
  #4 (permalink)  
Old July 10th, 2003, 04:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Two cents.
In my opinion the Update button should be outside the tab, just like
the OK, Apply and Cancel buttons (in fact I will call it just Apply).
This is one of the GUI guidelines that I follow, but it is personal.

Marco


Quote:
quote:Originally posted by pgtips
 I have a problem with providing accelerator keys for buttons on a tab control.

Keeping it simple to save me typing, if I have a tab control with, say, 3 tabs and each tab has an Update button on it, how can I make it so that the user can hit <alt>U and that will fire the click event of the Update button on the tab that has focus. Needless to say each of the buttons has to have the caption [u]U</u>pdate.

Anyone got any neat tricks for this? Would be much appreciated.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable a tab on a tab control. dbradley VB.NET 6 April 14th, 2011 10:04 AM
Tab Control prasanta2expert Access 4 November 27th, 2006 05:51 AM
Calendar Control with Tab Control Slicemahn Access 1 June 12th, 2006 10:35 PM
tab control p2pMember ASP.NET 1.0 and 1.1 Basics 1 March 9th, 2006 06:39 AM
Tab control Bhanu VS.NET 2002/2003 2 March 6th, 2005 04:12 AM



All times are GMT -4. The time now is 11:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.