Page 1 of 1
Transparent textgadget over a panelgadget
Posted: Sun Jul 02, 2006 5:55 pm
by Inf0Byt3
How can I draw a transparent textgadget over a panelgadget with xp style turned on? Here is an image of what i need. BTW, I am using PureColor from Gnozal for the panel headers.

Posted: Sun Jul 02, 2006 7:06 pm
by srod
Uhm, text gadgets by default share the same background colour as the panel gadget and thus are kind of transparent?
Try the following:
Code: Select all
If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
PanelGadget(0, 8, 8, 306, 203)
AddGadgetItem(0, -1, "Sub-Panel 1")
TextGadget(2, 10, 15, 80, 24,"Text")
CloseGadgetList()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Transparent?
If not, I can certainly hack up some code to do it, involving subclassing the static control attached to an individual panel.
Posted: Sun Jul 02, 2006 7:25 pm
by Inf0Byt3
Yes, that's transparent, but when I color the textgadget with gnozal's lib the text gets coloured in that grey colour (like in the image) but the background changes as well (into the system's color) and that's not good. I wanted the background to remain white (as the panel is). If I don't color it as in your code, it's transparent but it's black. I need it to be gray, but still transparent over the panel. I don't know if this is possible though

.
Posted: Sun Jul 02, 2006 7:42 pm
by srod
Yes, I figured that was the case.
Best bet, rather than add a new layer of subclassing (which may not work anyhow in conjunction with his library) is to ask Gnozal to adjust his library. The thing is that, on setting a foreground colour, his library is then forced to replace the default background brush (in the absence of a specified brush) with a new one and he obviously chooses the system colour. You need him either to set a null brush or to choose the same brush as used by the parent control (which is not the panel gadget, but a static control attached to the relevant tab).
The problem is that obtaining the background brush of the parent static control is easy, but you cannot use the PureColor library to set a background brush. You set a colour instead.
The use of this library (excellent as it is) is confudling the issue here.
As I say, the usual approach is a little subclassing of the parent control, but it depends on how Gnozal has set up his PureColor library as to whether this will now work.
Posted: Sun Jul 02, 2006 7:45 pm
by Inf0Byt3
Thanks for the help. I will ask gnozal if he can add this feature.
Posted: Mon Jul 03, 2006 2:27 pm
by gnozal
When using PureCOLOR, if you want a
transparent TextGadget :
- update to latest PureCOLOR version (if applicable)
- use
#PureCOLOR_DontSetBackColor as BackColor and not #PureCOLOR_SystemColor (or -1).
http://www.purebasic.fr/english/viewtop ... &start=225