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

disabling_20the_20close_20button [2018/03/31 13:19]
127.0.0.1 external edit
disabling_20the_20close_20button [2018/04/16 14:48] (current)
richardrussell Added syntax highlighting
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.txt · Last modified: 2018/04/16 14:48 by richardrussell