User Tools

Site Tools


changing_20the_20mdi_20background_20colour

Differences

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

Link to this comparison view

Next revision
Previous revision
changing_20the_20mdi_20background_20colour [2018/03/31 13:19] – external edit 127.0.0.1changing_20the_20mdi_20background_20colour [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Changing the MDI background colour===== =====Changing the MDI background colour=====
  
-// by Richard Russell, March 2007//\\ \\  If your program uses a **Multiple Document Interface**, by means of the [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#mdilib|MDILIB library]], the background of the **MDI client** area is filled with the **COLOR_APPWORKSPACE** system colour, which by default is a mid-grey. Although you can change this colour in Windows Control Panel that will affect all applications, which you probably don't want to do.\\ \\  It is possible to change the **MDI client** background colour just for your program by //subclassing// its window procedure. To do that you can use the following procedure:\\ \\ +// by Richard Russell, March 2007//\\ \\  If your program uses a **Multiple Document Interface**, by means of the [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#mdilib|MDILIB library]], the background of the **MDI client** area is filled with the **COLOR_APPWORKSPACE** system colour, which by default is a mid-grey. Although you can change this colour in Windows Control Panel that will affect all applications, which you probably don't want to do.\\ \\  It is possible to change the **MDI client** background colour just for your program by //subclassing// its window procedure. To do that you can use the following procedure: 
 + 
 +<code bb4w>
         DEF PROCsubclassmdiclient         DEF PROCsubclassmdiclient
         LOCAL E%, M%, O%, P%         LOCAL E%, M%, O%, P%
Line 29: Line 31:
         SYS "SetWindowLong", @hmdi%, -4, M%         SYS "SetWindowLong", @hmdi%, -4, M%
         ENDPROC         ENDPROC
-You should call this procedure immediately after initialising the Multiple Document Interface, as follows:\\ \\ +</code> 
 + 
 +You should call this procedure immediately after initialising the Multiple Document Interface, as follows: 
 + 
 +<code bb4w>
         PROC_initmdi(hWindowMenu%)         PROC_initmdi(hWindowMenu%)
         MDIBkgdCol% = &800000         MDIBkgdCol% = &800000
         PROCsubclassmdiclient         PROCsubclassmdiclient
-The MDI background colour will be set to whatever RGB value you load into **MDIBkgdCol%**, which in the above example is a dark blue.\\ \\  If you want to change the **MDI client** colour whilst your program is running, you will need to use code similar to the following to force the background to be refreshed:\\ \\ +</code> 
 + 
 +The MDI background colour will be set to whatever RGB value you load into **MDIBkgdCol%**, which in the above example is a dark blue.\\ \\  If you want to change the **MDI client** colour whilst your program is running, you will need to use code similar to the following to force the background to be refreshed: 
 + 
 +<code bb4w>
         MDIBkgdCol% = &008000         MDIBkgdCol% = &008000
         SYS "InvalidateRect", @hmdi%, 0, 1         SYS "InvalidateRect", @hmdi%, 0, 1
 +</code>
changing_20the_20mdi_20background_20colour.1522502348.txt.gz · Last modified: 2024/01/05 00:18 (external edit)