<div dir="ltr">Hi Fred Jan,<div><br></div><div><div>When you minimize a patch, It seems that the canvas doesn't send any notification. But when you restore a patch the canvas calls the visible method (with the argument visible 1). So my temporary solution (because the call of the visible function seems also to be platform specific) is to recreate the object's widget each time the function is called (the precedent widget should already be destroyed, you shouldn't have to take care of this).</div><div><br></div><div>I'm going to pull your code and make some tests. It will be easier for me to see if something strange happens.</div><div><br></div><div>Cheers</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-12 12:08 GMT+02:00 Fred Jan Kraan <span dir="ltr"><<a href="mailto:fjkraan@xs4all.nl" target="_blank">fjkraan@xs4all.nl</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Pierre,<br>
<span class=""><br>
> Hi,<br>
>> Currently I invalidate a layer and start by<br>
>> greating a new one. Is this the correct way, or are they reusable in a way?<br>
><br>
> Yes, in fact when you create a layer for the 1st time, the function<br>
> allocates a layer. If the layer already exists but has been invalidated<br>
>  the function returns the old pointer with empty paths. Otherwise, the<br>
> function returns NULL. If you have a "circle_layer" and a<br>
> "rectangle_layer" and you want to change the color or the size of the<br>
> "circle_layer", you have to invalidate the "circle_layer" then when you<br>
> call ebox_draw, you have to redraw the "circle_layer" but you don't have<br>
> to redraw the "rectangle_layer".<br>
<br>
</span>In th emean time, I found the problem with superimposed waveforms is<br>
elsewhere, not the object code. With minimize and restore only the<br>
latest waveform is rendered*. So I expect it is in the Tk or g_canvas<br>
code, as the non-cicm version of wavesel~ has the similar problem (not<br>
properly updating the screen, fixed with minimize and restore the<br>
window). It might be the platform: Xubuntu 14.04 with Tk 8.5.<br>
<span class="">><br>
>> The paint function is called at startup from the framework (via<br>
>> eclass_guiinit?).<br>
><br>
> No, eclass_guiinit initializes the class for GUI behavior (the paint<br>
> function can't be called because there isn't any object allocated).<br>
><br>
>> The redraw function is called when the waveform is changed (manual at<br>
>> the moment).<br>
><br>
> Yes, when you want to change a layer, you have to invalidate this layer<br>
>  (you don't have to invalidate all the layers if some of them don't need<br>
> to be redrawn) and then call ebox_redraw().<br>
><br>
> There's no "redraw", "invalidate", "state" method so<br>
> eclass_addmethod(c, (method) wavesel_invalidate, "invalidate", A_SYMBOL, 0);<br>
> eclass_addmethod(c, (method) wavesel_state, "state", A_NULL, 0);<br>
> eclass_addmethod(c, (method) wavesel_redraw, "redraw", A_NULL, 0);<br>
> are useless methods.<br>
<br>
</span>Not in my object. I try to understand what is happening and why it<br>
doesn't do what I want to, so I cut the proces into small steps and<br>
check the in-between status (this is what state does).<br>
<br>
They are useless in the sense that they have no function in a properly<br>
working object. The object isn't there yet, but in the process of<br>
debugging and adding functionality.<br>
<span class=""><br>
> I think you use the c.blackboard as a template but you should prefer to<br>
> use c.bang or something simpler. c.blackboard is a little bit tricky.<br>
<br>
</span>Yes, I started with c.blackboard but moved elsewhere. c.bang surely has<br>
a lot more comments!<br>
<span class="">><br>
> Now I'll try to explain everything better :<br>
> When the object is allocated in the patch, the method paint is called :<br>
><br>
> static void wavesel_paint(t_wavesel *x, t_object *view)<br>
> {<br>
>     t_rect bg_rect;<br>
>     ebox_get_rect_for_view((t_ebox *)x, &bg_rect);<br>
><br>
>     t_elayer *g = ebox_start_layer((t_ebox *)x, bg_layer_name,<br>
> rect->width, rect->height);<br>
>    if (g)<br>
>   {<br>
>       Here you can draw what you want in the "bg_layer_name" layer.<br>
>      Then you finish your layer with<br>
><br>
>   }<br>
>   ebox_paint_layer((t_ebox *)x, bg_layer_name, 0.f, 0.f);<br>
> }<br>
><br>
<br>
</span>This is more or less what is happening, and it works. Apart from the<br>
update issue described above.<br>
<br>
Currently the waveform is drawn and the layer state is EGRAPHICS_CLOSE<br>
as expected. But after minimize and restore it is EGRAPHICS_TODRAW<br>
again! I cannot see how the paint function causes this.<br>
<br>
I will change the platform and see what happens.<br>
<br>
<br>
Greetings,<br>
<br>
Fred Jan<br>
<br>
*) Somewhere in the code cleanup, the waveform restore doesn't happen<br>
anymore.<br>
</blockquote></div><br></div>