User Tools

Site Tools


disabling_20the_20close_20button

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
disabling_20the_20close_20button [2018/03/31 13:19] – external edit 127.0.0.1disabling_20the_20close_20button [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Disabling the close button===== =====Disabling the close button=====
  
-//by Richard Russell, August 2008//\\ \\  It is easy enough to make the close button (in the top-right corner of the window) ineffective, by executing the following statement:\\ \\ +//by Richard Russell, August 2008//\\ \\  It is easy enough to make the close button (in the top-right corner of the window) ineffective, by executing the following statement: 
 + 
 +<code bb4w>
         ON CLOSE RETURN         ON CLOSE RETURN
-This results in the button being ignored. However there may be occasions when you actually want to disable the close button, and indicate that it is disabled by it being 'greyed out'. You can do that as follows:\\ \\ +</code> 
 + 
 +This results in the button being ignored. However there may be occasions when you actually want to disable the close button, and indicate that it is disabled by it being 'greyed out'. You can do that as follows: 
 + 
 +<code bb4w>
         SC_CLOSE = &F060         SC_CLOSE = &F060
         SYS "GetSystemMenu", @hwnd%, 0 TO sysmenu%         SYS "GetSystemMenu", @hwnd%, 0 TO sysmenu%
         SYS "EnableMenuItem", sysmenu%, SC_CLOSE, 1         SYS "EnableMenuItem", sysmenu%, SC_CLOSE, 1
-When you want to enable the button again execute the following code:\\ \\ +</code> 
 + 
 +When you want to enable the button again execute the following code: 
 + 
 +<code bb4w>
         SC_CLOSE = &F060         SC_CLOSE = &F060
         SYS "GetSystemMenu", @hwnd%, 0 TO sysmenu%         SYS "GetSystemMenu", @hwnd%, 0 TO sysmenu%
         SYS "EnableMenuItem", sysmenu%, SC_CLOSE, 0         SYS "EnableMenuItem", sysmenu%, SC_CLOSE, 0
 +</code>
 +
 Note that whereas "ON CLOSE RETURN" also causes **Alt+F4** to be ignored, disabling the close button doesn't, and this alternative means of closing the window remains available. Note that whereas "ON CLOSE RETURN" also causes **Alt+F4** to be ignored, disabling the close button doesn't, and this alternative means of closing the window remains available.
disabling_20the_20close_20button.1522502355.txt.gz · Last modified: 2024/01/05 00:18 (external edit)