Clemapfel / Mousetrap.jl

Finally, a GUI Engine made for Julia

Home Page:https://clemens-cords.com/mousetrap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buttons not appearing

mpeters2 opened this issue · comments

MacOS 14
Arm64
Julia 1.10

I tried out the tutorial for pop-up messages from here, but the demo doesn't seem to work. I get a window that pops up, but no buttons.

using Mousetrap

main() do app::Application

    window = Window(app)

    child = Separator()
    message_overlay = PopupMessageOverlay()
    set_child!(message_overlay, child)

    show_message_action = Action("example.show_message", app)
    set_function!(show_message_action, message_overlay) do self::Action, message_overlay::PopupMessageOverlay
        message = PopupMessage("This is a message")
        set_button_label!(message, "OK")
        set_button_action!(message, self)
        show_message!(message_overlay, message)
    end

    button = Button()
    set_opacity!(button, 0)
    set_action!(button, show_message_action)
    push_front!(get_header_bar(window), button)

    set_child!(window, message_overlay)
    present!(window)
end
Screenshot 2024-01-01 at 6 46 48 PM

It seems to me, the button you are searching for should be added to the left side of the headerbar of your window. You cannot see it because its opacity is set to 0. Just delete the line

set_opacity!(button, 0)

Or replace it by

set_opacity!(button, 1.0)

Yes, thank you, this exactly.

The opacity is set to zero but you can still activate the button by clicking it or pressing enter.