Wings 3D Development Forum

Full Version: Add elements to UI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.
Ok. My Erlang is not good, atm Smile
Thanks