04-11-2016, 10:16 PM (This post was last modified: 04-11-2016, 10:49 PM by ggaliens.)
"Nevermind. I found it. "
I'm sorry. I mis took this to mean "I fixed it" . My bad. I do have some time ... and yes ... there is a trail. Hard day for me (other works). Tired. Sorry. I will keep looking.
This code .... added to wings_dialog ... might have made things BETTER ... more debuggable.
MAYBE. Near line eight hundred sixy something. It make sure ... that what goes to wxStaticText is indeed text. That will mean we can SEE MORE and continue to get to root of problem.
Lines = lists:flatten(io_lib:format("~p", [Lines0])),
Text = wxStaticText:new(Parent, ?wxID_ANY, Lines),
04-11-2016, 11:20 PM (This post was last modified: 04-12-2016, 09:10 PM by ggaliens.)
OK ... a more broad picture of what I did to "see more" ...
Code:
build(Ask, {label, Label, Flags}, Parent, Sizer, In)
when Ask =/= false ->
Limit = proplists:get_value(break, Flags, infinite),
{_,Lines} = wings_text:break_lines([Label], Limit),
Text = wxStaticText:new(Parent, ?wxID_ANY, Lines),
add_sizer(label, Sizer, Text, Flags),
MinSize = case proplists:get_value(min_wsz, Flags, -1) of
Sz when Sz > 0 -> Sz;
Sz ->
case proplists:get_value(width, Flags) of
undefined -> Sz;
Chars ->
{W, _, _, _} = wxWindow:getTextExtent(Parent, "W"),
Chars*W
end
end,
wxSizer:setItemMinSize(Sizer, Text, MinSize, -1),
In;
Now it looks ugly ... but is less of a fail.
And even after that ... I made these changes ... adding lots of lists:flatten(io_lib:format( ) )
To ensure a readable STRING. After this ... I have a very very long session of cutting triangles with not even a dialog popping up.
Code:
handle_error(Ev, Cmd) ->
Key = bindkey(Ev, Cmd),
KeyName =
case Key of
{bindkey,_MODE,KEY_OR_TUPLE} ->
lists:flatten(io_lib:format("~p",[{bindkey,KEY_OR_TUPLE}]));
_ -> lists:flatten(io_lib:format("~p",[Key])) % Prob never happens but OK if does.
end,
CmdStr = cmd_to_string(Cmd),
Msg1 = "Executing the command " ++ CmdStr ++ " bound to the hotkey " ++
KeyName ++ " caused an error.",
Msg2 = "Possible causes:",
Msg3 = "The hotkey was defined in a previous version of Wings,"
" and the command that it refers to has been changed,"
" removed, or renamed in this version of Wings.",
Msg4 = "The hotkey refers to a command in a "
" plug-in that is currently disabled,"
" or to a previous version of a plug-in.",
Msg5 = "A bug in the command itself. Try executing the command"
" from the menu directly (i.e. not through a hotkey) -"
"if it crashes it IS a bug. (Please report it.)",
Msg6 = "Delete Hotkey: " ++ KeyName ++ " or press cancel to avoid any changes",
Qs = {vframe_dialog,
[{label,Msg1}, separator,
{label,Msg2},
{label,Msg3},
{label,Msg4},
{label,Msg5}, separator,
{label,Msg6}],
[{buttons, [ok, cancel], {key, result}}]},
wings_dialog:dialog("Delete HotKey", Qs,
fun([{result, ok}]) -> unbind(Key);
(_) -> ignore
end).