Combo: Execute vs Clicked vs KeyDown
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1327
Printed Date: 12 December 2024 at 4:45am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Combo: Execute vs Clicked vs KeyDown
Posted By: dajv
Subject: Combo: Execute vs Clicked vs KeyDown
Date 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
|
Replies:
Posted By: SuperMario
Date 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.
|
Posted By: dajv
Date 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.
|
Posted By: Oleg
Date Posted: 28 October 2004 at 6:44am
CommandBar.Position = xtpBarListBox for combo list.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: SuperMario
Date 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
|
Posted By: dajv
Date 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.
|
|