User Tools

Site Tools


simulating_20a_20modal_20dialogue_20box

Differences

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

Link to this comparison view

simulating_20a_20modal_20dialogue_20box [2018/03/31 13:19]
127.0.0.1 external edit
simulating_20a_20modal_20dialogue_20box [2018/04/15 17:30] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Simulating a modal dialogue box===== =====Simulating a modal dialogue box=====
  
-//by Richard Russell, October 2006//\\ \\  Dialogue boxes created using the functions in the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​winlib2|WINLIB2]] library are //​modeless//​ dialogue boxes, that is the main window (and any other dialogue boxes) remain active whilst they are open. If you want to simulate the behaviour of a //modal// dialogue box, which disables the main window whilst it is open, you can do that quite easily.\\ \\  First, explicitly disable your main window immediately after the call to **PROC_showdialog**:​\\ \\ +//by Richard Russell, October 2006//\\ \\  Dialogue boxes created using the functions in the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​winlib2|WINLIB2]] library are //​modeless//​ dialogue boxes, that is the main window (and any other dialogue boxes) remain active whilst they are open. If you want to simulate the behaviour of a //modal// dialogue box, which disables the main window whilst it is open, you can do that quite easily.\\ \\  First, explicitly disable your main window immediately after the call to **PROC_showdialog**:​ 
 + 
 +<code bb4w> ​
         PROC_showdialog(dlg%)         PROC_showdialog(dlg%)
         SYS "​EnableWindow",​ @hwnd%, 0         SYS "​EnableWindow",​ @hwnd%, 0
-Second, explicitly enable your main window immediately before the call to **PROC_closedialog**:​\\ \\ +</​code>​ 
 + 
 +Second, explicitly enable your main window immediately before the call to **PROC_closedialog**:​ 
 + 
 +<code bb4w>
         SYS "​EnableWindow",​ @hwnd%, 1         SYS "​EnableWindow",​ @hwnd%, 1
         PROC_closedialog(dlg%)         PROC_closedialog(dlg%)
-If necessary replace **dlg%** with the appropriate value returned from **FN_newdialog**.\\ \\  It is also wise to re-enable your window on exit or in the event of an error:\\ \\ +</​code>​ 
 + 
 +If necessary replace **dlg%** with the appropriate value returned from **FN_newdialog**.\\ \\  It is also wise to re-enable your window on exit or in the event of an error: 
 + 
 +<code bb4w>
         ON CLOSE SYS "​EnableWindow",​@hwnd%,​1:​PROC_closedialog(dlg%):​QUIT         ON CLOSE SYS "​EnableWindow",​@hwnd%,​1:​PROC_closedialog(dlg%):​QUIT
         ON ERROR SYS "​EnableWindow",​@hwnd%,​1:​PROC_closedialog(dlg%):​....         ON ERROR SYS "​EnableWindow",​@hwnd%,​1:​PROC_closedialog(dlg%):​....
-Generally this is all you will need to do. If you have other open dialogue boxes, and you wish to disable them, you can do so using the same technique, remembering that the dialogue box handle is stored in memory at the address returned from **FN_newdialog**:​\\ \\ +</​code>​ 
 + 
 +Generally this is all you will need to do. If you have other open dialogue boxes, and you wish to disable them, you can do so using the same technique, remembering that the dialogue box handle is stored in memory at the address returned from **FN_newdialog**:​ 
 + 
 +<code bb4w>
         PROC_showdialog(dlg%)         PROC_showdialog(dlg%)
         SYS "​EnableWindow",​ @hwnd%, 0         SYS "​EnableWindow",​ @hwnd%, 0
Line 18: Line 32:
         SYS "​EnableWindow",​ !otherdlg%, 1         SYS "​EnableWindow",​ !otherdlg%, 1
         PROC_closedialog(dlg%)         PROC_closedialog(dlg%)
 +</​code>​
simulating_20a_20modal_20dialogue_20box.txt · Last modified: 2018/04/15 17:30 by richardrussell