Created
January 19, 2016 19:42
-
-
Save ttetley/835d3829a2989faffd7b to your computer and use it in GitHub Desktop.
Template to set background color on Clarion appFrame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TEMPLATE( PDSFrame, 'Application frame background color' ), FAMILY('ABC') | |
#EXTENSION (AppFrameBGcolor, 'Set the background color of the application frame'), PROCEDURE | |
#Declare (%FrameBGColor,LONG) | |
#SHEET | |
#TAB ('Specify background color for application frame') | |
#Prompt ('Background color:',color),%FrameBGColor | |
#DISPLAY ('') | |
#DISPLAY ('Specify an equate name, a Hex value, or use the button') | |
#DISPLAY ('(Do Not select from the "Standard Colors" drop list!)') | |
#DISPLAY ('("Color:None" will produce a black background)') | |
#DISPLAY ('') | |
#DISPLAY ('This template works on the application frame only'),PROP(PROP:FontColor,0000080H) | |
#DISPLAY ('') | |
#ENDTAB | |
#ENDSHEET | |
#AT (%GlobalMap) | |
Module('win32.lib') | |
PDSGetClassLong(LONG thehWnd,LONG theIndex),LONG,PASCAL,NAME('GetClassLongA') | |
PDSSetClassLong(LONG thehWnd,LONG theIndex,LONG theNewValue),LONG,PROC,PASCAL,NAME('SetClassLongA') | |
PDSCreateSolidBrush(LONG TheColor),LONG,PASCAL,NAME('CreateSolidBrush') | |
PDSDeleteObject(LONG theObject),LONG,PROC,PASCAL,NAME('DeleteObject') | |
End | |
#ENDAT | |
#AT (%DataSectionAfterWindow) | |
GCL_HBRBACKGROUND Equate(-10) ! generated | |
PDSNewBrush LONG ! by | |
PDSOldBrush LONG ! app frame background color template | |
#ENDAT | |
#AT (%AfterWindowOpening),PRIORITY(8001) | |
!Set the background color of the application frame | |
PDSOldBrush = PDSGetClassLong(AppFrame{PROP:ClientHandle},GCL_HBRBACKGROUND) | |
PDSNewBrush = PDSCreateSolidBrush(%FrameBGColor) ! Selected color attribute | |
If PDSNewBrush <> 0 | |
PDSSetClassLong(AppFrame{PROP:ClientHandle},GCL_HBRBACKGROUND,PDSNewBrush) | |
End | |
#ENDAT | |
#AT (%WindowManagerMethodCodeSection,'TakeCloseEvent'),PRIORITY(5000) | |
!Remove the background color of the application frame | |
If PDSOldBrush <> 0 | |
PDSSetClassLong(AppFrame{PROP:ClientHandle},GCL_HBRBACKGROUND,PDSOldBrush) | |
PDSOldBrush = 0 | |
End | |
If PDSNewBrush <> 0 | |
PDSDeleteObject(PDSNewBrush) | |
PDSNewBrush = 0 | |
End | |
#ENDAT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment