Single Click / Double Click Event order

BlitzMax Forums/Brucey's Modules/Single Click / Double Click Event order

Glenn Dodd(Posted 2008) [#1]
I have code that activates on a single left click, and code for a double left click.
The single click is always activated, even when doing a double click.
how do i avoid this?


Brucey(Posted 2008) [#2]
What kind of control are you using?

What events are you connecting to?


Glenn Dodd(Posted 2008) [#3]
listbox

	Method SelectorTypeClicked(event:wxCommandEvent)
		' once the SelectorType ListBox is clicked we need to populate the Selector ListBox
		' Find the index of the item clicked
		Local index:Int = wxCommandEvent(event).GetInt()
		' Get the value of the item clicked
		' Note: This is the TSelectorType object we stored earlier.
		' It gives us access to the Id, for example, which gives us a quicker
		' lookup in the SQL. (ie. no table joins, since the Id is a foreign key!)
		Local sSelectorType:TSelectorType = TSelectorType(m_listBoxSelectorType.GetItemClientData(index))
		' now fill in the Selector ListBox
		PopulateSelector(sSelectorType.SelectorTypeID)
		' and clear the Memo Field
	End Method


double click
	Method PopupMenuRightClick(event:wxMouseEvent)
		DebugLog "RightClick activated"
		Select event.GetId()

		    Case ID_SelectorType
        	DebugLog "You clicked on Boris!"

'    		Case ID_lb2
 '       	DebugLog "You clicked on Fred!"

		End Select		

		event.Skip()
	End Method



Brucey(Posted 2008) [#4]
Do you get a Selected event when you double click on an already selected item in the listbox?

Otherwise, it would make sense that if you double-clicked a non-selected item, it would need to select it first (ie. you get two events?)


Glenn Dodd(Posted 2008) [#5]
left click an item then do a double click - seems to run the select method again.
i can work around it, just wondered if it was right.