Last active
January 19, 2016 19:52
-
-
Save MarkGoldberg/af8231ee3c6626d928bf to your computer and use it in GitHub Desktop.
Clarion Frame Background Color
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
MEMBER | |
! http://www.odata.de/Clarion/colored_background_for_appframe | |
! the above from Wolfgang Orth says this code was from Jim Gambon on the newsgroups | |
! that sounds right, but somehow I forgot to give credit in the class. (blush) | |
MAP | |
MODULE('Win32API') | |
GetClassLong (LONG _hWnd,LONG _Index ),LONG, PASCAL,NAME('GetClassLongA') | |
SetClassLong (LONG _hWnd,LONG _Index,LONG NewValue),LONG,PROC,PASCAL,NAME('SetClassLongA') | |
CreateSolidBrush (LONG _Color ),LONG, PASCAL,NAME('CreateSolidBrush') | |
DeleteObject (LONG _Object ),LONG,PROC,PASCAL,NAME('DeleteObject') | |
!http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/usingGDIPlus/fillingshapeswithagradientbrush/creatingalineargradient.asp | |
END !MODULE | |
END | |
INCLUDE('ctAPIColor.inc'),ONCE | |
GCL_HBRBACKGROUND EQUATE(-10) | |
!================================================================================ | |
ctAPIColor.SetFrameBackground_OnClose PROCEDURE() | |
!! Finally, reset and delete the brush objects in the TakeCloseEvent handler for the ThisWindow object: | |
CODE | |
IF SELF.OldBrush | |
SetClassLong(SELF.ClientHWND, GCL_HBRBACKGROUND, SELF.OldBrush) | |
SELF.OldBrush = 0 | |
END !IF | |
IF SELF.NewBrush | |
DeleteObject(SELF.NewBrush) | |
SELF.NewBrush = 0 | |
END !IF | |
!================================================================================ | |
ctAPIColor.SetFrameBackground_OnOpen PROCEDURE(WINDOW xWindow, LONG xColor) | |
!----------------------------------------------------------------------------- | |
!Note: probably should ONLY be used on a FRAME | |
!----------------------------------------------------------------------------- | |
! the only possible down side is your changing a class brush. Multiple | |
! windows can be created from a single class so the color could potentially | |
! show up elsewhere but the risk is low as the app frame is unique. | |
! - jim kane | |
!----------------------------------------------------------------------------- | |
CODE | |
!! Next, right after the OPEN(AppFrame) statement in ThisWindow.Init (so that you | |
!! catch it before any actual screen activity takes place) put this: | |
? ! ASSERT(0,'<4,2,7>argColor['& argColor &']') !for use with a DEBUGER class, where ASSERTHook2 is being used | |
SELF.ClientHWND = xWindow{PROP:ClientHandle} | |
SELF.OldBrush = GetClassLong(SELF.ClientHWND,GCL_HBRBACKGROUND) | |
SELF.NewBrush = CreateSolidBrush(xColor) ! 0FFFFFFh is Solid White | |
IF SELF.NewBrush | |
SetClassLong(SELF.ClientHWND, GCL_HBRBACKGROUND, SELF.NewBrush) | |
END !IF | |
!! I haven't tried it out yet, but I bet you could create a number of cool brush | |
!! objects to paint the background. | |
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
ctAPIColor CLASS,TYPE,MODULE('ctAPIColor.CLW'),LINK('ctAPIColor.CLW') !,_ctAPIColorLinkMode_),DLL(_ctAPIColorDLLMode_) | |
ClientHWND LONG !HWND | |
NewBrush LONG | |
OldBrush LONG | |
SetFrameBackground_OnOpen PROCEDURE(WINDOW xWindow, LONG xColor) | |
SetFrameBackground_OnClose PROCEDURE | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment