Using label control to change focus 
Author Message
 Using label control to change focus

I have a label for a field with the caption of "&Start". What I want to do is
to use the Alt-S combo to set the focus to the field (called txtStartDate) that
the label refers to. What event is triggered when the user presses Alt-S???

Furthermore, I can get this to work ONLY WITH THE FIRST FIELD on the form!! Any
ideas???

Eric



Mon, 10 Aug 1998 03:00:00 GMT  
 Using label control to change focus

In order to do what you want, you need to set the tabIndex property of
the lable immedietly before the control(field) you want to access>


Quote:
>I have a label for a field with the caption of "&Start". What I want to do is
>to use the Alt-S combo to set the focus to the field (called txtStartDate) that
>the label refers to. What event is triggered when the user presses Alt-S???

I think a setfocus method is excuted!
Quote:
>Furthermore, I can get this to work ONLY WITH THE FIRST FIELD on the form!! Any
>ideas???
>Eric



Tue, 11 Aug 1998 03:00:00 GMT  
 Using label control to change focus

Quote:
>I have a label for a field with the caption of "&Start". What I want to do is
>to use the Alt-S combo to set the focus to the field (called txtStartDate) that
>the label refers to. What event is triggered when the user presses Alt-S???

>Furthermore, I can get this to work ONLY WITH THE FIRST FIELD on the form!! Any
>ideas???

Look at help for TabIndex. Set the TabIndex for the label to 1 less than that of the
control you want it to apply to. Since a label can't take the focus, the focus is
given to the next "focusable" control.

Tip: When you have designed the form, click on each object in turn but in
REVERSE ORDER assigning a tab index of 0. (Assigning zero to a control makes
every other TabIndex value push up one). Then try tabbing through the form and
everything should be right.




Tue, 11 Aug 1998 03:00:00 GMT  
 Using label control to change focus

Quote:
>I have a label for a field with the caption of "&Start". What I want to do is
>to use the Alt-S combo to set the focus to the field (called txtStartDate) that
>the label refers to. What event is triggered when the user presses Alt-S???

>Furthermore, I can get this to work ONLY WITH THE FIRST FIELD on the form!! Any
>ideas???

Look at help for TabIndex. Set the TabIndex for the label to 1 less than that of the
control you want it to apply to. Since a label can't take the focus, the focus is
given to the next "focusable" control.

Tip: When you have designed the form, click on each object in turn but in
REVERSE ORDER assigning a tab index of 0. (Assigning zero to a control makes
every other TabIndex value push up one). Then try tabbing through the form and
everything should be right.




Tue, 11 Aug 1998 03:00:00 GMT  
 Using label control to change focus

Quote:
>I have a label for a field with the caption of "&Start". What I want to do is
>to use the Alt-S combo to set the focus to the field (called txtStartDate) that
>the label refers to. What event is triggered when the user presses Alt-S???

Here's an example from an email program I'm writing. I have an array of
four single-line edit controls for the header lines. This is the code from
the KEYDOWN event of the array.

In general, you need code like this in the KEYDOWN event of every control
from which you want to jump to your field.

----------------------------------------------------------    

    If Shift = 4 Then 'alt key

        Select Case KeyCode

            Case Asc("T")
                txtMailHeader(TO_HEADER).SetFocus

            Case Asc("S") 'subject
                txtMailHeader(SUBJECT_HEADER).SetFocus

            Case Asc("C") 'cc
                txtMailHeader(CC_HEADER).SetFocus

            Case Asc("A") 'attach
                txtMailHeader(ATTACH_HEADER).SetFocus

        End Select

    End If

----------------------------------------------------------    

Remember: the label is just a picture -- it informs the user, but plays no
part in the code.

David

--

____D__a__v__i__d_____B__e__r__g__a__r__t___________________________________

                              please note new address ^



Thu, 13 Aug 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Using label control to change focus

2. Any ways to make focus on Label control like focus in button control

3. How can I change nework drive label using script

4. Labels - Transparent labels flash whenever they get changed

5. focus change among controls in run-time.

6. How to trap focus change on controls in a form

7. MS Access can not change focus to control button

8. focus change among controls in run-time.

9. Changing text boxes into label controls

10. Change Label & Icon on OLE Control Icon

11. Label on MS Tabbed Dialog control prevents validate event firing when changing tabs

12. Changing a label on an activex control from a form

 

 
Powered by phpBB® Forum Software