Creating array of TsButton at runtime

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39257
    Support
    Keymaster

      Hello
      You must be sure that second SkinManager is created and available before creating buttons.
      If is possible to make a little example application for tests then it will be very helpful.

      #39269
      JanK
      Participant

        Thanks, I enclosed an example with all the unnecessary code stripped from my project. In the SkinManagers, you have to set the skindirectory manually, before compiling. Skinmanager 2 is set at design time.

        The generated buttons should have the skin provided by the second skinmanager, and should toggle the “Down” property when pressed.

        Two questions:
        1) How do I get the skinning right?
        2) When the buttons are pressed, a runtime error is generated at formclose?

        Thanks in advance,

        Regards
        Jan

        #39278
        Support
        Keymaster

          Thank you

          You must change this line

          CODE
          buttonsArray[nNumber].SkinData.FSkinManager:=sSkinManager2;

          to

          CODE
          buttonsArray[nNumber].SkinData.SkinManager:=sSkinManager2;


          Skinning data will be updated in this case, and problem must be solved.

          Also I can suggest you to move this line :

          CODE
          buttonsArray[nNumber].Parent:=PanelTags;

          after “Visible:=True;”. And remove “Visible:=True;” because button is visible already when created.

          #39301
          JanK
          Participant

            Thanks Serge, that helped a lot! One character, big change…
            Besides, the access violation I mentioned was raised by the “TsButton.Refresh” method. But that line was also deleted now.

            Regards
            Jan

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.