How to remove Close button from window title bar?
Posted: Mon Nov 03, 2014 1:27 am
Greetings,
I think I've found a very irritating "feature" only manifesting on Linux. Hopefully, maybe I'm just doing something wrong, but...
PB 5.31, Ubuntu 12.04

So, if you click on 'x' button on Linux second window, whole program gets terminated. Which is logical, but the bug is actually related to the fact that Close button actually exists in other window; the same button that gets removed by #PB_Window_Tool on Windows/OSX.
This code partially settles the problem:
Is it really impossible to remove Close button in native PureBasic code on Linux?
I think I've found a very irritating "feature" only manifesting on Linux. Hopefully, maybe I'm just doing something wrong, but...
PB 5.31, Ubuntu 12.04
Code: Select all
If OpenWindow(0, 0, 0, 320, 240, "Window 1", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
If OpenWindow(1, 0, 0, 240, 120, "Window 2", #PB_Window_Tool|#PB_Window_WindowCentered,WindowID(0))
DisableWindow(0,1)
SetActiveWindow(1)
ButtonGadget(0, 60, 40, 120, 25, "Close Window 2")
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0 : CloseWindow(1) : DisableWindow(0,0) : SetActiveWindow(0)
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
End
So, if you click on 'x' button on Linux second window, whole program gets terminated. Which is logical, but the bug is actually related to the fact that Close button actually exists in other window; the same button that gets removed by #PB_Window_Tool on Windows/OSX.
This code partially settles the problem:
Code: Select all
If OpenWindow(0, 0, 0, 320, 240, "Window 1", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
If OpenWindow(1, 0, 0, 240, 120, "Window 2", #PB_Window_WindowCentered,WindowID(0))
DisableWindow(0,1)
SetActiveWindow(1)
ButtonGadget(0, 60, 40, 120, 25, "Close Window 2")
EndIf
Repeat
Event = WaitWindowEvent()
Window = EventWindow()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0 : CloseWindow(1) : DisableWindow(0,0) : SetActiveWindow(0)
EndSelect
Case #PB_Event_CloseWindow
If Window = 0
End
ElseIf Window = 1
CloseWindow(1)
DisableWindow(0,0)
SetActiveWindow(0)
EndIf
EndSelect
Until 0
EndIf
End