Wings 3D Development Forum
Add elements to UI - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Programming (https://www.wings3d.com/forum/forumdisplay.php?fid=7)
+--- Thread: Add elements to UI (/showthread.php?tid=347)



Add elements to UI - povmaniac - 06-15-2013

Because it is so complicated to add new elements to the interface, due to 'split_list'.
Is there no a better system of doing this (in Erlang)?
Code:
export_dialog_loop({Op,Fun}=Keep, Attr) ->
    {Prefs,Buttons} = split_list(Attr, 79), %% povman: add index?? old value 78
    case Buttons of
        [true,false,false] -> % Save
            set_user_prefs(Prefs),
            {dialog,
             export_dialog_qs(Op, Attr),
             export_dialog_fun(Keep)};
        [false,true,false] -> % Load
            {dialog,
             export_dialog_qs(Op,
                              get_user_prefs(export_prefs())
                              ++[save,load,reset]),
             export_dialog_fun(Keep)};
        [false,false,true] -> % Reset
            {dialog,
             export_dialog_qs(Op,
                              export_prefs()++[save,load,reset]),
             export_dialog_fun(Keep)};
        [false,false,false] -> % Ok
            Fun(Prefs)
    end.

Or there...

Code:
%%% Increase split_list # +1 per line if add Modulator to Dialog

modulator(Minimized, Enabled, Mode, Res0, M) ->
    {Res1,Res} = split_list(Res0, 39), % org : 37
    TypeTag = {?TAG,type,M},
    {value,{TypeTag,TexType}} = lists:keysearch(TypeTag, 1, Res1),
....

Smile


RE: Add elements to UI - micheus - 06-17-2013

povmaniac, I'm not sure I can help you with this, but have you took a look in the Ask dialogs examples (wpc_test_ask.erl) at /wings/plugin_src?
There is an sample about add components dynamically: dynamic_dialog/1
Maybe it can help you.

You also can load the module by typing at the Erlang console (after you start your Wings3d):
Code:
1>  wpc_test_ask:enable().
-----
2>  wpc_test_ask:disable().
don't forget the [dot] at the end of line.


RE: Add elements to UI - povmaniac - 06-17-2013

Ok. My Erlang is not good, atm Smile
Thanks