Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ListBox RightClick()
Message
 
To
28/08/2003 03:43:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00823852
Message ID:
00824105
Views:
29
Thanks for that Gregory. It seems like a bit of an effort just to get it to act like other controls.
All I'm trying to achieve is an action happening when you right click the list. But first it selects/deselects the item (I have multiselect=.T.) then performs the action, normally on 1 item too few if multiple items are selected.
Not very intuitive for the user.
I'll have a play with your code examples and see if I can get it to operate in an acceptable way.
Many thanks.
Caroline


>>Hi all,
>>Could someone please explain to me why if you pick an item in a listbox with the right mouse button it selects/deselects it as if you picked it with the left mouse button.
>>
>>Is there some way of preventing this behaviour.
>>Many thanks
>>Caroline
>
>Caroline,
>
>The Why: you may want do something for a rightclick - a popup or so
>
>The only way of preventing it is to prevent the MouseDown to actually 'happen' ( click() = MouseDown() + MouseUp() )
>
>In your listbox baseclass:
>
>
>&& MouseDown(
>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>
>do case
>case inlist(nShift, 0, 1, 2)	&& normal, SHIFT, CTRL for MultiSelect
>	do case
>	case inlist(nButton,  2)	&& Right)
>		NODEFAULT
>		
>	endcase
>endcase
>
>Using the MouseDown()/MouseUp() you have better control.
>
>eg - code below - when users rightclick in grid column header
>
>procedure MouseDown && of header class
>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>		
>	do case
>	case nShift = 0
>		do case
>		case (nButton == BUTTON_RIGHT )
>			NODEFAULT
>			=this.Parent.Parent.Click_Right_Header(this.Parent)
>			
>		endcase
>	
>	case nShift = 1	&& shift
>		do case
>		case (nButton == BUTTON_RIGHT )
>			NODEFAULT
>			=this.Parent.Parent.Click_Right_Header_Shift(this.Parent)
>			
>		endcase
>	
>	case nShift = 2	&& Control
>	
>	case nShift = 4	&& Alt
>	
>	case nShift = 3	&& Shift + control
>	
>	case nShift = 5	&& Shift + Alt
>	
>	case nShift = 6	&& Control + Alt
>	
>	case nShift = 7	&& Shift + Control + Alt
>
>	
>	endcase
>endproc
>
Caroline
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform