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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting an option when focus is lost.

Status
Not open for further replies.
Joined
Jun 30, 2003
Messages
196
Location
GB
i have a list of options that a user can select from in visual basic 6. Bassically how my interface works is by allowing the user to highlight the option they wish then pressing the select button. How do i get the select button to perform different functions depending upon what option was highlighted or had focus.

the problewm as i see it is i cant say whatever option has focus do a specific function, because the option highlighted looses focus when the select button is selected (i think). So perhaps i need logic like whatever the last object was to have focus, before this one perform a certain action.

I hope you experts understand what i mean, feel free to ask for more details if needed.

thanks
 
How do they highlight! i mean do they highlight from a listbox, combo box, text box (multiline) etc??

Nick
 
dgwilliams,

Put a frame on your form. Put 4 option buttons on the frame.
Put command button on the form and copy the following:

Private Sub Command1_Click()
Select Case True
Case Option1.Value
MsgBox "Option1 selected"
Case Option2.Value
MsgBox "Option2 selected"
Case Option3.Value
MsgBox "Option3 selected"
Case Option4.Value
MsgBox "Option4 selected"
Case Else
MsgBox "Nothing selected"
End Select

End Sub

Hope, you will get the idea.


VladK
 
its actually a system like a mobile phone, the user navaigates from each one of these options which is a graphic, using arrows which represent left, right, up and down. when they move to an icon, it increases in size to show it is highlighted or in focus. the user then should be able to press the select key when that icon or graphic is in focus and depending what graphic was in focus the select button should be able to act differently.

this also means that i cant use radio buttons.
 
dgwilliams,

You still can use radio buttons. In MouseMove events of your images put the code similar to this:

If ThisImageRadioButton.Value = False Then
ThisImageRadioButton.Value = True
End If

Every image would need its own radiobutton with similar name.
You will eventually need to put your invisible radiobuttons somewhere on the form.

VladK
 
dgwilliams,

If you use Picture control then you will be able to use GotFocus event to do the same thing. In Validate event, you might want to clear the values of the radio buttons under certain conditions.

Vladk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top