关于VFP结构体的讨论
如下程序 我定义了一个结构体 St 然后定义一个Cbtn按钮类并通过St给他赋值最后在主Form里调用addObject()函数动态添加控件
为什么提示这个? 我是照T版给的那个模板 写的 为什么出错?
---
程序代码:
Clear All Public ga_Struct[2] ga_Struct[1] = CreateObject("St", 50, "this is a" ) ga_Struct[2] = CreateObject("St", 200, "this is b" ) Main() Clear All Return Procedure Main() Local lo_MainForm lo_MainForm = NewObject("C_Form") lo_MainForm.Show Read Events EndProc Define Class St as Custom a = 0 s = "" Procedure Init(tn_a, tc_s) a = tn_a s = tc_s EndProc EndDefine Define Class Cbtn as CommandButton k = "" Procedure Init(St_k) With This k = St_k .Width = .k.a .Caption = .k.s EndWith EndProc EndDefine Define Class C_Form as Form Width = 400 Height = 400 AutoCenter = .T. Caption = "Experiment" Procedure Init With This .AddObject("xx", "Cbtn", ga_Struct[1]) .AddObject("oo", "TextBox") With This.oo .Left = 100 .Top = 50 .Visible = .T. EndWith EndWith EndProc Procedure destroy Clear Events EndProc EndDefine俺 被这个搞晕了 放100分求救。。。