[Scilab-users] How to keep figure active with x_mdialog window open?

Rafael Guerra jrafaelbguerra at hotmail.com
Tue Jul 24 15:39:24 CEST 2018


Iza,

Glad that you solved your problem.
In my case, your example works in standalone only (as previous attempts).
However, when I place the code in my larger script with loops and a few graphical windows open, it does not work.
The output vector 'a' remains empty and a warning is issued: " 'Value' property does not exist for this handle. "

Regards,
Rafael 

-----Original Message-----
From: users <users-bounces at lists.scilab.org> On Behalf Of Izabela Wójcik-Grzaba
Sent: Tuesday, July 24, 2018 2:41 PM
To: Users mailing list for Scilab <users at lists.scilab.org>
Subject: Re: [Scilab-users] How to keep figure active with x_mdialog window open?

I think I've got something that works fine for me. I slightly changed 
and added something new to Rafael's code:

// START OF CODE
stringmat = ["ITEM1";"ITEM2";"ITEM3";"ITEM4"];

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
"Callback","list_values",..
"Tag", "example_listbox");

// Exit application
h0=uicontrol(f, "Position", [15 15 160 25],...
"Style", "pushbutton",...
"String", gettext("EXIT"),...
"FontSize", 11,...
"Callback", "closing");

// Callback functions
global a; a=[];
function list_values()
       global a
       a=[a;gcbo().value]
endfunction

function closing()
     ch=gcbo();
     close(ch.parent);
endfunction

// END OF CODE

In the vector "a" there are the numbers of items chosen from the list.

Iza
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list