[Gambas-user] "Long" click

PICCORO McKAY Lenz mckaygerhard at ...626...
Sat Sep 23 19:47:57 CEST 2017


i understand perfectly..

--->here but presed but not released
----> here a second was passed
----> here 20 second was passed but button are not released
-----> here due more that 20 second passed and but not released a
form/window are raised


your code looks with sense, but maybe i a good idea start the timming based
on the button pressure, and not the moouse

your code says> if the MOUSE button click ON ANY PART OF THE FORM start
timing to calculate how long are pressed..

and i thing you want > if the MOUSE button click ON SOME SPECIFIC BUTTON
FORM et etc



Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-09-21 6:08 GMT-04:00 ML <d4t4full at ...626...>:

> 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
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list