#90599 - 2002-12-18 02:06 AM
Re: Kixforms: Which mouse button was clicked?
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Hi krabourn,
Try using the OnMouseDown event in combination with the Form's MouseButton property - heres an example. Just right click anywhere on the form. Dont forget - the MouseX and MouseY position is in Client Coordinates (relative to the top left of the form, not the desktop) and Forms are specified using real coordinates (from the top left of the desktop) ...
code:
Break On $Form = CreateObject("Kixtart.Form") $Form.Size = 400, 400 $Form.Center $Form.ForeColor = Blue $Form.OnMouseDown = "OnFormMouseDown" Function OnFormMouseDown If $Form.MouseButton = 2 ; Right-click $Form.PrintXY($Form.MouseX,$Form.MouseY,"Here I am") EndIf EndFunction $Form.Show While $Form.Visible $=Execute($Form.DoEvents()) Loop Exit 1
[ 18. December 2002, 02:07: Message edited by: Shawn ]
|
Top
|
|
|
|
#90612 - 2002-12-18 07:41 PM
Re: Kixforms: Which mouse button was clicked?
|
krabourn
Hey THIS is FUN
Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
|
Sorry, I am sick at home today and my brain is not firing on all two cylinders.
Here is the code. It is not even close to perfect. It is just some proof of concept.
code:
Break On
$Form = CreateObject("Kixtart.Form") $Form.Size = 400, 400 $Form.Center $Form.ForeColor = Blue $Form.OnMouseDown = "OnFormMouseDown" FUNCTION OnFormMouseDown If $Form.MouseButton = 2 ; Right-click fnPopup($Form.Left + $Form.MouseX, $Form.Top + $Form.MouseY) ENDIF EndFunction
$Form.Show While $Form.Visible $=Execute($Form.DoEvents()) Loop
Exit 1
FUNCTION fnPopup($FormSLeft, $FormSTop) $FormS = CreateObject("Kixtart.Form") $FormS.BorderStyle = 0 $FormS.ClientWidth = 100 $FormS.ClientHeight = 35 $FormS.Top = $FormSTop $FormS.Left = $FormSLeft $FormS.ForeColor = Red $FormS.Show $FormS.Rectangle(0, 0, $FormS.ClientWidth, $FormS.ClientHeight) $btnClose = $FormS.CommandButton("Click Me", 10, 5, 80, 25) $btnClose.OnClick = "$$FormS.Hide" While $FormS.Visible $=Execute($FormS.DoEvents()) Loop ENDFUNCTION
_________________________
Kelly
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 557 anonymous users online.
|
|
|