[Gambas-user] Strange behaviour of LostFocus event

Jussi Lahtinen jussi.lahtinen at ...626...
Tue Jun 22 16:07:11 CEST 2010


Why lostfocus is executed twice..?
Maybe something like this?

Public IsInUse as Boolean

Public Sub YourSub()
 If IsInUse = False then
 IsInUse = True

  'Code here.

 IsInUse = False
 Endif
End


Jussi


On Tue, Jun 22, 2010 at 00:11, Leonardo Miliani
<leonardo at ...1237...> wrote:
> A friend of mine has written an application in which he has let the
> permission at the users to insert a text in the combobox textarea. Then,
> his code parses the text and, if there are errors, a message box is
> showed.
>
> The problem is that the LostFocus event is executed twice....
> In fact, Gambas tries to show another message box, but that is
> impossible because only 1 modal form can appears on the screen at once.
> So the program terminates and Gambas visualizes the error
> "Message box already displayed".
>
> This is the portion of code:
> PUBLIC SUB CodiceVoceContabile_LostFocus()
> .........bla.....bla.....bla.........................................
> FOR EACH RecTab
>  IF RecTab!NomeVoce = $_VoceConto THEN
>    i_CoVoMov = RecTab!NumVoce   '--Codice di CONTO, corrispondente alla
> Voce contabile primaria
>    i_UltCtogrup = i_CoVoMov + 999
>  ENDIF
>  IF i_CoVoMov > 0 THEN
>    IF RecTab!NumVoce <= i_UltCtogrup THEN
>      IF RecTab!NomeVoce = $_VoceSotCto
>        i_CoVoMov = RecTab!NumVoce
>        '-- Codice di SOTTOCONTO, corrispondente alla Voce contabile
> secondaria
>        $_PartMovSiNo = RecTab!ContrPartSiNo
>        BREAK
>      ENDIF
>    ELSE
>      'LabFrm2RicPiaCo:
>      Message.Error("Attenzione! ->  Record  'NON TROVATO'" & Chr(10) &
> Chr(10) & "durante la lettura della Tabella ContabFam.db!piancont'" &
> Chr(10) & Chr(10) & "in Form2.MovDigOk_Click.LabFrm2RicPiaCo" & Chr(10)
> & Chr(10) & " il programma verrà chiuso")
>      QUIT
>    ENDIF
>  ENDIF
> NEXT
>
>
> --
> Leonardo Miliani
> www.leonardomiliani.com
>
> Webmaster e co-fondatore di www.gambas-it.org
> Il portale di riferimento per i programmatori Gambas italiani
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> 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