Optimized Compile Problem with Control

epsharp

Member
Licensed User
Longtime User
I have searched and read every thread that I can find involving the Control Keyword. It is probable that my problem is so simple that it's not come up.

In all the programs I have written, I have never had more than 1 Menu form, usually called fMenu and a FormLib Object called flMenu. Using these as Literals [ie. flMenu.New1("fMenu",B4PObject(1))] has always worked both in Debug and Optimized Compile.

In the attached snippet, I have 3 menus with FormLib Objects flMenu1, flMenu2, flMenu3. When compiling I get the error Unknown Control Type. Using: [ Control(fml, Form).New1(fm,B4PObject(1)) ] then Generates an Unknown Property error. Thinking that I could not use the Control Keyword when initializing (.New1), I took this out of the loop and initialized all three menus using the literal [fl.Menu3.New.....] and this compiled just fine but... when it got to "TextBox", I got a Control type error!
Using: [Control(fml, TextBox).SetFontStyle(names(i),True,False,False,False) generates Unknown Property error.

Can someone please help.

Regards,

Ed Sharp
 

agraham

Expert
Licensed User
Longtime User
Your attachment is not a valid sbp file but contains only a fragment of code. How about posting some proper source so we don't have to try to guess how to build your form and menus.

However
Control(fml, TextBox).SetFontStyle(names(i),True,False,False,False) generates Unknown Property error.
It will! fml is, I assume, a FormLib not a Textbox - try

Control(fml, Formlib).SetFontStyle(names(i),True,False,False,False)
 

Cableguy

Expert
Licensed User
Longtime User
Could this be related to not assigning teh main module prefix to the control keyword?
like...
Control(fml, TextBox)
should really be..
Control(main.fml, TextBox)
??
 

epsharp

Member
Licensed User
Longtime User
Agraham is correct

My apologies for only posting a code snippet and not the whole program. I have attached the whole program along with a functions .txt.

I did not realize that FormLib was a Control Type. As I mentioned in my original post, "something so simple..."

Thanks again to all for your help.

Regards

Ed Sharp

NB. The attached program DOES compile now!
 
Top