Default taskbar behavior for borderless windows
Posted: Fri Jan 19, 2024 4:21 pm
See: Borderless window but taskbar behaves as normal?
I think it would be good to natively have the same default taskbar behavior for borderless windows like for all other windows.
Or in an other way, for borderless windows, it's currently strange not to have the same behavior as other windows.
Adding the #WS_MINIMIZEBOX style after creating the borderless window is enough.
And for those who don't want to take advantage of the default taskbar behavior, they can easily remove the style:
SetWindowLongPtr_(WindowID(#Window), #GWL_STYLE, GetWindowLongPtr_(WindowID(Window), #GWL_STYLE) &~ #WS_MINIMIZEBOX)
Example with or without default taskbar behavior
I think it would be good to natively have the same default taskbar behavior for borderless windows like for all other windows.
Or in an other way, for borderless windows, it's currently strange not to have the same behavior as other windows.
Adding the #WS_MINIMIZEBOX style after creating the borderless window is enough.
And for those who don't want to take advantage of the default taskbar behavior, they can easily remove the style:
SetWindowLongPtr_(WindowID(#Window), #GWL_STYLE, GetWindowLongPtr_(WindowID(Window), #GWL_STYLE) &~ #WS_MINIMIZEBOX)
Example with or without default taskbar behavior
Code: Select all
If OpenWindow(0, 0, 0, 260, 180, "", #PB_Window_BorderLess | #PB_Window_ScreenCentered)
AddKeyboardShortcut(0, #PB_Shortcut_Escape, 1)
ButtonGadget(0, 20, 20, 220, 100, "Add Minimize Box", #PB_Button_Toggle)
TextGadget(1, 20, 130, 220, 40, "Borderless window does not use the default taskbar buttons behavior", #PB_Text_Center)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Menu
If EventMenu() = 1
Break
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case 0
If GetGadgetState(0)
SetWindowLongPtr_(WindowID(0), #GWL_STYLE, GetWindowLongPtr_(WindowID(0), #GWL_STYLE) | #WS_MINIMIZEBOX)
SetGadgetText(0, "Remove Minimize Box")
SetGadgetText(1, "Borderless window using default taskbar button behavior ")
Else
SetWindowLongPtr_(WindowID(0), #GWL_STYLE, GetWindowLongPtr_(WindowID(0), #GWL_STYLE) &~ #WS_MINIMIZEBOX)
SetGadgetText(0, "Add Minimize Box")
SetGadgetText(1, "Borderless window does not use the default taskbar buttons behavior")
EndIf
EndSelect
EndSelect
ForEver
EndIf