IF cTitle == NIL
DEFINE DIALOG oDlg OF oWndParent ;
FROM 0,0 TO 3, Len( cCaption ) + 4 ;
STYLE nOr( DS_MODALFRAME, WS_POPUP )
ELSE
DEFINE DIALOG oDlg OF oWndParent ;
FROM 0,0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
TITLE cTitle ;
STYLE DS_MODALFRAME
ENDIF
function MsgRun( cCaption, cTitle, bAction, oWndParent )
LOCAL oDlg, nWidth, uReturn
DEFAULT cCaption := "Please, wait...",;
bAction := { || WaitSeconds( 1 ) }
IF cTitle == NIL
DEFINE DIALOG oDlg ;
FROM 0,0 TO 3, Len( cCaption ) + 4 ;
STYLE nOr( DS_MODALFRAME, WS_POPUP )
ELSE
DEFINE DIALOG oDlg ;
FROM 0,0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
TITLE cTitle ;
STYLE DS_MODALFRAME
ENDIF
oDlg:bStart := { || uReturn := Eval( bAction, oDlg ), oDlg:End(), SysRefresh() }
oDlg:cMsg := cCaption
nWidth := oDlg:nRight - oDlg:nLeft
ACTIVATE DIALOG oDlg ON PAINT oDlg:SayText( oDlg:cMsg ) ;
ON INIT oDlg:Center( oWndParent )
return uReturn
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Move the window and left click on it"
ACTIVATE WINDOW oWnd ;
ON CLICK MsgRun( "MsgRun() messages are optionally centered", "In FWH 17.05", { || MsgInfo( "ok" ) }, oWnd )
return nil
case WM_NOTIFY:{
HWND X=FindWindow("#32770",NULL);
if(GetParent(X)==H_frame){int Px,Py,Sx,Sy; RECT R1,R2;
GetWindowRect(hwnd,&R1); GetWindowRect(X,&R2);
Sx=R2.right-R2.left,Px=R1.left+(R1.right-R1.left)/2-Sx/2;
Sy=R2.bottom-R2.top,Py=R1.top+(R1.bottom-R1.top)/2-Sy/2;
MoveWindow(X,Px,Py,Sx,Sy,1);
}
} break;
ACTIVATE DIALOG oDlg ON PAINT oDlg:SayText( oDlg:cMsg ) ;
ON INIT WndCenter( oDlg:hWnd ,GetActiveWindow() )
aGrad := {{0.5,CLR_HRED,CLR_WHITE},{0.5,CLR_WHITE,CLR_HRED}}
IF cTitle == NIL
DEFINE DIALOG oDlg GRADIENT aGrad FONT oFont ;
FROM 0,0 TO 3, Len( cCaption ) + 4 ;
STYLE nOr( DS_MODALFRAME, WS_POPUP )
ELSE
DEFINE DIALOG oDlg GRADIENT aGrad FONT oFont;
FROM 0,0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
TITLE cTitle ;
STYLE DS_MODALFRAME
ENDIF
#include "FiveWin.ch"
function Main()
local oWnd
SetDlgGradient( { {0.30,CLR_HRED,CLR_WHITE}, {0.70,CLR_WHITE,CLR_HRED} } )
DEFINE WINDOW oWnd TITLE "Move the window and left click on it"
ACTIVATE WINDOW oWnd ;
ON CLICK MsgRun( "MsgRun() messages are optionally centered", "In FWH 17.05", { || MsgInfo( "ok" ) }, oWnd )
return nil
METHOD Gradient( aGradColors ) CLASS TWindow
#define SM_CYCAPTION 4
#define SM_CYFRAME 32
local hDC, hBmp, hBmpOld, lCaption := lAnd(::nStyle,WS_CAPTION) .or. !lAnd(::nStyle,WS_POPUP), nHeight_korr := if(lCaption,GetSysMetrics( SM_CYCAPTION ),0) + GetSysMetrics( SM_CYFRAME )/2
DEFAULT aGradColors := ::aGradColors
if aGradColors == nil
return nil
endif
hDC = CreateCompatibleDC( ::GetDC() )
hBmp = CreateCompatibleBitMap( ::hDC, ::nWidth, ::nHeight - nHeight_korr )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, ::nHeight - nHeight_korr, ::nWidth, aGradColors )
if ::oBrush != nil
::oBrush:End()
endif
::oBrush = TBrush():New()
::oBrush:hBitmap = hBmp
::oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
::ReleaseDC()
return nil
local hDC, hBmp, hBmpOld, aClient := GetClientRect(::hWnd), nHeight := aClient[3]-aClient[1], nWidth := aClient[4]-aClient[2]
DEFAULT aGradColors := ::aGradColors
if aGradColors == nil
return nil
endif
hDC = CreateCompatibleDC( ::GetDC() )
hBmp = CreateCompatibleBitMap( ::hDC, nWidth, nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, nHeight, nWidth, aGradColors )
if ::oBrush != nil
::oBrush:End()
endif
::oBrush = TBrush():New()
::oBrush:hBitmap = hBmp
::oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
::ReleaseDC()
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 49 guests