lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Well,

What I would like to have : here is with label button but I would like the same construct with stock ones. :

local window = Gtk.Window {
    has_resize_grip = true,
    window_position = Gtk.WindowPosition.MOUSE,    -- put it under to mouse
    child = Gtk.Button{
        label = "_hello",
        use_underline = true,
        _on_clicked_ = function () print("Click !") end
    },
    _on_destroy_ = Gtk.main_quit
}

Solution #1 : It's working as well, but I don't find a way to update other parameters ( id, on_clicked ) :

local window = Gtk.Window {
    has_resize_grip = true,
    window_position = Gtk.WindowPosition.MOUSE,    -- put it under to mouse
    child = Gtk.Button.new_from_stock ( 'gtk-yes' ),
    _on_destroy_ = Gtk.main_quit
}

Solution #2 : forully working, but not as smart as I would like :

local window = Gtk.Window {
    title = 'my first empty window',
    default_width = 400,
    default_height = 300,
    has_resize_grip = true,
    window_position = Gtk.WindowPosition.MOUSE,    -- put it under to mouse
    _on_destroy_ = Gtk.main_quit
}

local btn = Gtk.Button.new_from_stock ( 'gtk-yes' )
btn._on_clicked_ = function () print("Click !") end
window.child = btn

So, if someone has a better idea :)

Bye

Laurent