Change panel background image with Lua

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

This topic contains 4 replies, has 4 voices, and was last updated by dnaldoog dnaldoog 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #47577

    dasfaker
    Keymaster
    • Topics: 79
    • Replies: 781
    • Total: 860
    • ★★★

    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
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    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: 79
    • Replies: 781
    • Total: 860
    • ★★★

    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
    dnaldoog
    Participant
    • Topics: 0
    • Replies: 153
    • Total: 153
    • ★★

    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)

You must be logged in to reply to this topic.

There is currently 0 users and 23 guests online
No users are currently active
Forum Statistics
Threads: 2,166, Posts: 15,277, Members: 22,131
Most users ever online was 10 on October 29, 2018 2:54 pm
Do NOT follow this link or you will be banned from the site!