Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Combo: Execute vs Clicked vs KeyDown
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Combo: Execute vs Clicked vs KeyDown

 Post Reply Post Reply
Author
Message
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Topic: Combo: Execute vs Clicked vs KeyDown
    Posted: 27 October 2004 at 2:33am
Gday,

How can I differ between when a user has pressed enter and when they have clicked on the combobox? They both trigger the Execute event, and I can't see how I determine the user's action.

Normally in VB you would use the "Click" and KeyPress/Down events. How can I do this with the CommandBarComboBox?

The desired effect is that when someone presses enter on the combo, i do a lookup based on the control.text, whereas when they "click" on the combo i don't need to a lookup beacuse the item they have clicked on already exists.

Any advice is appreciated.

Thanks
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 27 October 2004 at 8:21am
The InitCommandsPopup event is fired when the combobox is dropped down (the dop-down button is clicked).  Then the Execute event is fired when they click\hit enter on a selection.
Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2004 at 1:12am
That helps, thanks.
I notice that this event passes a XtremeCommandBars.ICommandBar object. Is there a way to determine from this what triggered the event? For example, as well as triggering when the combo is dropped-down, it is also triggered when a popup menu is shown. I'm only interested in when the combo is dropped down.

Its not essential, but would be helpful to know.

Thanks again.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2004 at 6:44am
CommandBar.Position = xtpBarListBox for combo list.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2004 at 6:55am
This event is fired any time a drop-down/popup is displayed.  In the event you must test to see what triggered the event so you can act on it appropriately.  All you really need to do is look at the Parent property.

If (Not CommandBar.Parent Is Nothing) And (CommandBar.Parent.Type = xtpControlComboBox) Then
    Dim myCombo As CommandBarComboBox
    Set myCombo = CommandBar.Parent.Id
   
    'Your combobox code here
   
End If
Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2004 at 5:50pm
Thanks oleg and SuperMario. I wasn't aware that CommandBar.Parent pointed to the control that triggered the event, that is helpful.

Remember though that VB6's If isnt short-circuited so
If (Not CommandBar.Parent Is Nothing) And (CommandBar.Parent.Type = xtpControlComboBox) Then
should be split to two ifs. Curse those stupid VB6 quirks! :)

Thanks again.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.186 seconds.