Código: Selecionar todos
#include "hmg.ch"
#include "i_altsyntax.ch"
#include "i_winuser.ch"
PROCEDURE Main
LOCAL Dlg1, Text1, Text2, Label1, Label2
SET WINDOW MAIN OFF
SET NAVIGATION EXTENDED
test2()
gui_DialogCreate( @Dlg1, 0, 0, 1024, 768, "test" )
gui_LabelCreate( Dlg1, @Label1, 20, 5, 100, 20, "field 1" )
gui_TextCreate( Dlg1, @Text1, 20, 200, 200, 20, "entervalue", { || test2(), .T. } )
gui_labelCreate( Dlg1, @Label2, 50, 5, 100, 20, "field 2" )
gui_TextCreate( Dlg1, @Text2, 50, 200, 20, 20, "anothervalue" )
ACTIVATE WINDOW (Dlg1)
RETURN
FUNCTION Test2()
LOCAL Dlg2, Text3, Text4, Label3, Label4
gui_DialogCreate( @Dlg2, 0, 0, 1024, 768, "test" )
gui_LabelCreate( Dlg2, @Label3, 20, 5, 100, 20, "field 1" )
gui_TextCreate( Dlg2, @Text3, 20, 200, 200, 20, "entervalue", { || MsgBox( "test" ), .T. } )
gui_labelCreate( Dlg2, @Label4, 50, 5, 100, 20, "field 2" )
gui_TextCreate( Dlg2, @Text4, 50, 200, 20, 20, "anothervalue" )
ACTIVATE WINDOW (Dlg2)
RETURN Nil
FUNCTION gui_DialogCreate( xDlg, nRow, nCol, nWidth, nHeight, cTitle )
STATIC n := 0
n += 1
xDlg := "DLG" + StrZero( n, 3 )
DEFINE WINDOW ( xDlg ) ;
AT nCol, nRow ;
WIDTH nWidth ;
HEIGHT nHeight ;
TITLE cTitle ;
MODAL
END WINDOW
RETURN Nil
FUNCTION gui_LabelCreate( xDlg, xControl, nRow, nCol, nWidth, nHeight, xValue )
STATIC n := 0
n += 1
xControl := "lbl" + StrZero( n, 3 )
DEFINE LABEL ( xControl )
PARENT ( xDlg )
COL nCol
ROW nRow
WIDTH nWidth
HEIGHT nHeight
VALUE xValue
END LABEL
RETURN Nil
FUNCTION gui_textCreate( xDlg, xControl, nRow, nCol, nWidth, nHeight, xValue, bValid )
STATIC n := 0
n += 1
xControl := "text" + StrZero( n, 3 )
DEFINE GETBOX ( xControl )
PARENT ( xDlg )
ROW nRow
COL nCol
HEIGHT nHeight
WIDTH nWidth
VALUE xValue
IF ! Empty( bValid )
//ON LOSTFOCUS Eval( bValid )
VALID bValid // testing about bug?
ENDIF
END GETBOX
RETURN Nil
Só testar.
Chama test2, ok, valid funciona.
Chama test1 valid funciona e abre test2, mas aí o valid do test2 não funciona.
Trocando pro lostfocus tudo funciona.
O problema do valid é quando chamado de dentro de outro valid.
Pra testar com lostfocus, só descomentar lostfocus e comentar o valid, tá quase no final.