Well, I don't know for sure, but I've never stacked gadgets, Windows is very bitchy about that.
The normal way is to write the text into the image, or put a text layer behind the image.
Transparency regression in 5.73 B4
Re: Transparency regression in 5.73 B4
This is about the latest beta not working the same as the latest final. It's not about what I'm doing, but about the fact that a command (SetWindowColor) isn't working the same anymore.
Re: Transparency regression in 5.73 B4
Well, maybe someone else can say something about it.
It's all about the rules of the game.
The parking offender can't say that he hasn't received a ticket ever, why now ?
I would say that the ImageGadget() has no place on the ButtonGadget !
ImageGadget - Demo output, four layers, colored window - Tested 5.73b4 Windows

It's all about the rules of the game.
The parking offender can't say that he hasn't received a ticket ever, why now ?
I would say that the ImageGadget() has no place on the ButtonGadget !
ImageGadget - Demo output, four layers, colored window - Tested 5.73b4 Windows

地球上の平和
Re: Transparency regression in 5.73 B4
It seems to me that you're jumping to the wrong conclusion here !BarryG wrote:I finally got a working snippet to show the problem. Woohoo!
Try this code with 5.72 Final, and with 5.73 Beta 4, using Little John's icon in his first reply:
The problem appears to be linked to the #PB_Button_MultiLine flag. With that flag removed, everything works fine.
(tested with Beta 4 on Windows 10 x64)
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: Transparency regression in 5.73 B4
There seems to be an internal change in drawing. It may be the result of a bug fix rather than a regression.
Anyway, the code below is a workaround.
Tested in PB 5.72/5.73 b4 x64/86.
Anyway, the code below is a workaround.
Tested in PB 5.72/5.73 b4 x64/86.
Code: Select all
;w=OpenWindow(0, 100, 100, 145, 105, "ICO test", #PB_Window_Invisible|#PB_Window_BorderLess)
w=OpenWindow(0, 100, 100, 145, 105, "ICO test", #PB_Window_Invisible|#PB_Window_BorderLess|#PB_Window_Tool)
im=LoadImage(#PB_Any, "d:\test.ico")
ig=ImageGadget(#PB_Any, 16, 16, 16, 16, 0)
SetGadgetState(ig, ImageID(im))
bg=ButtonGadget(#PB_Any, 10, 10, 78, 78, "", #PB_Button_MultiLine|#WS_CLIPSIBLINGS)
hWnd=WindowID(0)
;SetWindowLongPtr_(hWnd,#GWL_EXSTYLE,GetWindowLongPtr_(hWnd,#GWL_EXSTYLE)|#WS_EX_TOOLWINDOW)
SetWindowLongPtr_(hWnd,#GWL_STYLE,GetWindowLongPtr_(hWnd,#GWL_STYLE) & ~#WS_CAPTION)
SetWindowColor(0, GetSysColor_(#COLOR_3DLIGHT)) ; *** This breaks 5.73 Beta 4 ***
ShowWindow_(hWnd,#SW_SHOW)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: Transparency regression in 5.73 B4
It doesn't work here on 32-bit PureBasic 5.73 Beta 4 with #PB_Button_MultiLine removed. Still results in a black background. I need #PB_Button_MultiLine anyway due to long text on the button.Blue wrote:It seems to me that you're jumping to the wrong conclusion here !
The problem appears to be linked to the #PB_Button_MultiLine flag. With that flag removed, everything works fine.
Doesn't work here - the background is still messed up:breeze4me wrote:Anyway, the code below is a workaround.

Re: Transparency regression in 5.73 B4
Try this one.BarryG wrote:Doesn't work here - the background is still messed up:
Code: Select all
#MyApp_OldWndProc = "MyAppOldWndProc"
Procedure ImageGadgetWndProc(hWnd, Message, wParam, lParam)
Protected hBrush, rt.RECT, OldWndProc = GetProp_(hWnd, #MyApp_OldWndProc)
If Message = #WM_ERASEBKGND
hBrush = CreateSolidBrush_(GetSysColor_(#COLOR_3DLIGHT))
;hBrush = CreateSolidBrush_(GetSysColor_(#COLOR_3DHIGHLIGHT))
;hBrush = CreateSolidBrush_(GetWindowColor(0))
If hBrush
GetClientRect_(hWnd, rt)
FillRect_(wParam, rt, hBrush)
DeleteObject_(hBrush)
ProcedureReturn 1
EndIf
EndIf
If Message = #WM_NCDESTROY
RemoveProp_(hWnd, #MyApp_OldWndProc)
EndIf
ProcedureReturn CallWindowProc_(OldWndProc, hWnd, Message, wParam, lParam)
EndProcedure
Procedure MyImageGadget(Gadget, x, y, Width, Height, ImageID, Flags = 0)
Protected Result = ImageGadget(Gadget, x, y, Width, Height, ImageID, Flags)
Protected hWnd
If Result
If Gadget = #PB_Any
hWnd = GadgetID(Result)
Else
hWnd = Result
EndIf
SetProp_(hWnd, #MyApp_OldWndProc, SetWindowLongPtr_(hWnd, #GWLP_WNDPROC, @ImageGadgetWndProc()))
EndIf
ProcedureReturn Result
EndProcedure
w=OpenWindow(0, 100, 100, 145, 105, "ICO test", #PB_Window_Invisible|#PB_Window_BorderLess)
im=LoadImage(#PB_Any, "d:\test.ico")
;ig=ImageGadget(#PB_Any, 16, 16, 16, 16, 0)
ig= MyImageGadget(#PB_Any, 16, 16, 16, 16, 0)
SetGadgetState(ig, ImageID(im))
bg=ButtonGadget(#PB_Any, 10, 10, 78, 78, "", #PB_Button_MultiLine|#WS_CLIPSIBLINGS)
hWnd=WindowID(0)
SetWindowLongPtr_(hWnd,#GWL_EXSTYLE,GetWindowLongPtr_(hWnd,#GWL_EXSTYLE)|#WS_EX_TOOLWINDOW)
SetWindowColor(0, GetSysColor_(#COLOR_3DLIGHT)) ; *** This breaks 5.73 Beta 4 ***
ShowWindow_(hWnd,#SW_SHOW)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: Transparency regression in 5.73 B4
Yes, sorry, BarryG. I just keep forgetting that there is a 32-bit version of PB.BarryG wrote:[...]
It doesn't work here on 32-bit PureBasic 5.73 Beta 4 with #PB_Button_MultiLine removed. Still results in a black background. [...]
At any rate, your reasoning obviously holds water. Something has changed between versions, and a gone bug has reappeared, albeit in a different guise.
Sorry I can't help any further. I admire your determination, though.
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: Transparency regression in 5.73 B4
The problem is you are overlapping gadgets and PureBasic doesn't support this, so things like this can happen. It 'worked', but it was more a side effect than something really wanted. For example, your code also fail with SmartWindowRefresh() activated.
Re: Transparency regression in 5.73 B4
Okay, I will have to abort the overlapped method and come up with something else. Thanks for looking, Fred.