[Gambas-user] Stopping an event when user clicks on the form menu

Fabien Bodard gambas.fr at ...626...
Fri Jan 24 16:21:30 CET 2014


http://gambasdoc.org/help/comp/gb.qt4/application/activecontrol?v3

Returns the control having the focus.

But return null for a menu or when the form lose the focus

2014/1/24 Fabien Bodard <gambas.fr at ...626...>:
> This is how to do with svn version ...
>
>
> Public Sub Form_Open()
> Balloon.Delay = 1000
> End
>
> Public Sub TextBox1_LostFocus()
>
>  If IsNull(Application.ActiveControl) Then Return
>
>  If Len(Last.Text) < 8 Then
>
>    Balloon.Error("this must be filled before anything else", Last)
>    TextBox1.Select()
>    Last.SetFocus
>
>  Endif
> End
>
>
> I  don't know if Application.ActiveControl is in the last 3.5
> packages, but it is what you need.
>
> 2014/1/24 Charlie Reinl <Karl.Reinl at ...9...>:
>> Am Freitag, den 24.01.2014, 09:56 +1030 schrieb Bruce:
>>> I have a form with a textbox that "MUST" be filled in before moving on
>>> to the next control or any other control within the form. Fine, so I
>>> implement a txtManditory_LostFocus method that just checks that there is
>>> some text in there.
>>>
>>> My problems are:
>>> 1) if the entire form loses focus, the lostfocus event fires.
>>> 2) if the user tries to click on the form menu the lost focus event
>>> fires.
>>>
>>> I think I have got around 1) by using Object.Lock in a Form_Leave()
>>> handler, but 2) has got me stumped.
>>>
>>> Any clues?
>>>
>>> tia
>>> Bruce
>>
>> Salut Bruce,
>>
>> disable all others and set a 'continue' (enabled) behind .....
>> or let the user only enter to the form after filling that field in a
>> single form/field
>>
>>
>> --
>> Amicalement
>> Charlie
>>
>>
>> ------------------------------------------------------------------------------
>> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>> Learn Why More Businesses Are Choosing CenturyLink Cloud For
>> Critical Workloads, Development Environments & Everything In Between.
>> Get a Quote or Start a Free Trial Today.
>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard




More information about the User mailing list