using combobox for drop down menu?

G

Geoff Cox

Hello,

I am starting to play around with drop down menus using comboboxes.

The code below works in that when the mouse moves over the image
behind the combobox, the box is populated with the various options.

A couple of questions.

Is it possible to bring the focus back to the slide once the correct
answer has been selected?

How do I ensure that the box is empty when the presentation is run? At
the moment sometimes it is empty, sometimes there is a 0 or 1 in the
box.

Thanks

Geoff

PS any source of help in using comboboxes? Books or the net?


Private Sub Initialize()
If ComboBox1.ListCount = 4 Then GoTo Check
ComboBox1.AddItem "Select"
ComboBox1.AddItem "Red"
ComboBox1.AddItem "Green"
ComboBox1.AddItem "Blue"

Check:
ComboBox1.Style = fmStyleDropDownList
ComboBox1.BoundColumn = 0
ComboBox1.ListIndex = 0

End Sub

Private Sub ComboBox1_Click()
Select Case ComboBox1.Value
Case 0
Label1.Caption = "What's your Answer?"
Case 1
Label1.Caption = "No, try again."
Case 2
Label1.Caption = "No, try again."
Case 3
Label1.Caption = "Well done, this is the correct answer."

End Select
End Sub


Sub object_mouse_over()

Initialize

End Sub
 
G

Geoff Cox

If you've worked out a way of getting code to run at startup, use the .Clear
method on the combobox.

Steve,

Thanks for the above and for help ideas below.

Any idea re getting the focus from the CombBox to the slide?

Cheers

Geoff
 
G

Geoff Cox

I guess I'm not clear on what the problem is. Normally to change the focus, the
user would click on the slide.

Steve,

I see that but just wondered if it was possible to move the focus back
to the slide (using VBA) when say the user presses the enter key
whilst in the TextBox Control?

Perhaps asking too much?!

Cheers

Geoff
 
G

Geoff Cox

I don't know ... I don't quite understand the problem, hence the confusion.

Steve,

Apologies - I have muddled ComboBox and TextBox situations above but
the "problem" is the same.

A user will perhaps be wondering why they cannot move to the next
slide by pressing the enter key. I realise that if they click on the
slide to put the focus there, then the next enter key press will move
them on to the next slide.

Just wondered whether there was a way to use VBA to move the focus
back to the slide once the correct answer has been selected using a
ComboBox or when say the enter key is pressed when typing into a
TextBox....

Cheers

Geoff
 
B

Bill Foley

Not really a fix, but what I have done in the past is put a navigation
button that goes to the next slide and typed "Double-click" as the text on
the button. First click takes the focus and the next one does the action.
Sorry for the rudimentary method, but I don't know of any VBA method to
return focus either.
 
G

Geoff Cox

Not really a fix, but what I have done in the past is put a navigation
button that goes to the next slide and typed "Double-click" as the text on
the button. First click takes the focus and the next one does the action.
Sorry for the rudimentary method, but I don't know of any VBA method to
return focus either.

Thanks Bill - that does the trick if Steve cannot come up with any VBA
inspiration!

Cheers

Geoff
 
Top