ComboBox bug???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Davide It
    Forum Member
    • Oct 2006
    • 7

    ComboBox bug???

    Hello everybody.
    My suspect is the following is a bug of AMS 7.

    I wanted to use a ComboBox to select among three items. I wanted also to display some text in two labels, according to the selected item.
    That's how I wrote down the code.
    In On Startup section tAppName (table) and bIsDebug (boolean) are initialized, according to ini file values (boolean variable is set to true).

    In Global Functions section the following function is present.
    function ShowDebugMessage( sInString )
    if bIsDebug then
    Dialog.Message( "Debug", sInString );
    end
    end


    In On Preload section of a given Page, the following instructions are present.
    ShowDebugMessage( "Press OK to continue" );
    ComboBox.ResetContent( "CoBAppName" );
    for i = 1, Table.Count( tAppName ), 1 do
    ComboBox.AddItem( "CoBAppName", tAppName[ i ], "" );
    end


    If ShowDebugMessage is invoked, CoBAppName ComboBox is correctly initialized.
    Vice-versa, if I comment that function, all items of ComboBox are blank!!!
    Why? I just cannot understand.
    I moved around the obstacle using a ListBox instead of a ComboBox (it works!), but I am still curious...

    Thanks to everyone that will try to help me.
  • azmanar
    Indigo Rose Customer
    • Oct 2004
    • 1020

    #2
    Hi,

    Have you tried switching the codes from the Page OnPreload to Page OnShow?
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

    Comment

    • Dermot
      Indigo Rose Customer
      • Apr 2004
      • 1791

      #3
      You can't add items to a ComboBox in the On Preload event. You must do it in the On Show event.
      Dermot

      I am so out of here :yes

      Comment

      • Davide It
        Forum Member
        • Oct 2006
        • 7

        #4
        Dermot, azmanar, you are right!!!

        It just works moving that portion of code from On Preload to On Show event.

        But I can tell you this: since I started learning and using AMS, I am used to write code in On Preload event as much as I can. (The final effect is more elegant, to me.)
        And, believe me, I made a working application in AMS 6 with a similar portion of code in On Preload event!

        That's why I was thinking to a bug of AMS 7...

        Thanks a lot anyway, you guys were very fast!!!

        Comment

        • azmanar
          Indigo Rose Customer
          • Oct 2004
          • 1020

          #5
          Hi Davide,

          I learnt it from Dermot.
          Newbie Examples
          ------> AMS 7.5 : amstudio.azman.info
          ----> AMS 6 & 5: www.azman.info/ams/
          ----> FB: facebook.com/GuideToWealth

          ----> Content Development Blog: www.AZMAN.asia

          Comment

          Working...
          X