Help for MDI Frame

Post Reply
User avatar
Mulyadi
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Help for MDI Frame

Post by Mulyadi »

Please help checking my code.

in FWH version 17.09 after calling the print procedure, windows dialog1 is borderless.

in version 20.07 the return to windows dialog1 leaves a frame.

Code: Select all | Expand

#include "FiveWin.ch"static oWndstatic lWnd1, oWnd1// ... static lWnd2, oWnd2Function Main()    local oBar, oBar1, oBar2    lWnd1 := .F.    // lWnd2 := .F.        DEFINE WINDOW oWnd TITLE "test MDI"  MDI                         DEFINE BUTTONBAR oBar OF oWnd 3D SIZE 110, 30  2007            oBar:bClrGrad := { |lMouseOver| If( lMouseOver, CLR_BROWN, nARGB( 64, 0, 192, 0 ) ) }            oBar:SetColor( CLR_BLUE )        DEFINE BUTTON oBar1 OF oBar ACTION test1() PROMPT " Dialog 1 " left       DEFINE BUTTON oBar2 OF oBar ACTION test2() PROMPT " Dialog 2 " left                     DEFINE BUTTON OF oBar ACTION oWnd:end() PROMPT "Exit" left GROUP     ACTIVATE WINDOW oWnd maximized VALID MsgYesNo( "Exit ?" )    return nil//--------------------------------------------------Function ChangeParent( oDlg, oChild )  local n  for n = 1 to Len( oDlg:aControls )      SetParent( oDlg:aControls[ n ]:hWnd, oChild:hWnd )      AAdd( oChild:aControls, oDlg:aControls[ n ] )      oDlg:aControls[ n ]:oWnd = oChild  nextreturn nil//---------------------------------------------------static function test1()    local oBrush    if ! lWnd1        DEFINE BRUSH oBrush GRADIENT { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } }    DEFINE WINDOW oWnd1 from 0,0 to oWnd:nHeight, oWnd:nWidth pixel ;      MDICHILD OF WndMain() BRUSH oBrush nosysmenu ;      title "This frame exists after returning to the dialog1 test window"    lWnd1 := .T.        dialog1( oWnd1 )                 ACTIVATE WINDOW oWnd1 MAXIMIZED ON INIT oWnd1:paint()  ;          VALID  ( oWnd1:Hide(), lWnd1 := .F., .t. )              RELEASE BRUSH oBrush  else    oWnd1:Maximize()    oWnd1:SetFocus()    endifreturn nil//------------------- Dialog1// actual this function on other fileFunction dialog1( oWnd )    local oDlg, oBrush, oFld  local btnprint    DEFINE BRUSH oBrush GRADIENT { { 1, 9815189, CLR_WHITE } }  DEFINE DIALOG oDlg of oWnd size oWnd:nRight-20, oWnd:nBottom-80 TRUEPIXEL brush oBrush     @ 2, 1 FOLDEREX oFld OF oDlg PIXEL ;         PROMPTS "Folder 11", "Folder 12", "Folder 13", "Folder 14", "Close" ;         on change ( if( nOption == 5, oWnd:end(), ) ) ;         TAB HEIGHT 24 ;         SIZE oDlg:nWidth, oDlg:nHeight TRANSPARENT       @ 10, 5 say "This folder 11" of oFld:aDialogs[1] size 100,14 pixel transparent      @ 10, 5 say "This folder 12" of oFld:aDialogs[2] size 100,14 pixel transparent      @ 10, 5 say "This folder 13" of oFld:aDialogs[3] size 100,14 pixel transparent      @ 10, 5 say "This folder 14" of oFld:aDialogs[4] size 100,14 pixel transparent      @ 10,100 btnbmp btnprint prompt "test print" of oFld:aDialogs[1] size 100,14 pixel center adjust 2007 ;        action test_print1()  ACTIVATE DIALOG oDlg NOWAIT CENTERED ;    ON INIT ( ChangeParent( oDlg, oWnd ) )  oDlg:end()return nil//------------------------------------------------------//------------------------------------------------------static function test2()  msginfo( "as of Dialog1")return nil//------------------------------------------- // static function test_print1  local oPrn  local oBrushRed, oBrushGrn  local oFont  DEFINE BRUSH oBrushRed COLOR CLR_RED  DEFINE BRUSH oBrushGrn COLOR CLR_HGREEN  PRINT oPrn PREVIEW  DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-20 OF oPrn    PAGE      oPrn:SayText(  300, 400, "Yellow, RedBrush", 2000, 200, oFont, nil, CLR_YELLOW, oBrushRed, "PIXEL" )      oPrn:SayText(  620, 400, "Default: nil,nil", 2000, 200, oFont, nil, nil,        nil,       "PIXEL" )        ENDPAGE  ENDPRINT  RELEASE FONT oFont  RELEASE BRUSH oBrushRed, oBrushGrn  return nil      


