Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Focus by Label and Frames. 1

Status
Not open for further replies.

CasperTFG

Programmer
Nov 15, 2001
1,210
US
Hey All I have 2 quick questions, I tried searching but it was giving me errors and I am under the gun... Your help is appretiated.

1) How do I set a Label to be the Quick Key for a text box. I have a Label like &Name, and a text box beside it, I want to press CTRL + N and have it go to the Text Box...

2) I have controls in a frame. If I disable the frame the controls are still enabled? Did I miss something I thought that would disable the controls in the fram too?

Thanks again

Craig

Casper

There is room for all of gods creatures, "Right Beside the Mashed Potatoes".
 
1) Focus for labels are detemined by the tab index of the labe. Whichever control is after the label in teh tab index order recieves the focus.

2) I don't have a problem with controls being disabled that are in a disabled frame. Are you using the standard frame or a windowless one?
 
The hot key for that would be ALT+N not CTRL+N. If you want to use CTRL+N you could either setup a hidden menu item or trap the keydown/up event of the form with the form's keypreview property set to true
 
Yeah sorry slip up on the CTRL & ALT...

Focus, thatsa what I needa... Gotta talk with an itallian accent when the answer is so simple... :)

Figured out the frames issue... VB Bug. I deleted all the controls and created them in the frame ratther than cutting them from the form and pasting them inside the frame ? Very strange.

Thanks.

Casper

There is room for all of gods creatures, "Right Beside the Mashed Potatoes".
 
Hi, I'm trying to do the same thing (use Alt+F to get to a text box located within a frame).
Focus for labels are determined by the tab index of the label. Whichever control is after the label in the tab index order receives the focus.
I have a frame called frmFishDetails with the caption &Fish Details, tab index 2.

Within frmFishDetails, I have three bound textboxes:
ctlSpecies (tab index 3)
ctlLength (tab index 4)
ctlWeight (tab index 5)

When I press Alt+F, I wanted the cursor to go to ctlSpecies but right now it doesn't go anywhere.

Have I missed something simple?
 
I have a form with Frame1. Inside Frame1 is TextBox1, TextBox3. On the form is TextBox2

Then I have this code:

Code:
Private Sub Form_Load()
    Me.Frame1.Caption = "&Frame1"
    Me.Frame1.TabIndex = 0
    Me.Text1.TabIndex = 2
    Me.Text2.TabIndex = 3
    Me.Text3.TabIndex = 4
    
    Me.Show
    Me.Text3.SetFocus
End Sub
Pressing Alt+F works just fine from all text boxes on the form and always sets focus to Text1
 
Okay, in trying your example, I get a compile error: "Method or data member not found" and when I go to debug, the "Caption" part is highlighted. I don't think that I am missing any references...
 
Sorry, that was just me being silly. Used the actual frame instead of the label.

But it didn't work anyway...the cursor still disappears off the form into la-la-land
 
It's weird...2 or 3 years ago, Craig, you were arguing/discussing...stuff... with me, Foada, CajunCenturian, CCLINT...and now...well, it's like you went a bit backwards...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top