Hi Antonio, I was using the map_cb to initialize a lot of stuff for drawing on the canvas and then doing the initial drawing. So I modified it to do just the initializations and the drawing part is handled only by action_cb and resize_cb now. By the time they are called it seems rastersize is properly set so it seems to be working fine now.
Thanks, Milind On Wed, May 27, 2015 at 6:54 AM, Antonio Scuri <sc...@tecgraf.puc-rio.br> wrote: > Ok. Here is what`s going on. > > Since IUP has a dynamic layout there are several "sizes" when using > rastersize. The SIZE attribute documentation and the Guide/Layout > documentation describe them. > > I modified your code a little bit, just for clarity, and there are a few > stages: > > Before map 500x500 - this is the user size (the size the app set), > since the control is not mapped yet > In map_cb nil - this is the current size, since it is mapped, but > the dialog layout was not computed yet > After map 500x500 - this is the current size, and the layout was > computed > > Before 3.14, the layout was computed before the elements were mapped. > This had several side effects. So we changed to do it after all elements > were mapped. But the side effect was that the element current size is nil > during map_cb. > > As an alternative, you can use the map_cb of the dialog, because it is > the only one that is still called after the dialog layout was computed. > > You can consult the USERSIZE in map_cb that will be the initial size you > set for the canvas. But it can be changed when the layout was computed. > > You can use RESIZE_CB, maybe. > > What you are doing in map_cb with rastersize? Maybe there are other > alternatives... > > Best, > Scuri > > > > > > > > On Wed, May 27, 2015 at 10:05 AM, Antonio Scuri <sc...@tecgraf.puc-rio.br> > wrote: > >> Yes, that was the change. >> >> Hum, I don`t know why is reseting to nil. I'm going to take a look at >> the sample and let you know. >> >> Best, >> Scuri >> >> >> On Tue, May 26, 2015 at 5:36 PM, Milind Gupta <milind.gu...@gmail.com> >> wrote: >> >>> Hi Antonio, >>> Previously when I was using iup 3.11 I was not having this >>> issue. The way my code worked was that it called dialog:map() and I had a >>> canvasBox:map_cb() defined which used the rastersize attribute of the >>> canvasBox. >>> I see in the map_cb documentation that there has been a change >>> since 3.14, probably that is what is affecting me. When I debug my main >>> application here is what I see: >>> >>> 1. I create glcanvasbox with an initial rastersize say "50x50" and I >>> print it, it is fine. >>> 2. I create the dialog and then print the rastersize again it is fine >>> "50x50" >>> 3. Now I call dialog:map() >>> 4. This in turn calls canvasBox:map_cb() in which the first statement I >>> have is to print the rastersize. Somehow as soon as it enters map_cb >>> rastersize is set to nil. >>> >>> So to give you a test case I wrote the attached script which shows the >>> problem. If this is the intended behavior then how do I get around it? >>> >>> Thanks, >>> Milind >>> >>> >>> >>> >>> On Tue, May 26, 2015 at 5:18 AM, Antonio Scuri <sc...@tecgraf.puc-rio.br >>> > wrote: >>> >>>> When you create an element its size is not defined. If you not >>>> manually set the size, then it will be available only when the layout of >>>> the dialog is computed. >>>> >>>> The layout is automatically computed when the dialog is shown. If you >>>> need the size before that, then there are alternatives. You can call >>>> IupRefresh to compute the dialog, or you can call IupMap that internally >>>> will call IupRefresh. >>>> >>>> Then size will not return nil/NULL. >>>> >>>> Best, >>>> Scuri >>>> >>>> >>>> On Tue, May 26, 2015 at 4:42 AM, Milind Gupta <milind.gu...@gmail.com> >>>> wrote: >>>> >>>>> Hi, >>>>> I created a glcanvasbox. the rastersize attribute seems to >>>>> be nil when I first access it. In what scenario can the rastersize be nil? >>>>> >>>>> Thanks, >>>>> Milind >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> One dashboard for servers and applications across >>>>> Physical-Virtual-Cloud >>>>> Widest out-of-the-box monitoring support with 50+ applications >>>>> Performance metrics, stats and reports that give you Actionable >>>>> Insights >>>>> Deep dive visibility with transaction tracing using APM Insight. >>>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y >>>>> _______________________________________________ >>>>> Iup-users mailing list >>>>> Iup-users@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/iup-users >>>>> >>>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> One dashboard for servers and applications across Physical-Virtual-Cloud >>>> Widest out-of-the-box monitoring support with 50+ applications >>>> Performance metrics, stats and reports that give you Actionable Insights >>>> Deep dive visibility with transaction tracing using APM Insight. >>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y >>>> _______________________________________________ >>>> Iup-users mailing list >>>> Iup-users@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/iup-users >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Iup-users mailing list >>> Iup-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/iup-users >>> >>> >> > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Iup-users mailing list > Iup-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/iup-users > >
------------------------------------------------------------------------------
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users