Hi Izabela and Samuel, I have followed Samuel's awesome offline advice to try using the gcbo() function to retrieve the lost callback handle. The improved code below now seems to work like a charm, regardless of where I place it within a larger Scilab program/loop.
// START OF CODE stringmat = ["ITEM1";"ITEM2";"ITEM3";"ITEM4"]; function nn=save_exit() nn = gcbo().Userdata.hlist.value; delete(get("SELECT MULTIPLE ITEMS")); endfunction w = 300; // width and height in pixels h = 900; max0 = max(size(stringmat)); stringmat = string((1:max0)') + repmat(" - ",max0,1) + stringmat; // Create a figure f = figure("figure_name", gettext("SELECT MULTIPLE ITEMS"),... "infobar_visible", "off",... "toolbar_visible", "off",... "dockable", "off",... "menubar", "none",... "default_axes", "off", ... "Position",[100 100 w h],... "resize", "off",... "BackgroundColor", [0.9 0.9 0.9],... "Tag", "SELECT MULTIPLE ITEMS"); // display list h_list = uicontrol(f, "Position", [15 45 w-20 h-50],.. // -20 to allow space for scroll bar "Style", "listbox",... "FontSize", 11,... "String", stringmat,... "BackgroundColor", [1 1 1],... "Max", max0,... //if Max>1 then allowed multiple selection "Tag", "colors_listbox"); // Exit application h0=uicontrol(f, "Position", [15 15 160 25],... "Style", "pushbutton",... "String", gettext("SAVE & EXIT"),... "FontSize", 11,... "Callback", "h0.Userdata.hlist=h_list; nn=save_exit();"); // END OF CODE Thanks a lot Samuel, this is a really useful functionality. Kind regards, Rafael _______________________________________________ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users