It is currently Mon Dec 11, 2017 1:25 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: EventType Resize ?
PostPosted: Sat Nov 18, 2017 3:49 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 322
Hi :)

Playing with the new event-type EventType_Resize on canvas, something is not looking good to me ? Can someone shed some lights ? thanks :D

In the below, i am trying to fill the canvas on resize-event, it looks like the reported size GadgetWidth() and GadgetHeight() are not in sync with the canvas internals:
Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
    If StartDrawing(CanvasOutput(g))
        Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
        StopDrawing()
    EndIf
EndProcedure

Procedure fill_callback()
    Protected g = EventGadget()
    If StartDrawing(CanvasOutput(g))
        Debug "fill_callback >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "fill_callback >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        Box(0, 0, OutputWidth(), OutputHeight(), #White)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
        StopDrawing()
    EndIf
EndProcedure

OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
SetWindowColor(0, #Black)

gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)
BindGadgetEvent(gdt, @fill_callback(), #PB_EventType_Resize)

initial_fill(gdt)

Repeat
    Select WaitWindowEvent()
        Case #PB_Event_SizeWindow
            ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
        Case #PB_Event_CloseWindow
            End
    EndSelect
ForEver



edit: i added this cleaning box in fill_callback()


Last edited by said on Sat Nov 18, 2017 3:25 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 10:18 am 
Offline
Enthusiast
Enthusiast

Joined: Tue May 26, 2009 2:11 pm
Posts: 453
Hi!

Try it like this:
Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
    If StartDrawing(CanvasOutput(g))
        Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
        StopDrawing()
    EndIf
EndProcedure

Procedure fill_callback()
    Protected g = EventGadget()
    If StartDrawing(CanvasOutput(g))
        Debug "fill_callback >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "fill_callback >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
        StopDrawing()
    EndIf
EndProcedure
Procedure myResize(); <------ Add this procedure
  ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
EndProcedure

OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
SetWindowColor(0, #Black)

gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)
BindGadgetEvent(gdt, @fill_callback(), #PB_EventType_Resize)
BindEvent(#PB_Event_SizeWindow, @myResize(), 0); <------- Add this

initial_fill(gdt)

Repeat
    Select WaitWindowEvent()
;         Case #PB_Event_SizeWindow; <------- remove these two lines
;             ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
        Case #PB_Event_CloseWindow
            End
    EndSelect
ForEver

_________________
I'm an official dummy!
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 10:47 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 322
Thanks Lord but this doesn't fix the issue :? not on my pc at least

Below code actually fixes the issue, but this is really weird as i need to call ResizeGadget() inside a resize-callback, it should generate an infinite loop but it does not, i dont know why :?:

Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
    If StartDrawing(CanvasOutput(g))
        Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
        StopDrawing()
    EndIf
EndProcedure

Procedure fill_callback()
    Protected g = EventGadget()
    ResizeGadget(g, GadgetX(g), GadgetY(g), GadgetWidth(g),  GadgetHeight(g)) ; << this fixes the issue without cycling!
    If StartDrawing(CanvasOutput(g))
        Debug "fill_callback >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "fill_callback >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        Box(0, 0, OutputWidth(), OutputHeight(), #White)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
        StopDrawing()
    EndIf
EndProcedure

OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
SetWindowColor(0, #Black)

gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)
BindGadgetEvent(gdt, @fill_callback(), #PB_EventType_Resize)

initial_fill(gdt)

Repeat
    Select WaitWindowEvent()
        Case #PB_Event_SizeWindow
            ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
        Case #PB_Event_CloseWindow
            End
    EndSelect
ForEver




Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 11:01 am 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 2853
Hi
Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
    If StartDrawing(CanvasOutput(g))
        Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
        StopDrawing()
    EndIf
EndProcedure

Procedure fill_callback()
    ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10) ; << this fixes the issue without cycling!
    If StartDrawing(CanvasOutput(gdt))
        Debug "fill_callback >>> Width = " + Str(GadgetWidth(gdt)) + "    Height = " + Str(GadgetHeight(gdt))
        Debug "fill_callback >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        Box(0, 0, OutputWidth(), OutputHeight(), #White)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
        StopDrawing()
    EndIf
EndProcedure

OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
SetWindowColor(0, #Black)

gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)
BindEvent(#PB_Event_SizeWindow, @fill_callback())

initial_fill(gdt)

Repeat
    Select WaitWindowEvent()
;         Case #PB_Event_SizeWindow
;             ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
        Case #PB_Event_CloseWindow
            End
    EndSelect
ForEver

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 11:07 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 322
Thanks RASHAD, but you have used the 'working' code :!: with ReszieGadget() inside the resize-callback, try to comment the ReszieGadget() in fill_callback() and it wont work anymore

Is it normal to call ResizeGadget() inside a resize-callback, they should trigger each other indefinitely .... am i missing something ?

edit: you code work, sorry! but this is not really what i need
I need to use #PB_EventType_Resize, this is the purpose of this topic

Said


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 11:21 am 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 2853
PB manual
Quote:
#PB_EventType_Resize : The gadget has been resized


CanvasGadget() is a static how can you notify it while resizing
The action occur after the gadget been resized

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 11:26 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 322
RASHAD wrote:
PB manual
Quote:
#PB_EventType_Resize : The gadget has been resized


CanvasGadget() is a static how can you notify it while resizing
The action occur after the gadget been resized


I fully agree and that's why mu initial code (first post) should work fine but it is not, do you have any idea why ?


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 12:21 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 2853
I do not know which one will suit you better

#1 :
Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
    If StartDrawing(CanvasOutput(g))
        Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
        StopDrawing()
    EndIf
EndProcedure

Procedure winCB()
  ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
EndProcedure

Procedure fill_callback()
  If StartDrawing(CanvasOutput(gdt))
    Debug "fill_callback >>> Width = " + Str(GadgetWidth(gdt)) + "    Height = " + Str(GadgetHeight(gdt))
    Debug "fill_callback >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
    DrawingMode(#PB_2DDrawing_Default)
    RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
    StopDrawing()
  EndIf
EndProcedure

OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
SetWindowColor(0, #Black)

gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)
BindEvent(#PB_Event_SizeWindow,@winCB())
BindGadgetEvent(gdt, @fill_callback(), #PB_EventType_Resize)

initial_fill(gdt)

Repeat
    Select WaitWindowEvent()
           
        Case #PB_Event_CloseWindow       
            End

    EndSelect
ForEver


#2 :
Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
  If StartDrawing(CanvasOutput(g))
      Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
      Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
      DrawingMode(#PB_2DDrawing_Default)
      RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
      StopDrawing()
  EndIf
EndProcedure

Procedure winCB()
  ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
EndProcedure

Procedure fill_callback()
  If StartDrawing(CanvasOutput(gdt))
      Debug "fill_callback >>> Width = " + Str(GadgetWidth(gdt)) + "    Height = " + Str(GadgetHeight(gdt))
      Debug "fill_callback >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
      DrawingMode(#PB_2DDrawing_Default)
      RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
      StopDrawing()
  EndIf
EndProcedure

OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
SetWindowColor(0, #Black)

gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)

initial_fill(gdt)

Repeat
    Select WaitWindowEvent()
        Case #PB_Event_SizeWindow
            ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
           
        Case #PB_Event_CloseWindow       
            End
           
        Case #PB_Event_Gadget
          Select EventGadget()
            Case gdt
              Select EventType()
                Case #PB_EventType_Resize
                    If StartDrawing(CanvasOutput(gdt))
                      Debug "fill_callback >>> Width = " + Str(GadgetWidth(gdt)) + "    Height = " + Str(GadgetHeight(gdt))
                      Debug "fill_callback >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
                      DrawingMode(#PB_2DDrawing_Default)
                      RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
                      StopDrawing()
                    EndIf
              EndSelect
          EndSelect
    EndSelect
ForEver

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 12:27 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10306
Location: Beyond the pale...
It is the way the events are being processed by PB itself in that when the ResizeGadget() in the event loop is being processed (after the user releases the mouse), then the gadget is resized as requested.

However, instead of your resizing event proc being called at the conclusion of the gadget resize, it is being called in the middle! What is happening is that the event proc is being called after the canvas gadget itself has been resized, but BEFORE the embedded image has been resized! This (combined with a slight omission in your code) is causing the problems we are seeing.

In my opinion, this is a bug. However, simply using a dynamic window resizing event proc as Lord used and correcting your omission sorts it out - at least on my system.

Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
    If StartDrawing(CanvasOutput(g))
        Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
        StopDrawing()
    EndIf
EndProcedure

Procedure fill_callback()
  If StartDrawing(CanvasOutput(EventGadget()))
    DrawingMode(#PB_2DDrawing_Default)
    Box(0, 0, OutputWidth(), OutputHeight(), #White) ;THIS ERASES THE PREVIOUS ROUND BOX!
    RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
    StopDrawing()
  EndIf
EndProcedure

Procedure myResize(); <------ Add this procedure
  ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
EndProcedure


OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)
BindEvent(#PB_Event_SizeWindow, @myResize(), 0)
BindGadgetEvent(gdt, @fill_callback(), #PB_EventType_Resize)
initial_fill(gdt)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      End
  EndSelect
ForEver


**EDIT : code corrected - doh!

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 1:03 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 322
@RASAHD thanks a lot for your help, you are always here to suggest new ways :D
@srod thanks a lot for your explanation, this makes sense. Actually my little omission about the box clearing past content is present in my next snippet, i did not want to edit my original code as it still shows clearly the discrepancies between the gadget width/height and the internal drawing image width/height :D

I believe this is a bug, at any point of time, this discrepancy should not be present, as it is right now, i cant see the real use of this new event type: #PB_EventType_Resize :( too bad, it would have helped me saving many resizing handling :!: until it is fixed i will continue using my old tricks which are quite similar to what Lord and you have suggested with thanks :)

Maybe a moderator is willing to move this to the bugs section, thanks

Said


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 1:07 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10306
Location: Beyond the pale...
My code can be foxed by maximizing the window or resizing very fast! I have double checked and the embedded canvas image is simply not being resized before the event is firing.

Definitely a bug.

Personally, until this is fixed I would not bind a resize event to the canvas gadget. Instead, use the resize event procedure for the window and after the ResizeGadget(gdt,...) call, simply call the canvas gadget redraw routine as with the following :

Code:
EnableExplicit
Global gdt

Procedure initial_fill(g)
    If StartDrawing(CanvasOutput(g))
        Debug "initial_fill >>> Width = " + Str(GadgetWidth(g)) + "    Height = " + Str(GadgetHeight(g))
        Debug "initial_fill >>> Drawing-Width = " + Str(OutputWidth()) + "    Drawing-Height = " + Str(OutputHeight())
        DrawingMode(#PB_2DDrawing_Default)
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Green)
        StopDrawing()
    EndIf
EndProcedure

Procedure fill_callback()
  If StartDrawing(CanvasOutput(gdt))
    DrawingMode(#PB_2DDrawing_Default)
    Box(0, 0, OutputWidth(), OutputHeight(), #White) ;THIS ERASES THE PREVIOUS ROUND BOX!
    RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
    StopDrawing()
  EndIf
EndProcedure

Procedure myResize(); <------ Add this procedure
  ResizeGadget(gdt, #PB_Ignore,#PB_Ignore, WindowWidth(0) - 10,  WindowHeight(0) - 10)
  fill_callback()
EndProcedure


OpenWindow(0,0,0, 200, 100, "test", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
gdt = CanvasGadget(#PB_Any, 5,5, 190, 90);, #PB_Canvas_Border)
BindEvent(#PB_Event_SizeWindow, @myResize(), 0)
initial_fill(gdt)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      End
  EndSelect
ForEver


This way you know for definite that the canvas and it's embedded bitmap have both been resized before you repaint. When the bug is fixed it will then be simple to add a suitable canvas resize event proc.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 1:34 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 653
Location: right here
what seems weird though with this problem is that the OutputWidth/Height passed to the actual RoundBox command seems to be correct. Maybe it is screwed later by the final resizing of the image?


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 1:40 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 653
Location: right here
the actual problem seems to be missed: the RoundBox only overdraws, but there is no clearing
Code:
        DrawingMode(#PB_2DDrawing_Default)
        Box(0, 0, OutputWidth(), OutputHeight(), #White) ; <-------------------------------
        RoundBox(0, 0, OutputWidth(), OutputHeight(), 10, 10, #Red)
with the additional Box() command even the code from the very first post works here. :D


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 2:05 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10306
Location: Beyond the pale...
We added that box in previously, but on my system the embedded image resize still lags behind as you can see when you examine OutputWidth() etc. This results in the red rounded box being drawn to the dimensions of the previous resize!

Whether this is the same on all systems I do not know as some events can fire in a different order on different versions of Windows (using Win 7 here).

If, however, #PB_EventType_Resize is sent manually by PB for a canvas gadget (in response to a ResizeGadget()), then this is a PB bug as it is being sent before the embedded bitmap has been resized. I just confirmed by taking a look at the bitmap itself during the resize proc. It has the previous dimensions.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: EventType Resize ?
PostPosted: Sat Nov 18, 2017 2:45 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 653
Location: right here
I'm on Linux and the clearing seems to be enough here. I missed that you already had a Box() in there. Anyway what you described makes sense :) . I already previously tried to PostEvent in the callback and do the drawing in the event loop in the hope that the canvas/image events would have been done by then, but that didn't help.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: netmaestro and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye