Change panel background image with Lua

Home Forums General News and releases Change panel background image with Lua

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #47577
    dasfaker
    Keymaster
      • Topics: 80
      • Replies: 793
      • Total: 873
      • ★★★

      I want to change the background image of a panel, so I’ve tried
      panel:getCanvas():setProperty(“uiPanelImageResource”, “Back2”), but it seems getProperty and setProperty are not available for Canvas.

      #47757
      zeoka
      Participant
        • Topics: 73
        • Replies: 466
        • Total: 539
        • ★★★

        Hello
        did you tried getPropertyString I think yes but who knows

        You can use the panel paint callback it works well and draw an image in it , repaint the canvas when you need you can set color changes as well

        #47957
        dasfaker
        Keymaster
          • Topics: 80
          • Replies: 793
          • Total: 873
          • ★★★

          Yeah, finally I’m using the paint callback, thanks zeoka.

          #64409
          el_rolmo
          Participant
            • Topics: 1
            • Replies: 1
            • Total: 2

            Hi,

            sorry for bumping this thread. I also like to change the panel background image on a button press, but I don’t have a clue how to program that and where to start.

            I would greatly appreciate, if someone could help me out here. How do I use the paint callback and where do I insert the script on the button?

            cheers

            #84936
            dnaldoog
            Participant
              • Topics: 4
              • Replies: 480
              • Total: 484
              • ★★

              The original post goes back a bit, but I also wanted to do this and searched for (what seemed like) hours through the source code until I finally found the solution:

              lua function .def("getPanelEditor", &CtrlrPanel::getPanelEditor) in:

              https://github.com/RomanKubiak/ctrlr/blob/de28dc3ad3591a5832f1e38ce8adabc9369b1011/Source/Lua/CtrlrLuaPanel.cpp


              panel:getPanelEditor():setProperty("uiPanelImageResource","my_replacement_image",true)

              Hope it helps someone!

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘News and releases’ is closed to new topics and replies.
            There is currently 0 users and 53 guests online
            No users are currently active
            Forum Statistics
            Threads: 2,495, Posts: 17,374, Members: 77,605
            Most users ever online was 12 on January 22, 2019 3:47 pm
            Ctrlr