I know I had code years ago that did this but it apparently got mangled during computer transitions. The code below runs in the load event of a form but results in a blank form. The ,"parent = thisform line" is commented out because it causes a "Property PARENT is read-only" error..
FOR i = 1 TO 4 FOR j = 1 TO 10 oTextbox = CreateOBJECT("TextBox") WITH oTextbox .Name = "TextBox" + LTRIM(STR(i)) + LTRIM(STR(j)) .Left = (j - 1) * 10 .Top = (i - 1) * 20 .Width = 100 .Height = 20 .Value = "Data for cell " + LTRIM(STR(i)) + ", " + LTRIM(STR(j)) .Visible = .t. * .Parent = thisform ENDWITH ENDFOR ENDFOR
What am I missing? Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
The textbox needs to be added with a method on the form.
thisform.addobject( "TextBox" + LTRIM(STR(i)) + LTRIM(STR(j)), "textbox")
oTextbox = evaluate( "TextBox" + LTRIM(STR(i)) + LTRIM(STR(j)))
HTH, Tracy
On October 29, 2023 11:43:13 PM EDT, Joe Yoder joe@wheypower.com wrote:
I know I had code years ago that did this but it apparently got mangled during computer transitions. The code below runs in the load event of a form but results in a blank form. The ,"parent = thisform line" is commented out because it causes a "Property PARENT is read-only" error..
FOR i = 1 TO 4 FOR j = 1 TO 10 oTextbox = CreateOBJECT("TextBox") WITH oTextbox .Name = "TextBox" + LTRIM(STR(i)) + LTRIM(STR(j)) .Left = (j - 1) * 10 .Top = (i - 1) * 20 .Width = 100 .Height = 20 .Value = "Data for cell " + LTRIM(STR(i)) + ", " + LTRIM(STR(j)) .Visible = .t. * .Parent = thisform ENDWITH ENDFOR ENDFOR
What am I missing? Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
Along these lines, if you haven't checked out the Dynamic Forms https://github.com/mattslay/DynamicForms project on VFPx, that makes programmatically creating forms MUCH easier.
E
On Mon, Oct 30, 2023 at 5:19 AM Tracy Pearson tracy@powerchurch.com wrote:
The textbox needs to be added with a method on the form.
thisform.addobject( "TextBox" + LTRIM(STR(i)) + LTRIM(STR(j)),"textbox")
oTextbox = evaluate( "TextBox" + LTRIM(STR(i)) + LTRIM(STR(j)))HTH, Tracy
On October 29, 2023 11:43:13 PM EDT, Joe Yoder joe@wheypower.com wrote:
I know I had code years ago that did this but it apparently got mangled during computer transitions. The code below runs in the load event of a form but results in a blank form. The ,"parent = thisform line" is commented out because it causes a "Property PARENT is read-only" error..
FOR i = 1 TO 4 FOR j = 1 TO 10 oTextbox = CreateOBJECT("TextBox") WITH oTextbox .Name = "TextBox" + LTRIM(STR(i)) + LTRIM(STR(j)) .Left = (j - 1) * 10 .Top = (i - 1) * 20 .Width = 100 .Height = 20 .Value = "Data for cell " + LTRIM(STR(i)) + ", " +
LTRIM(STR(j))
.Visible = .t. * .Parent = thisform ENDWITHENDFOR ENDFOR
What am I missing? Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]