[Gambas-user] Strange behaviour of LostFocus event

Leonardo Miliani leonardo at ...1237...
Mon Jun 21 23:11:48 CEST 2010


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





More information about the User mailing list