transparent background for label, checkbox, option

Archives Forums/BlitzPlus Programming/transparent background for label, checkbox, option

hub(Posted 2003) [#1]
Hi !
how to set a transparent background for label, checkbox or option gadgets ?

Here the problem :



hub(Posted 2003) [#2]
*bump*

Hi !

Sorry. I need really to know if that is possible. I almost finished my program. I know that I could use xlint gui or another lib to do that. But I chose to use B+ in this project for its GUI capabilities. (i've purchased b+ only for the gui !) I don't understand why you can't change a gadget background or text color... (why only with textareabox ?) This is a basic thing for a Windows gui product !!!

with vb, it's possible to have transparent background for labels, checkbox, radio. Why not with b+ ? Why you can change the gadget font, but not the color ! Mark, could you explain this ???


For labels, i can draw the text directly into the background image with photoshop.

Today, my main problem is to set a transparent background for the radio buttons...

i like b+, it's a great product, but today, I am desperate !!!


Many thanks for your help.


BlitzSupport(Posted 2003) [#3]
I thought it might be possible to work around using userlibs, but it looks like we need access to the WM_CTLCOLORSTATIC message to do this.

As far as I can tell from reading around, for every such message, you have to get the gadget's device context, SetBkMode to TRANSPARENT, colour the text if neccessary using SetTextColor, then release the device context. Looks like you might have to 'SelectObject' a 'GetStockObject (HOLLOW_BRUSH)' into the DC too...

Mark, how about a command that turns on all messages? Better yet, a way to choose 'em, like SetIDCMP (I think) in AmiBlitz...?

(Uh, the short answer is I don't think there's a workaround yet.)


Snarty(Posted 2003) [#4]
There are these, not tested though, but, it maybe what you are looking for.
format_code('
.lib user32.dll
SetWindowLong% (hWnd%,nIndex%,Value%) : "SetWindowLongA"')
Then the call would be to the WS_EX set for nIndex (-20) and set WS_EX_TRANSPARENT (32), you may need to also OR the other WS_EX values to achieve the result required, but I hope this sets you in the right direction.

When I was messing around with this before it did work as expected, but for the life of me can't remember all the flags I included. :)


hub(Posted 2003) [#5]
Thanks snarty, i've tested that

[code]
Win1 = CreateWindow("MyAppli",x,y,420,390,Desktop(),0)
...
SetWindowLong (QueryObject(Win1, 1), -20, 32)

But nothing happen to the controls, no transparent background ! I'm searching information about this into the msdn site, but i've not founded better informations. How to found info about this and the value associated to a WS_ constant ?

Could somebody, can test and post an example code... i'm not familar with userlibs.

Thanks !


BlitzSupport(Posted 2003) [#6]
Snarty, I was trying that before, but had no joy. I found the above information, specific to static controls (ie. lables), after some Googling...


hub(Posted 2003) [#7]


Hope Mark see this topic. It's important to know if exists a solution.

I use b+ for an classic network 2d games, like 'nibbles'. I like Canvas and the power of 2d blitz commands. I can't propose to the final user a classic window design for a game ! Put a skin on the windows give a cool and professional design to your game / application. B+ propose a powered event syst. With this, your code is very clear and readable.

There is not image gadget. Perhaps i should use small canvas to draw the buttons and radios for my game. It's very strange to do this, i don't want code a small gui system inside b+ !!!


hub(Posted 2003) [#8]
i've posted a topic about this into the requests forum.


Snarty(Posted 2003) [#9]
Hiya, the hwnd is actually for the gadget in question ie QueryObject(MyTextfield,1). As you may or may not know all gadgets are windows :)


hub(Posted 2003) [#10]
uhm... ok a gadget is a window ;-)

i've tried with a label, texbox. Not work ! Snarty could you try and post an example code ? I use xp pro. Perhaps it works only with win98se ?


hub(Posted 2003) [#11]
sorry double post ;-)