[Gambas-user] "Long" click
ML
d4t4full at ...626...
Thu Sep 21 12:08:24 CEST 2017
My guess is that you want a new form to appear after the button is
raised, but having been pressed more than X seconds.
To this end, I'd add a timer with the desired "long-click lenght" to the
main form (the one that "receives the long-click").
Maybe also the form and all its controls should have an observer and
apply the timer to the observer, if more than one control may receive
the "long click".
So it would be MouseDown->Enable timer->MouseUp->Disable Timer. If the
timer triggered, the form should be shown:
Public Sub Form1_MouseDown()
'Start timing clicks
tmrLongClickEnabled = True
End
Public Sub Form1_MouseUp()
'Stop timing clicks
tmrLongClick.Enabled = False
End
Public Sub tmrLongClick_Timer()
'If the timer triggered before being disabled, it was a
"long-click", so we show the "other" form
Form2.Show()
'We also disable the timer so no more than ONE form is shown per
"long-click".
tmrLongClick.Enabled = False
End
Disclaimer: It looks good on paper, but did not actually try it.
HTH,
zxMarce
On 21/09/17 06:28, Gianluigi wrote:
> I'm not sure I understand, but that's not enough?
>
> Public Sub Button1_MouseDown()
>
> Form1.Show()
>
> End
>
> Public Sub Button1_MouseUp()
>
> Form1.Hide()
>
> End
>
> Regards
> Gianluigi
>
> 2017-09-21 8:19 GMT+02:00 Miguel Manso <mmanso at ...626...>:
>> Hi All,
>> I'm using gambas3 for some time now and I'd like to know your opinion
>> about the best way to implement a "long" click.
>> The idea is to leave a button presses for a certain amount of seconds
>> and without releasing it, a new form will open.
>> We did this using a timer but I'd like to know if there's any
>> "recommended" way of doing it.
>> Thanks.
>> --
>> Miguel Manso
More information about the User
mailing list