Page 1 of 1

MDI-Frame and using oWnd:bResized := {|| ...} ?

PostPosted: Fri Apr 06, 2012 2:54 pm
by ukoenig
Hello,

is it possible, using oWnd:bResized := {|| ..... } ? on a MDI-Frame ?
Tested, but nothing happens.

NOT :

nCount := 1

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON RESIZE MsgAlert( nCount++ )


because the Alert was executed twice and returns value 1 and 2.

The following ( MDI and Modal ) :

nCount := 1
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT MsgAlert( "Test" ) ;
ON RESIZE ( nCount++, MsgAlert( nCount ) )


Returns on INIT :

2
Test
3


Best Regards
Uwe :?:

Re: MDI-Frame and using oWnd:bResized := {|| ...} ?

PostPosted: Fri Apr 06, 2012 5:06 pm
by Enrico Maria Giordano
ukoenig wrote:is it possible, using oWnd:bResized := {|| ..... } ? on a MDI-Frame ?


Have you already tried

Code: Select all  Expand view
oWnd:oWndClient:bResized := {|| ..... }


EMG

Re: MDI-Frame and using oWnd:bResized := {|| ...} ?

PostPosted: Fri Apr 06, 2012 6:11 pm
by ukoenig
Enrico,

Yes, tested with the same Result : nothing happens.

oWnd:oWndClient:bResized := {|| Msgalert ( "Test" ) }

I can use ON RESIZE ( that works ), but a called function is executed twice.
I noticed it, because of a forgotten logical var.
The function PAINT_LOGO sets lVisible to .T. ( double painting disabled )

lVisible := .F.
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON RESIZE ( W_BACKGRD( oWnd:oWndClient, "PICTURE8.jpg" ), ;
IIF( lVisible = .T., oLogo:End(), NIL ), ;
PAINT_LOGO(oWnd:oWndClient), ;
aLogo[1] := ( oWnd:nHeight / 2 ) - 50 - ( 248 / 2 ), ;
aLogo[2] := ( oWnd:nWidth / 2 ) - ( 320 / 2 ), ;
oBtn1:Move( oWnd:nHeight - 250, oWnd:nWidth - 110, , ,.T. ), ;
oBtn2:Move( oWnd:nHeight - 158, oWnd:nWidth - 110, , ,.T. ) )

ON INIT ( painted once )

Image

ON RESIZE ( double painted on startup without using a logical var )

Image

Centered on RESIZE
Background adjusted
Logo repainted with new calculated top / left
New Button-pos calculated

Image

Best Regards
Uwe :?:

Re: MDI-Frame and using oWnd:bResized := {|| ...} ?

PostPosted: Sat Apr 07, 2012 9:21 am
by Antonio Linares
Uwe,

Generate an error from that called code and check the stackcalls:

Code: Select all  Expand view

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON RESIZE CheckCallStack()

...

function CheckCallStack()

   local nLevel := 0, cCalls := ""

   while ! Empty( ProcName( nLevel )  )
      cCalls += ProcName( nLevel ) + " (" + AllTrim( Str( ProcLine( nLevel++ ) ) ) + ")" + CRLF
   end
   MsgInfo( cCalls )

return nil