Optimized Compile Problem with Control

Discussion in 'Questions (Windows Mobile)' started by epsharp, Feb 7, 2009.

  1. epsharp

    epsharp Member Licensed 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.


    Ed Sharp
  2. Erel

    Erel Administrator Staff Member Licensed User

    The uploaded file is corrupt. Can you upload it again?
  3. agraham

    agraham Expert Licensed 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.

    It will! fml is, I assume, a FormLib not a Textbox - try

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

    Cableguy Expert Licensed User

    Could this be related to not assigning teh main module prefix to the control keyword?
    Control(fml, TextBox)
    should really be..
    Control(main.fml, TextBox)
  5. agraham

    agraham Expert Licensed User

    No. As I pointed out fml is not a TextBox, it is a Formlib. My suggestion works without needing a module prefix.
  6. epsharp

    epsharp Member Licensed 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.


    Ed Sharp

    NB. The attached program DOES compile now!
  7. Erel

    Erel Administrator Staff Member Licensed User

    Agraham is always correct ;)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice