Page 2 of 2
Re: Transparency regression in 5.73 B4
Posted: Sat Nov 14, 2020 2:49 pm
by Saki
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.
Re: Transparency regression in 5.73 B4
Posted: Sat Nov 14, 2020 4:36 pm
by BarryG
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
Posted: Sat Nov 14, 2020 4:46 pm
by Saki
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

Re: Transparency regression in 5.73 B4
Posted: Sat Nov 14, 2020 11:30 pm
by Blue
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:
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.
(tested with Beta 4 on Windows 10 x64)
Re: Transparency regression in 5.73 B4
Posted: Sun Nov 15, 2020 1:03 am
by breeze4me
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.
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
Posted: Sun Nov 15, 2020 1:31 am
by BarryG
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.
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.
breeze4me wrote:Anyway, the code below is a workaround.
Doesn't work here - the background is still messed up:

Re: Transparency regression in 5.73 B4
Posted: Sun Nov 15, 2020 7:32 pm
by breeze4me
BarryG wrote:Doesn't work here - the background is still messed up:
Try this one.
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
Posted: Sun Nov 15, 2020 7:44 pm
by Blue
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. [...]
Yes, sorry,
BarryG. I just keep forgetting that there is a 32-bit version of PB.
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.
Re: Transparency regression in 5.73 B4
Posted: Mon Nov 16, 2020 3:15 pm
by Fred
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
Posted: Tue Nov 17, 2020 10:41 am
by BarryG
Okay, I will have to abort the overlapped method and come up with something else. Thanks for looking, Fred.