FormExDesktop and GetControls

BjornF

Active Member
Licensed User
Longtime User
Dear All,

I am trying to use the GetControls to empty a number of textboxes from the form FE_Add with the slightly modified code from the helpfile:

ctrlnames() = GetControls(FE_Add.ControlRef)
For i = 0 To ArrayLen(ctrlnames())-1
If ControlType(ctrlnames(i)) = "TextBox" Then Control(ctrlnames(i)).Text = ""
Next

It works very well in the non-compiled and non-optimised compiled versions, but I get an error message when I try to compile an optimised file (see attached).

I suspect it is because FE_Add is a FormEx form (from Andrew's FormExDesktop) and that I haven't understood the helpfile from that dll completely...

Any ideas on what is wrong, and what I can do about it?

all the best / Björn
 

Attachments

  • Error message.jpg
    Error message.jpg
    19.9 KB · Views: 155

agraham

Expert
Licensed User
Longtime User
It works very well in the non-compiled and non-optimised compiled versions, but I get an error message when I try to compile an optimised file (see attached)I suspect it is because FE_Add is a FormEx form (from Andrew's FormExDesktop)
Yes. Actually I am bit surprised that it works in the IDE/legacy compiler as although Basic4PPC knows the controls exist I didn't think it knew that they were on a FormEx.

ctrlnames() = GetControls("") should return all the controls and if you named the FormEx controls with a prefix (or suffix) like FE_txt_something you could check for both the control type and the name prefix.
 

BjornF

Active Member
Licensed User
Longtime User
Dear Andrew,

thank you for the rapid answer. :)

Best wishes / Björn
 
Top