Transparent Container Gadget
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
Transparent Container Gadget
Is it possible to make a ContainerGadget Transparent?
I've tried using the excellent PureColor lib
PureCOLOR_SetGadgetColor ( gn, #PureCOLOR_SystemColor , #PureCOLOR_DontSetBackColor )
But container shows up as white
cheers
KingLestat
I've tried using the excellent PureColor lib
PureCOLOR_SetGadgetColor ( gn, #PureCOLOR_SystemColor , #PureCOLOR_DontSetBackColor )
But container shows up as white
cheers
KingLestat
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: Transparent Container Gadget
Iirc #PureCOLOR_DontSetBackColor only works with Text/Option/CheckBox gadgets, and if XP Themes are disabled.kinglestat wrote:Is it possible to make a ContainerGadget Transparent?
I've tried using the excellent PureColor lib
PureCOLOR_SetGadgetColor ( gn, #PureCOLOR_SystemColor , #PureCOLOR_DontSetBackColor )
But container shows up as white
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
If you're not going to be moving the gadgets around on the container you can apply a region to it:
The window is colored white to show that those portions of the container not holding a gadget are invisible. If this were not the case the container would show as a big gray box. Comment out the SetWindowRgn_() to see.
Code: Select all
Procedure ScanRegion(image)
Protected width, height
width = ImageWidth(image)
height = ImageHeight(image)
hRgn = CreateRectRgn_(0, 0, Width, Height)
StartDrawing(ImageOutput(image))
For y=0 To ImageHeight(image)
For x=0 To ImageWidth(image)
color = Point(x,y)
If color = #Black
hTmpRgn = CreateRectRgn_(x,y,x+1,y+1)
CombineRgn_(hRgn, hRgn, hTmpRgn, #RGN_XOR)
DeleteObject_(hTmpRgn)
EndIf
Next
Next
StopDrawing()
ProcedureReturn hRgn;
EndProcedure
CreateImage(0, 320, 240, 24)
startdrawing(ImageOutput(0))
Box(10,10,100,20,#White)
Box(120,10,50,20,#White)
stopdrawing()
mainrgn = ScanRegion(0)
OpenWindow(0,0,0,320,240,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
setwindowcolor(0, #White)
CreateGadgetList(WindowID(0))
ContainerGadget(0, 10,10,300,220)
StringGadget(1,10,10,100,20,"")
ButtonGadget(2,120,10,50,20,"OK")
CloseGadgetList()
SetWindowRgn_(GadgetID(0),mainrgn,1)
Repeat:Until WaitWindowEvent()=#WM_CLOSE
BERESHEIT
Nice one netty.
I can't help feel that the following really shouldn't work, or at least should throw up certain problems, but...
I can't help feel that the following really shouldn't work, or at least should throw up certain problems, but...
Code: Select all
Global gOldProc
Procedure ContainerProc(hWnd,Msg,wParam,lParam)
Protected wHdc
Select Msg
Case #WM_ERASEBKGND
result = 0
Default
result=CallWindowProc_(gOldProc, hWnd, Msg, wParam, lParam)
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0,0,0,320,240,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
SetWindowColor(0, #White)
CreateGadgetList(WindowID(0))
ContainerGadget(0, 10,10,300,220)
StringGadget(1,10,10,100,20,"")
ButtonGadget(2,120,10,50,20,"OK")
CloseGadgetList()
gOldProc=SetWindowLong_(GadgetID(0), #GWL_WNDPROC, @ContainerProc())
Repeat:Until WaitWindowEvent()=#WM_CLOSE
I may look like a mule, but I'm not a complete ass.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Ha. OK, I for some reason didn't think that would work so I didn't try it. But, if it does work, then this should work too:
Which is just one extra line of code. You don't even have to delete the brush at the end because it's a stock object!
Code: Select all
OpenWindow(0,0,0,320,240,"",$CF0001)
SetWindowColor(0, #White)
CreateGadgetList(WindowID(0))
ContainerGadget(0, 10,10,300,220)
StringGadget(1,10,10,100,20,"")
ButtonGadget(2,120,10,50,20,"OK")
CloseGadgetList()
SetClassLong_(GadgetID(0),#GCL_HBRBACKGROUND,GetStockObject_(#NULL_BRUSH))
Repeat:Until WaitWindowEvent()=#WM_CLOSE
BERESHEIT
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
Good point guys
I havent tried what you posted but what I am trying to do is the following
I have multiple screens which I flip with buttons
each screen is on a container gadget
with some help (on this forum) its working
But I wanted to have a common backround image
this is what I have
ghBrushBack = CreatePatternBrush_ ( Image4 )
ContainerGadget ( #MDIOptions, 0, #CONTAINER_Y, #CONTAINER_SIZEX, #CONTAINER_SIZEY )
SetClassLong_ ( GadgetID ( GadNUM ), #GCL_HBRBACKGROUND, ImgBrush )
InvalidateRect_ ( GadgetID ( GadNUM ), 0 ,1 )
the problem with this is that the buttons at top (I am using CreateTB ( 0, hwnd, 64, 64, #TBpro_TRANSPARENT ) ) look butt ugly. So I am trying to use
SetWinBackgroundImage ( gWindowID, Image4 )
But the containergadget looks grey
My reasoning is if the ContainerGadget is transparent, the background image comes out
I apologize I didnt mention this earlier
Didnt really cross my mind...considering you guys know bloody everything anyway!!
KingLestat
I havent tried what you posted but what I am trying to do is the following
I have multiple screens which I flip with buttons
each screen is on a container gadget
with some help (on this forum) its working
But I wanted to have a common backround image
this is what I have
ghBrushBack = CreatePatternBrush_ ( Image4 )
ContainerGadget ( #MDIOptions, 0, #CONTAINER_Y, #CONTAINER_SIZEX, #CONTAINER_SIZEY )
SetClassLong_ ( GadgetID ( GadNUM ), #GCL_HBRBACKGROUND, ImgBrush )
InvalidateRect_ ( GadgetID ( GadNUM ), 0 ,1 )
the problem with this is that the buttons at top (I am using CreateTB ( 0, hwnd, 64, 64, #TBpro_TRANSPARENT ) ) look butt ugly. So I am trying to use
SetWinBackgroundImage ( gWindowID, Image4 )
But the containergadget looks grey
My reasoning is if the ContainerGadget is transparent, the background image comes out
I apologize I didnt mention this earlier
Didnt really cross my mind...considering you guys know bloody everything anyway!!
KingLestat
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Har har! Good one!is there a voice recognition library available??

Certainly one of the hardest things to program. There aren't any libraries that would achieve a reliable voice recognition. And believe me, not even Micro$oft can do it right:
http://www.youtube.com/watch?v=2Y_Jp6PxsSQ

Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact: