Disable close button in windows

Hi everybody,
to make sure the user waits for a specific thread to complete, I’m in the need of preventing him to close the window the threads starts from.
It seems those buttons to be read-only…
I’m unable to find infos online, any help please? :slight_smile:

Use a different window shape or unset the close at Design time ?

[quote=446417:@Riccardo Santato]Hi everybody,
to make sure the user waits for a specific thread to complete, I’m in the need of preventing him to close the window the threads starts from.
It seems those buttons to be read-only…
I’m unable to find infos online, any help please? :-)[/quote]
This is what the Window.CancelClose event is for.

@Riccardo Santato —

On macOS, you can change the state of the close button with the following:

[code]declare function StandardWindowButton lib CocoaLib selector “standardWindowButton:” (wnd as integer, type as integer) as Ptr
declare sub SetEnabled lib CocoaLib selector “setEnabled:” (ctrl as Ptr, enabled as boolean)

const NSWindowCloseButton = 0

SetEnabled( StandardWindowButton( me.TrueWindow.Handle, NSWindowCloseButton ), false ) //Disable button
// Pass true to enable the button[/code]