回复 49楼 TonyDeng
为了显示 结果 我把你的程序稍作了修改 基本上能理清了不过就是那个Valid事件没搞懂 按理说TextBox是空的话 焦点就还在他上面 不空就焦点跑走
那为什么我输入0后提示一个无效的输入 然后就关不掉这个窗口? 我ALT + CTRL + DEL 了好多次啊
程序代码:
Clear All Main() Procedure Main() Local lo_MainForm lo_MainForm = NewObject("C_Form") lo_MainForm.Show Read Events Return EndProc DEFINE CLASS C_Form AS Form AutoCenter = .T. Width = 600 Height = 600 PROCEDURE Init FOR i = 1 TO 8 lc_Name = "xx" + TRANSFORM(i) This.AddObject(lc_Name, "myClass") WITH This.&lc_Name .Caption = "Caption + " + TRANSFORM(i) .Height = 20 + 5 * (i - 1) .Top = .Height * (i - 1) .Width = 300 .Visible = .T. .Resize ENDWITH NEXT ENDPROC PROCEDURE Click ThisForm.SetAll("Caption", "bbb") ENDPROC ENDDEFINE DEFINE CLASS myClass AS Container Caption = "" ADD OBJECT Label1 AS Label WITH Caption = "aaa", Left = 10, Top = 0, Width = 40, Height = 20 ADD Object TextBox1 AS TextBox with Left =200, value = 10, Top = 0, Width = 40, Height = 20 PROCEDURE Resize WITH This .SetAll("Height", .Height) ENDWITH ENDPROC PROCEDURE TextBox1.Valid With This IF EMPTY(This.Value) RETURN .F. EndIf EndWith EndProc Procedure Destroy Clear Events EndProc ENDDEFINE---
梅尚程荀
马谭杨奚