It is currently Sat Jul 21, 2018 10:39 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: [SplitterGadget v57b1] Behavior changed from v562?
PostPosted: Sun Jun 03, 2018 5:06 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 2682
Location: Boston, MA
While checking my codebase with v57b1, I noticed my canvas images are cleared on splitter resizes?
Why does the splitter clear my drawn objects, yet resizing the window does not?
Can this automatic repainting of the canvas background color be disabled?
In v562, I did not have to redraw the image?
This code snippet is not completely similar to my larger draws, but it may show the problem.
Code:
OpenWindow(0, 0, 0, 300, 600, "SplitterGadget v57b1 background color?", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
CanvasGadget(1, 0, 0, 0, 0)
CanvasGadget(2, 0, 0, 0, 0)
SplitterGadget(0, 1, 1, 298, 598, 1, 2)
SetGadgetColor(1, #PB_Gadget_BackColor, #White)
SetGadgetColor(2, #PB_Gadget_BackColor, #Green)
StartDrawing(CanvasOutput(1))
Box(0,0,GadgetWidth(1),GadgetHeight(1),#White)  ; Clear canvasgadget
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(5,75,"Move splitter...Where does my box go? :(", #Blue)
RoundBox(5, 5, 50, 50, 5, 5, #Blue)
StopDrawing()
imgCopy = GetGadgetAttribute(1,#PB_Canvas_Image)
CreateImage(5,GadgetWidth(1),GadgetHeight(1))
StartDrawing(ImageOutput(5))
  DrawImage(imgCopy,0,0)
StopDrawing()
StartDrawing(CanvasOutput(2))
  DrawImage(imgCopy,0,0)
StopDrawing()
;FreeImage(5)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: [SplitterGadget v57b1] Behavior changed from v562?
PostPosted: Tue Jun 05, 2018 2:05 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 585
Location: Berlin and Ibiza
You can alternatively use ImageGadget. Then there are no display errors.

_________________
ImageImageImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: [SplitterGadget v57b1] Behavior changed from v562?
PostPosted: Tue Jun 05, 2018 2:25 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 2682
Location: Boston, MA
Yes, but my preference is the event handling and container action with the canvas. Is this a bug or not?

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: [SplitterGadget v57b1] Behavior changed from v562?
PostPosted: Tue Jun 05, 2018 2:33 pm 
Offline
Always Here
Always Here

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7433
Location: Norway
In 5.60 on Linux, I get two white areas from your example. That's because you draw on the canvas before it has been resized by the splitter (seems to require a few event loop iterations). Not sure if this is intentional (probably not, and maybe part of the reason they are adding QT support).

When using:
Code:
CanvasGadget(1, 0, 0, 300, 300)
CanvasGadget(2, 300, 0, 300, 300)
The graphics appear. When moving the splitter over the blue stuff, it disappears. Again, because the canvas becomes too small.

Resizing the window does not affect the size of the canvas unless you manually resize it.


Top
 Profile  
Reply with quote  
 Post subject: Re: [SplitterGadget v57b1] Behavior changed from v562?
PostPosted: Wed Jun 06, 2018 6:58 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 2682
Location: Boston, MA
Thanks for looking Trond.
Can I request this topic be moved to BUG forum?
I thought the intent of the canvas gadget was persistent graphics.
I don't want to redraw because the background color is triggered in v57b1?

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: [SplitterGadget v57b1] Behavior changed from v562?
PostPosted: Wed Jun 06, 2018 7:33 pm 
Offline
Always Here
Always Here

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7433
Location: Norway
The background color doesn't affect it on Linux. It's a case of resizing the canvas to be too small. The graphics are only persistent on the canvas, not outside it if you shrink it.

I imagined this would work, however, on Linux, I can't even move the splitter. Maybe it works on Windows?

Code:
OpenWindow(0, 0, 0, 300, 600, "SplitterGadget v57b1 background color?", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)

ContainerGadget(10, 0, 0, 1, 1)
  CanvasGadget(1, 0, 0, 300, 300)
CloseGadgetList()
ContainerGadget(11, 0, 0, 1, 1)
  CanvasGadget(2, 0, 0, 300, 300)
CloseGadgetList()

SplitterGadget(0, 1, 1, 298, 598, 10, 11)
;SplitterGadget(0, 1, 1, 298, 598, 1, 2)

;SetGadgetColor(1, #PB_Gadget_BackColor, #White)
;SetGadgetColor(2, #PB_Gadget_BackColor, #Green)

StartDrawing(CanvasOutput(1))
Box(0,0,GadgetWidth(1),GadgetHeight(1),#White)  ; Clear canvasgadget
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(5,75,"Move splitter...Where does my box go? :(", #Blue)
RoundBox(5, 5, 50, 50, 5, 5, #Blue)
StopDrawing()
imgCopy = GetGadgetAttribute(1,#PB_Canvas_Image)
CreateImage(5,GadgetWidth(1),GadgetHeight(1))
StartDrawing(ImageOutput(5))
  DrawImage(imgCopy,0,0)
StopDrawing()
StartDrawing(CanvasOutput(2))
  DrawImage(imgCopy,0,0)
StopDrawing()
;FreeImage(5)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow



Top
 Profile  
Reply with quote  
 Post subject: Re: [SplitterGadget v57b1] Behavior changed from v562?
PostPosted: Wed Jun 06, 2018 10:36 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13330
Location: France
moved for investigation


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 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