Uwe;
Perhaps I should explain a little more.
1. I need the window NOT maximized.
2. Upon resize of the main window, the dialog should also resize maintaining the grading.
3. Upon move of the main window, the dialog should also move with it.
You will find this behavior on any windows app. Here the sample code again. Upon move of the main window, the dialog moves with it. Upon resize of main window, the dialog resizes. So far so good, but grading is not adjusting with new window sizes:
Code: Select all | Expand
#include "fivewin.ch"
STATIC oDlg, oWnd
FUNCTION MAIN
LOCAL oMenu
LOCAL x := 1024
LOCAL y := 780
LOCAL xi := INT( x * 0.10 / 2 )
LOCAL yi := INT( y * 0.10 / 2 )
x := INT( x * 0.90 ) + xi
y := INT( y * 0.90 ) + yi
MENU oMenu
MenuItem "Show" ACTION (Resize(), oDlg:Show() )
MenuItem "Hide" ACTION odlg:hide()
ENDMENU
DEFINE WINDOW oWnd MDI FROM yi, xi TO y, x PIXEL Title "Testing Dlg On Wnd" MENU oMenu
ACTIVATE WINDOW oWnd ON INIT BuildDlg( "Sample Text", oWnd )
RETURN NIL
//-------------------------------------------------------
FUNCTION BuildDlg( cText, oOwner )
DEFINE DIALOG oDlg ;
RESOURCE "SampleDlg" ;
TRANSPARENT ;
COLOR CLR_WHITE , RGB(240,240,240)
REDEFINE SAY PROMPT cText ID 1 OF oDlg TRANSPARENT COLOR RGB(240,240,255),RGB(240,240,255)
REDEFINE BUTTONBMP ID 2 OF oDlg BITMAP "exit16" PROMPT "Ok" TEXTRIGHT ACTION oDlg:END()
oDlg:bPainted := { || GradBrush( oDlg, ;
{ { 1.0, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) } }, .T. ) }/**/
/*oDlg:bPainted := { || DlgGradient( oDlg, ;
{ { 1.0, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) } } ) } /**/
oDlg:bResized := Eval( oDlg:bPainted )
oDlg:lHelpIcon := .F.
ACTIVATE DIALOG oDlg NOWAIT VALID ( oDlg:hide(), .F. ) ;
ON INIT ( oDlg:Center( oWnd ), oDlg:Hide(), oDlg:Paint() );
ON MOVE ( oDlg:Paint() )
oDlg:hide()
oWnd:bResized := {|| Resize() }
oWnd:bMoved := { || Resize() }
RETURN NIL
//-------------------------------------------------------
STATIC FUNCTION GradBrush( oDlg, aColors, lPos )
local hDC, hBmp, hBmpOld, oBrush
if Empty( oDlg:oBrush:hBitmap )
hDC = CreateCompatibleDC( oDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aColors, lPos )
DeleteObject( oDlg:oBrush:hBrush )
oDlg:oBrush:hBitmap = hBmp
oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlg:ReleaseDC()
endif
RETURN NIL
//-------------------------------------------------------
STATIC FUNCTION Resize()
LOCAL aClient := GetClientRect ( oWnd:hWnd )
oDlg:SetSize( aClient[4] - 1, aClient[3]- 2, .T. )
oDlg:Center( oWnd )
Eval( oDlg:bPainted )
RETURN NIL
//-------------------------------------------------------
The resource is the same:
Code: Select all | Expand
SAMPLEDLG DIALOG 6, 15, 232, 58
STYLE DS_SYSMODAL |DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_DLGFRAME |0x40000000
CAPTION "FW Dialog"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
CONTROL "",1001,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,7,2,217,23
CONTROL "Ok",2,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,174,33,50,14
CONTROL "Redefined Text",1,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,9,13,201,8
END
You see what I mean?
I hope you can find an idea. Thank you.
Reinaldo.