URL:
<http://gna.org/patch/?2759>
Summary: Lua wesnoth.set_dialog_markup function
Project: Battle for Wesnoth
Submitted by: exasperation
Submitted on: Sun 26 Jun 2011 03:30:08 PM EDT
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
This patch adds a Lua function (wesnoth.set_dialog_markup) which allows Pango
markup to be enabled/disabled in a GUI2 widget label from Lua.
Testcase:
local T = helper.set_wml_tag_metatable {}
wesnoth.synchronize_choice(function()
local dialog = {
T.tooltip { id = "tooltip_large" },
T.helptip { id = "tooltip_large" },
T.grid {
T.row { T.column {
T.label { id = "test_label", label = "<span
color='#BCB088' size='large'
font-style='italic'>You are victorious!</span>" }
} },
T.row { T.column {
T.toggle_button { id = "test_toggle_button" }
} },
T.row { T.column {
T.button { id = "ok", label = "OK" }
} }
}
}
local function preshow()
local function toggle_callback()
local b = wesnoth.get_dialog_value("test_toggle_button")
wesnoth.set_dialog_markup(b, "test_label")
end
wesnoth.set_dialog_value(false, "test_toggle_button")
wesnoth.set_dialog_callback(toggle_callback,
"test_toggle_button")
end
wesnoth.show_dialog(dialog, preshow)
end)
wiki reference should be added to
http://wiki.wesnoth.org/LuaWML#User_interface
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sun 26 Jun 2011 03:30:08 PM EDT Name: lua_gui_markup.patch Size: 2kB
By: exasperation
<http://gna.org/patch/download.php?file_id=13350>
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?2759>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs