[Scilab-users] xcos blocks showing dynamic parameters

MartinUp2 martin.highUp at gmx.net
Tue Nov 19 15:45:41 CET 2013


Hello

My problem seems to be similar to the thread 
http://mailinglists.scilab.org/xcos-blocks-showing-dynamic-parameters-tp4025340.html
but I could not solve it with this information.

My goal is to show some parameters (text and graphs) in the icon of the
block which shall be calculated based on the parameters and updated when
parameters change.
My current, not working, solution looks simplified like following.

-----------------
function [x,y,typ] = MyBlock(job, arg1, arg2)
.........
    disp(job)

    select job
    case "plot" then
        txt = Do something to generate the text which shall be shown.
		standard_draw(arg1);
...............
    case "define" then
...............	
        txt = Do something to generate the text which shall be shown.
        gr_i=['xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');'];
        blockIconDefaultSize = [4, 2];
        x = standard_define(blockIconDefaultSize, model, exprs, gr_i);
        x.graphics.in_label = inport_labels;
        x.graphics.out_label = outport_labels;
        x.graphics.style =
'fillColor=#61bdfc;gradientColor=#61bdfc;rounded=%f;'
................		
    end
endfunction
-----------------

job=”plot” is run while generating the palette and then never again and thus
the icon is created but never updated.  Where can be the problem that
job=”plot” is not run to update the icons? job=”plot” is implemented the
same way in most of the standard blocks I looked at, e.g. CONST.

The solution mentioned in the thread
http://mailinglists.scilab.org/xcos-blocks-showing-dynamic-parameters-tp4025340.html
does not work for me. I need to do some calculation to get the text which is
not directly stored in exprs. Additionally I want to add some graphs to the
block icon.
How can I get something like the CONST block working?  When I make copy of
the CONST block it is not working either.

A related question:
How can I get rid of the box around xstringb() and make it transparent?
The original CONST block does not have that box and is using xstringb() too.

Thanks for help
/ Martin




--
View this message in context: http://mailinglists.scilab.org/xcos-blocks-showing-dynamic-parameters-tp4027839.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list