thank you

Mulyadi
User avatar
karinha
Posts: 7948
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: Help for MDI Frame

Post by karinha »

Code: Select all | Expand

#include "FiveWin.ch"STATIC oWndSTATIC lWnd1, oWnd1FUNCTION Main()   LOCAL oBar, oBar1, oBar2   lWnd1 := .F.   SetBalloon( .T. )   SkinButtons()      DEFINE WINDOW oWnd TITLE "test MDI"  MDI                    DEFINE BUTTONBAR oBar OF oWnd 3D SIZE 110, 30  2007   oBar:bClrGrad := { |lMouseOver| If( lMouseOver, CLR_BROWN, nARGB( 64, 0, 192, 0 ) ) }   oBar:SetColor( CLR_BLUE )   DEFINE BUTTON oBar1 OF oBar ACTION test1() PROMPT " Dialog 1 " left   DEFINE BUTTON oBar2 OF oBar ACTION test2() PROMPT " Dialog 2 " left              DEFINE BUTTON OF oBar ACTION oWnd:end() PROMPT "Exit" left GROUP   ACTIVATE WINDOW oWnd maximized VALID MsgYesNo( "Exit ?" )   RETURN nilFUNCTION ChangeParent( oDlg, oChild )   LOCAL n   FOR n = 1 TO Len( oDlg:aControls )      SetParent( oDlg:aControls[ n ]:hWnd, oChild:hWnd )      AAdd( oChild:aControls, oDlg:aControls[ n ] )      oDlg:aControls[ n ]:oWnd = oChild   NEXTRETURN nilSTATIC FUNCTION test1()   LOCAL oBrush   IF .NOT. lWnd1         DEFINE BRUSH oBrush GRADIENT { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } }      DEFINE WINDOW oWnd1 FROM 0, 0 TO oWnd:nHeight, oWnd:nWidth pixel ;         MDICHILD OF WndMain() BRUSH oBrush nosysmenu ;         title "This frame exists after returning to the dialog1 test window"      lWnd1 := .T.      dialog1( oWnd1 )                   ACTIVATE WINDOW oWnd1 MAXIMIZED ON INIT oWnd1:paint()  ;         VALID  ( oWnd1:Hide(), lWnd1 := .F. , .T. )               RELEASE BRUSH oBrush   ELSE      oWnd1:Maximize()      oWnd1:SetFocus()   ENDIFRETURN nilFUNCTION dialog1( oWnd )    LOCAL oDlg, oBrush, oFld   LOCAL btnprint   DEFINE BRUSH oBrush GRADIENT { { 1, 9815189, CLR_WHITE } }   DEFINE DIALOG oDlg of oWnd size oWnd:nRight - 20, oWnd:nBottom - 80    ;      TRUEPIXEL BRUSH oBrush   oDlg:lHelpIcon := .F.   @ 2, 1 FOLDEREX oFld OF oDlg PIXEL                                     ;      PROMPTS "Folder 11", "Folder 12", "Folder 13", "Folder 14", "Close" ;      ON change ( if( nOption == 5, oWnd:end(), ) )                       ;      TAB HEIGHT 24 ;      SIZE oDlg:nWidth, oDlg:nHeight // TRANSPARENT   @ 10, 5 SAY "This folder 11" of oFld:aDialogs[1] size 100, 14 pixel    ;      UPDATE TRANSPARENT   @ 10, 5 SAY "This folder 12" of oFld:aDialogs[2] size 100, 14 pixel    ;      UPDATE TRANSPARENT   @ 10, 5 SAY "This folder 13" of oFld:aDialogs[3] size 100, 14 pixel    ;      UPDATE TRANSPARENT   @ 10, 5 SAY "This folder 14" of oFld:aDialogs[4] size 100, 14 pixel    ;      UPDATE TRANSPARENT   @ 10, 100 btnbmp btnprint PROMPT "test print" of oFld:aDialogs[1]      ;      size 100, 14 pixel center adjust 2007                               ;      action test_print1()   ACTIVATE DIALOG oDlg NOWAIT CENTERED ;      ON INIT ( ChangeParent( oDlg, oWnd ) )   oDlg:End()RETURN nilSTATIC FUNCTION test2()   msginfo( "as of Dialog1" )RETURN nilSTATIC FUNCTION test_print1   LOCAL oPrn   LOCAL oBrushRed, oBrushGrn   LOCAL oFont   DEFINE BRUSH oBrushRed COLOR CLR_RED   DEFINE BRUSH oBrushGrn COLOR CLR_HGREEN   PRINT oPrn PREVIEW // MODAL      DEFINE FONT oFont NAME "TAHOMA"  SIZE 0, - 20 OF oPrn      PAGE         oPrn:SayText(  300, 400, "Yellow, RedBrush", 2000, 200, oFont, nil, CLR_YELLOW, oBrushRed, "PIXEL" )         oPrn:SayText(  620, 400, "Default: nil,nil", 2000, 200, oFont, nil, nil,        nil,       "PIXEL" )         ENDPAGE   ENDPRINT   RELEASE FONT oFont   RELEASE BRUSH oBrushRed, oBrushGrnRETURN nil 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
Mulyadi
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: Help for MDI Frame

