PDA

View Full Version : Button gedrückt halten



Nobody
9-Jul-2013, 05:44 AM
Hi,

gibt es ein Event das durchlaufen wird, wenn ein Button anhaltend gedrückt wird.

Vincent Oorsprong
9-Jul-2013, 06:06 AM
Hi Nobody,

Use the following code


Class cRepeaterButton is a Button
Procedure Construct_Object
Forward Send Construct_Object

{ DesignTime = False }
Property Handle phoTimer
Property Integer piTimeOut 500
End_Procedure

Procedure Mouse_Down Integer iWindowNumber Integer iPosition
Handle hoTimer hMsg
Integer iTimeOut

Forward Send Mouse_Down iWindowNumber iPosition

Get piTimeOut to iTimeOut
Get Message to hMsg

Get Create (RefClass (DFTimer)) to hoTimer
Set Timeout of hoTimer to iTimeOut
Set Timer_Object of hoTimer to Self
Set Timer_Message of hoTimer to hMsg
Set Timer_Active_State of hoTimer to True

Set phoTimer to hoTimer
End_Procedure

Procedure Mouse_Up Integer iWindowNumber Integer iPosition
Handle hoTimer

Forward Send Mouse_Up iWindowNumber iPosition

Get phoTimer to hoTimer
If (hoTimer <> 0) Begin
Set Timer_Active_State of hoTimer to False
Send Destroy of hoTimer
Set phoTimer to 0
End
End_Procedure
End_Class


Object oMain is a BasicPanel
Set Size to 100 173


Object oButton1 is a cRepeaterButton
Set Location to 28 28
Set Size to 14 107
Set Label to 'Click me (and hold down)'

Procedure OnClick
Showln (Random (10000))
End_Procedure
End_Object
End_Object


Start_UI oMain

Nobody
9-Jul-2013, 06:46 AM
Danke dir Vincent funktioniert super