Hello Rafael,
getcolor( ) was the best source. It led to

xdel()
x=[-1  +1];
winnum=1;   win=string(winnum);
cf=figure(winnum);
plot(x,x)
C=["Green"  "Red"  "Abort"];//case name strings
addmenu(winnum, C(1)); C1="execstr("+C(1)+"_"+win+"(1))"; addmenu(winnum, C(2)); C2="execstr("+C(2)+"_"+win+"(1))";
addmenu(winnum,  C(3));  C3="execstr("+C(3)+"_"+win+"(1))";
while  %t
  [!,!,!,!,cbmenu]=xclick();
  //Get the clicked option by cbmenu
  if  cbmenu==C1,  cf.background=3;  end
  if  cbmenu==C2,  cf.background=5;  end
  if  cbmenu==C3,  break,  end
end

where the necessity of execstr( ) is quite unintuitive to me.

Using uimenu( ) in the alternate script

xdel()
x=[-1  +1];
winnum=1;   win=string(winnum);
cf=figure(winnum);
plot(x,x)
C=["Green"  "Red"  "Abort"];//case name strings
uimenu('label',C(1),'callback','t1=%t');
uimenu('label',C(2),'callback','t2=%t');
uimenu('label',C(3),'callback','t3=%t');
while  1
  t1=%f;t2=%f;t3=%f;
  sleep(100)
  if  t1,  cf.background=3;  end
  if  t2,  cf.background=5;  end
  if  t3==%t,  break,  end
end

does the same andis easier to understand. However it needs the sleep. I could 
not adapt the uimenu( ) approach to xclick in order to avoid the hectic loop.

Kind regards
Jens

-----------------------------------------------------------------------------------------------------------------------------------------
Am 20.12.2016 01:44, schrieb Rafael Guerra:

To me more precise, pls look inside the *.sci function files (edit_curv.sci, etc.)

********

Hi Jens,

Together with Scilab 5 distribution, such "examples" may be found in the following functions:

-plotprofile

-edit_curv

-getcolor

Not sure how easy they are to understand but you may want to let us know.

Rgds,

Rafael

*From:*users [mailto:[email protected]] *On Behalf Of *Jens Simon Strom
*Sent:* Monday, December 19, 2016 12:21 PM
*To:* International users mailing list for Scilab. <[email protected] <mailto:[email protected]>>
*Subject:* [Scilab-users] xclick with output argument cdmenu

Hi Scilab experts,
I am looking for an example where xclickis used with all 5 output arguments including cbmenuto see the interaction with a menu.

The documentation only says /cbmenu//: / /String: callback associated to a menu if xclick returns due to a click on a menu. In this case, ibutton, xcoord, ycoord, and iwin take arbitrary values./

I would like to study an example snippet for the the application of xclickwith cbmenu. By recherche I did not find any. A relevant web link would suffice.

Kind regards
Jens



_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to