It is currently Wed Nov 13, 2019 7:08 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: 5.70 & 5.71b1 - Gadgets inside Canvas Container
PostPosted: Wed Apr 17, 2019 8:16 am 
Online
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 500
When gadgets are inside a CanvasGadget container that is within a ContainerGadget, their display gets messed up when the CanvasGadget is resized.
Code:
Enumeration
  #Container
  #Canvas
  #String
  #Button
  #ListIcon
EndEnumeration

Procedure DrawCanvas()
  If StartDrawing(CanvasOutput(#Canvas))
    Box(0, 0, OutputWidth(), OutputHeight(), RGB(220, 220, 220))
    DrawingMode(#PB_2DDrawing_Transparent)
    DrawText(10, 60, "Hello World")
    StopDrawing()
  EndIf
EndProcedure

Procedure OnWindowSized()
  ResizeGadget(#Container, #PB_Ignore, #PB_Ignore, WindowWidth(0), WindowHeight(0))
EndProcedure

Procedure OnContainerResized()
  ResizeGadget(#Canvas, #PB_Ignore, #PB_Ignore, GadgetWidth(#Container), GadgetHeight(#Container))
  DrawCanvas()
EndProcedure

If OpenWindow(0, 0, 0, 640, 480, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
 
  BindEvent(#PB_Event_SizeWindow, @OnWindowSized(), 0)
 
  ContainerGadget(#Container, 0, 0, 640, 480)
  CanvasGadget(#Canvas, 0, 0, GadgetWidth(#Container), GadgetHeight(#Container), #PB_Canvas_Container)
  StringGadget(#Button, 10, 10, 25, 25, "...")
  ListIconGadget(#ListIcon, 10, 40, 200, 250, "One", 100)
  AddGadgetItem(#ListIcon, -1, "Item")
  CloseGadgetList()
  CloseGadgetList()
 
  BindGadgetEvent(#Container, @OnContainerResized(), #PB_EventType_Resize)
 
  PostEvent(#PB_Event_Gadget, 0, #Container, #PB_EventType_Resize)
 
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


Last edited by wombats on Wed Apr 17, 2019 6:30 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: 5.70 & 5.71b1 - Gadgets inside Canvas Container
PostPosted: Wed Apr 17, 2019 11:34 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 13, 2010 3:45 pm
Posts: 920
Take out the container gadget and it will work.

Before posting to the bug forum, you should create a code that contains only the most necessary code:
- What is the container gadget for?
- What is the splitter gadget for?
- What is the image for?
- ...

It would be even better if you generally post in the question forum before.

@Any Mod
Please move this thread out from the bug forum

_________________
sorry for my bad english


Top
 Profile  
Reply with quote  
 Post subject: Re: 5.70 & 5.71b1 - Gadgets inside Canvas Container
PostPosted: Wed Apr 17, 2019 12:13 pm 
Online
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 500
This is the smallest example I could produce of the situation I encountered. I consider it a bug because it works fine on macOS and the documentation does not say you cannot use a CanvasGadget as a container within a ContainerGadget.

The image and reference to a gadget with the ID #Splitter were left in by mistake and I have removed them.

Josh wrote:
It would be even better if you generally post in the question forum before.
I did: viewtopic.php?f=13&t=72663. Further tests after that made me suspect the demonstrated behaviour is a bug.


Last edited by wombats on Wed Apr 17, 2019 6:31 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: 5.70 & 5.71b1 - Gadgets inside Canvas Container
PostPosted: Wed Apr 17, 2019 12:19 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 13, 2010 3:45 pm
Posts: 920
I am out of this thread. If the introductory posting is changed afterwards, any further discussion is pointless for me.

_________________
sorry for my bad english


Top
 Profile  
Reply with quote  
 Post subject: Re: 5.70 & 5.71b1 - Gadgets inside Canvas Container
PostPosted: Wed Apr 17, 2019 12:43 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2022
Location: Germany
Confirm on window and linux. No problem on macOS

For windows
Code:
Procedure OnContainerResized()
  ResizeGadget(#Canvas, #PB_Ignore, #PB_Ignore, GadgetWidth(#Container), GadgetHeight(#Container))
  DrawCanvas()
  UpdateWindow_(GadgetID(#Canvas))
EndProcedure


Linux not work :(
Code:
Procedure OnContainerResized()
  ResizeGadget(#Canvas, #PB_Ignore, #PB_Ignore, GadgetWidth(#Container), GadgetHeight(#Container))
  DrawCanvas()
  gtk_widget_queue_draw_(GadgetID(#Canvas))
  While (g_main_context_pending_(0))
    g_main_context_iteration_(0,#False)
  Wend
EndProcedure

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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