It is currently Sat Jan 23, 2021 12:24 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Canvas and transparent background gadgets
PostPosted: Fri Apr 17, 2020 11:56 am 
Offline
User
User
User avatar

Joined: Tue Jan 28, 2020 10:17 am
Posts: 69
Hi
Why is the background of the checkbox, option, panel and ... transparent when added to the canvas container?
Is there an easy way to prevent this? like window.

Code:
If OpenWindow(0, 0, 0, 600, 600, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
  SetWindowColor(0,RGB(80,255,255))
 
  ;CheckBoxGadget(1,30,30,100,30,"chk")
  OptionGadget(1,30,30,100,30,"Opt")
 
 
  CanvasGadget(0, 200, 200, 200, 200,#PB_Canvas_Container|#PB_Canvas_Border)
  If StartDrawing(CanvasOutput(0))
    Box(0,0,200,200,RGB(80,255,255))
    StopDrawing()
  EndIf 
 
  ;CheckBoxGadget(2,30,30,100,30,"chk")
  OptionGadget(2,30,30,100,30,"Opt")
 
  CloseGadgetList()
 
  Repeat
   
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

_________________
FlatEarth addresses in PB :
Engine3D --> SkyDome
Mesh --> CreatePlane


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas and transparent background gadgets
PostPosted: Fri Apr 17, 2020 12:55 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6281
Location: Wales, UK
Tested on PB5.72x64, Windows7

You are right FlatEarth! I hope this is intentional because it is of course what we want :)

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas and transparent background gadgets
PostPosted: Fri Apr 17, 2020 2:33 pm 
Offline
User
User
User avatar

Joined: Tue Jan 28, 2020 10:17 am
Posts: 69
Thanks IdeasVacuum,
It could be a bug for CanvasGadget? because it works properly in ContainerGadget.

Code:
If OpenWindow(0, 0, 0, 600, 600, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
  SetWindowColor(0,RGB(80,255,255))
 
  ;CheckBoxGadget(1,30,30,100,30,"chk")
  OptionGadget(1,30,30,100,30,"Opt")
 
 
  ContainerGadget(0, 200, 200, 200, 200)
 
  ;CheckBoxGadget(2,30,30,100,30,"chk")
  OptionGadget(2,30,30,100,30,"Opt")
 
  CloseGadgetList()
 
  SetGadgetColor(0,#PB_Gadget_BackColor, RGB(80,255,255))
  Repeat
   
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

_________________
FlatEarth addresses in PB :
Engine3D --> SkyDome
Mesh --> CreatePlane


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas and transparent background gadgets
PostPosted: Fri Apr 17, 2020 2:36 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jul 23, 2011 1:13 am
Posts: 304
Location: Germany
You really want a non-transparent background for gadgets on Canvas?
Or are you looking for a way to have transparent gadgets on a window?

For the canvas you simply need to draw a box before you place your gadget.

Code:
If OpenWindow(0, 0, 0, 600, 600, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
  SetWindowColor(0,RGB(80,255,255))
 
  ;CheckBoxGadget(1,30,30,100,30,"chk")
  OptionGadget(1,30,30,100,30,"Opt")
 
 
  CanvasGadget(0, 200, 200, 200, 200,#PB_Canvas_Container|#PB_Canvas_Border)
  If StartDrawing(CanvasOutput(0))
        Box(0,0,200,200,RGB(80,255,255))
        
        Box(30,30,100,30,$FFFFFF) ; <-- you would need to get the default window color somehow, if that's what you want.
        
    StopDrawing()
  EndIf
 
  ;CheckBoxGadget(2,30,30,100,30,"chk")
 
 
 
  OptionGadget(2,30,30,100,30,"Opt")
 
  CloseGadgetList()
 
  Repeat
   
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas and transparent background gadgets
PostPosted: Fri Apr 17, 2020 3:54 pm 
Offline
User
User
User avatar

Joined: Tue Jan 28, 2020 10:17 am
Posts: 69
I found this way and it is more suitable for me.
Code:
If OpenWindow(0, 0, 0, 600, 600, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
  SetWindowColor(0,RGB(80,255,255))
 
  CheckBoxGadget(1,30,30,100,30,"chk")
  OptionGadget(2,30,70,100,30,"Opt")

  CanvasGadget(0, 200, 200, 200, 200,#PB_Canvas_Container|#PB_Canvas_Border)
  If StartDrawing(CanvasOutput(0))
    Box(0,0,200,200,RGB(80,255,255))       
    StopDrawing()
  EndIf
 
  CheckBoxGadget(3,30,30,100,30,"chk")
  OptionGadget(4,30,70,100,30,"Opt")
 
  SetWindowTheme_(GadgetID(3),0,@"")
  SetWindowTheme_(GadgetID(4),0,@"")
 
  CloseGadgetList()
 
  Repeat
   
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


@Derren : Thanks for your idea.

_________________
FlatEarth addresses in PB :
Engine3D --> SkyDome
Mesh --> CreatePlane


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas and transparent background gadgets
PostPosted: Fri Apr 17, 2020 4:25 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6281
Location: Wales, UK
With my brief test, the TrackBar Gadget is an obstacle. The Help lists Frame, Checkbox and Option Gadgets as being opaque (Windows OS) but they are not. It also lists Text and Hyperlink Gadgets, but you can change their background colour anyway.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


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

All times are UTC + 1 hour


Who is online

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