There are problems of conglutination with the main output characters when click "confirm" or "cancel" of utils.msgbox, utils.choose and utils.listbox within a miniwin. The problems of conglutination lead to pause of the main output window.
I found out the version of 4.73 is ok and the problems become more and more serious since 4.74. I write a complete test code formated plugin to demonstrate it.
I found out the version of 4.73 is ok and the problems become more and more serious since 4.74. I write a complete test code formated plugin to demonstrate it.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="BugTest"
author="WSW"
id="5c589f1ca4fd208978a46254"
language="Lua"
purpose="BugTest"
date_written="2016-02-02 18:22:02"
requires="4.73"
version="1.0"
>
</plugin>
<script>
<![CDATA[
win = "BugTest"
function OnPluginInstall()
ColourNote("white", "maroon", "Bug Test For utils.msgbox, utils.choose and utils.listbox")
WindowCreate(win, 0, 0, 412, 250, 6, 0, ColourNameToRGB("turquoise"))
WindowFont(win, "f", "宋体", 9, true, false, false, false)
make_button1()
make_button2()
make_button3()
WindowShow(win, true) -- show it
end
make_button1 = function()
if not button1_flag then
make_bt_off(10, 30, 70, 70, "lightgreen", "button1", "darkgreen", "button1_down", "button1_down", "click to test the func of utils.msgbox", "button1_up")
else
make_bt_on(10, 30, 70, 70, "coral", "button11", "darkred", "button1_up", "button1_up", "click to test the func of utils.msgbox", "button1_down")
end
end
make_button2 = function()
if not button2_flag then
make_bt_off(80, 30, 140, 70, "lightgreen", "button2", "darkgreen", "button2_down", "button2_down", "click to test the func of utils.choose", "")
else
make_bt_on(80, 30, 140, 70, "coral", "button22", "darkred", "button2_up", "button2_up", "click to test the func of utils.choose", "")
end
end
make_button3 = function()
make_bt_off(150, 30, 210, 70, "lightgreen", "button3", "darkgreen", "button3_down", "button3_down", "click to test the func of utils.listbox", "")
end
button1_down = function()
button1_flag = true
make_button1()
Redraw()
utils.msgbox("Continue?", "Question", "yesno", "?")
end
button1_up = function()
button1_flag = false
make_button1()
Redraw()
utils.msgbox("You finish the test of utils.msgbox")
end
button2_down = function()
button2_flag = true
make_button2()
Redraw()
local _job_name = {"idle", "beginner"}
utils.choose("Please choose one of your jobs:", "jobs...", _job_name, 1)
button2_flag = false
make_button2()
Redraw()
end
button3_down = function()
local _available = {
n = "North",
s = "South",
e = "East",
w = "West",
u = "Up",
d = "Down",
ne = "Northeast",
sw = "Southwest",
nw = "Northwest",
se = "Southeast",
['in'] = "In",
out = "Out",
} -- end of available
local _chosen_exit = utils.listbox("Choose exit to add", "Exits ...", _available )
if not chosen_exit then
return
end
end
make_bt_off = function(left, top, right, bottom, fillcolor, text, textcolor, hs_name, hs_script, hs_hint, hs_remove)
WindowRectOp(win, miniwin.rect_draw_edge, left,top,right,bottom,
miniwin.rect_edge_raised,
miniwin.rect_edge_at_all +
miniwin.rect_option_fill_middle)
WindowRectOp(win, miniwin.rect_fill, left+2, top+2, right-2, bottom-2,
ColourNameToRGB(fillcolor))
local textheight = WindowFontInfo(win, "f", 1)
local textwidth = WindowTextWidth(win, "f", text)
local tex_top_dev = top+((bottom-top)-textheight)/2
local tex_left_dev = left+((right-left)-textwidth)/2
WindowText(win, "f",
text,
tex_left_dev, tex_top_dev, right-2, bottom-2,
ColourNameToRGB (textcolor),
false)
WindowDeleteHotspot (win, hs_remove)
WindowAddHotspot(win, hs_name,
left+2, top+2, right-2, bottom-2,
"",
"",
hs_script,
"",
"",
hs_hint,
miniwin.cursor_hand, 0) -- hand cursor
end
make_bt_on = function(left, top, right, bottom, fillcolor, text, textcolor, hs_name, hs_script, hs_hint, hs_remove)
WindowRectOp(win, miniwin.rect_draw_edge, left, top, right, bottom,
miniwin.rect_edge_sunken,
miniwin.rect_edge_at_all + miniwin.rect_option_fill_middle)
WindowRectOp(win, miniwin.rect_fill, left+2, top+2, right-2, bottom-2,
ColourNameToRGB(fillcolor))
local _textheight = WindowFontInfo(win, "f", 1)
local _textwidth = WindowTextWidth(win, "f", text)
local _tex_top_dev = top + ((bottom-top)-_textheight)/2
local _tex_left_dev = left + ((right-left)-_textwidth)/2
WindowText(win, "f",
text,
_tex_left_dev, _tex_top_dev, right-2, bottom-2,
ColourNameToRGB (textcolor),
false)
WindowDeleteHotspot(win, hs_remove)
WindowAddHotspot(win, hs_name,
left+2, top+2, right-2, bottom-2,
"",
"",
hs_script,
"",
"",
hs_hint,
miniwin.cursor_hand, 0) -- hand cursor
end
]]>
</script>
</muclient>