Post by Mulyadi »

thanks for responding.

I mean how to get back to normal view after exiting the printer button.

normal view like this:
https://mega.nz/file/68pHQAgS#IM41IyGwv_qmWD_idaAag_TkXmItiLoiX3rOHFtfZxI

but with version 20.07 I got this:
https://mega.nz/file/r1gHVSYS#f5cqqfNK_jrC_-9x_P335jzDJ_KmoR5YZdEZ_QBgaTk

Thanks
Mulyadi
User avatar
mauri.menabue
Posts: 165
Joined: Thu Apr 17, 2008 2:38 pm

Re: Help for MDI Frame

Post by mauri.menabue »

Hi Mulyadi,

Try this :

Code: Select all | Expand

#include "FiveWin.ch"static oWndstatic lWnd1, oWnd1// ... static lWnd2, oWnd2Function Main()    local oBar, oBar1, oBar2    lWnd1 := .F.    // lWnd2 := .F.       DEFINE WINDOW oWnd TITLE "test MDI"  MDI                         DEFINE BUTTONBAR oBar OF oWnd 3D SIZE 110, 30  2007            oBar:bClrGrad := { |lMouseOver| If( lMouseOver, CLR_BROWN, nARGB( 64, 0, 192, 0 ) ) }            oBar:SetColor( CLR_BLUE )        DEFINE BUTTON oBar1 OF oBar ACTION test1() PROMPT " Dialog 1 " left      DEFINE BUTTON oBar2 OF oBar ACTION test2() PROMPT " Dialog 2 " left                   DEFINE BUTTON OF oBar ACTION oWnd:end() PROMPT "Exit" left GROUP    ACTIVATE WINDOW oWnd maximized VALID MsgYesNo( "Exit ?" )   return nil//--------------------------------------------------Function ChangeParent( oDlg, oChild )  local n  for n = 1 to Len( oDlg:aControls )      SetParent( oDlg:aControls[ n ]:hWnd, oChild:hWnd )      AAdd( oChild:aControls, oDlg:aControls[ n ] )      oDlg:aControls[ n ]:oWnd = oChild  nextreturn nil//---------------------------------------------------static function test1()    local oBrush    if ! lWnd1       DEFINE BRUSH oBrush GRADIENT { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } }    DEFINE WINDOW oWnd1 from 0,0 to oWnd:nHeight, oWnd:nWidth pixel ;      MDICHILD OF WndMain() BRUSH oBrush nosysmenu ;      title "This frame exists after returning to the dialog1 test window" ;      STYLE nor(WS_THICKFRAME)  // <---------------------- NEW ADD BY MAURI !---------------------------------    lWnd1 := .T.        dialog1( oWnd1 )                 ACTIVATE WINDOW oWnd1 MAXIMIZED ON INIT oWnd1:paint()  ;          VALID  ( oWnd1:Hide(), lWnd1 := .F., .t. )             RELEASE BRUSH oBrush  else    oWnd1:Maximize()    oWnd1:SetFocus()    endifreturn nil//------------------- Dialog1// actual this function on other fileFunction dialog1( oWnd )   local oDlg, oBrush, oFld  local btnprint    DEFINE BRUSH oBrush GRADIENT { { 1, 9815189, CLR_WHITE } }  DEFINE DIALOG oDlg of oWnd size oWnd:nRight-20, oWnd:nBottom-80 TRUEPIXEL brush oBrush    @ 2, 1 FOLDEREX oFld OF oDlg PIXEL ;         PROMPTS "Folder 11", "Folder 12", "Folder 13", "Folder 14", "Close" ;         on change ( if( nOption == 5, oWnd:end(), ) ) ;         TAB HEIGHT 24 ;         SIZE oDlg:nWidth, oDlg:nHeight TRANSPARENT      @ 10, 5 say "This folder 11" of oFld:aDialogs[1] size 100,14 pixel transparent      @ 10, 5 say "This folder 12" of oFld:aDialogs[2] size 100,14 pixel transparent      @ 10, 5 say "This folder 13" of oFld:aDialogs[3] size 100,14 pixel transparent      @ 10, 5 say "This folder 14" of oFld:aDialogs[4] size 100,14 pixel transparent      @ 10,100 btnbmp btnprint prompt "test print" of oFld:aDialogs[1] size 100,14 pixel center adjust 2007 ;        action test_print1()  ACTIVATE DIALOG oDlg NOWAIT CENTERED ;    ON INIT ( ChangeParent( oDlg, oWnd ) )  oDlg:end()return nil//------------------------------------------------------//------------------------------------------------------static function test2()  msginfo( "as of Dialog1")return nil//-------------------------------------------//static function test_print1  local oPrn  local oBrushRed, oBrushGrn  local oFont  DEFINE BRUSH oBrushRed COLOR CLR_RED  DEFINE BRUSH oBrushGrn COLOR CLR_HGREEN  PRINT oPrn PREVIEW  DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-20 OF oPrn    PAGE      oPrn:SayText(  300, 400, "Yellow, RedBrush", 2000, 200, oFont, nil, CLR_YELLOW, oBrushRed, "PIXEL" )      oPrn:SayText(  620, 400, "Default: nil,nil", 2000, 200, oFont, nil, nil,        nil,       "PIXEL" )       ENDPAGE  ENDPRINT  RELEASE FONT oFont  RELEASE BRUSH oBrushRed, oBrushGrn  return nil 

Bye
User avatar
Mulyadi
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: Help for MDI Frame

Post by Mulyadi »

Hi Mauri,
thank you, and problem resolved.

:D

Regards

Mulyadi
Post Reply