Page 1 of 1

Posible Bug method SaveState() Mr.Rao.

PostPosted: Tue Oct 29, 2019 3:10 pm
by jvtecheto
Reabro este hilo que se ha quedado sin respuesta, me interesa mucho el tema

Hi Mr. Rao.

this code works perfectly

Code: Select all  Expand view

oIni:Set( "states", "browse", oBrw:SaveState()
 


but this not save anything

Code: Select all  Expand view

oIni:Set( "states", "window", oWnd:SaveState()
 


I use this function.

Code: Select all  Expand view

FUNCTION SaveWinData( oWnd, oBrw,cAlias )

   LOCAL oIni

   INI oIni File cDirectApp + "\OBRAS.INI"
   oIni:Set( cAlias, "window", oWnd:SaveState() )  
   oIni:Set( cAlias, "browse", oBrw:SaveState() )
   
 
RETURN NIL
 


and use it in VALID (SaveWinData(oWndObr,oBrw,cAlias),.T.)

[Obr]
window=
browse=XS1:{{"_nCreationOrders",{1,2,3,4}},{"_nRowHeight",21},{"_nWidths",{72.54,132.99,342.47,326.43}},{"_lHides",{.F.,.F.,.F.,.F.}},{"_cGrpHdrs",{,,,}},{"_cHeaders",{"CODIGO","C.I.F.","NOMBRE","DIRECCION"}}}


what am i doing wrong?

thanks in advance.

Jose.

Re: Posible Bug method SaveState() Mr.Rao.

PostPosted: Wed Oct 30, 2019 5:27 pm
by jvtecheto
[emoji23][emoji23][emoji23]

Enviado desde mi POCOPHONE F1 mediante Tapatalk

Re: Posible Bug method SaveState() Mr.Rao.

PostPosted: Thu Oct 31, 2019 2:37 am
by nageswaragunupudi
Though you did not mention, it appears you are using oWnd:SaveState() with MDICHILD windows.

Our present implementation of Window's SaveState() and RestoreState() does not work with MDICHILD windows.

We will fix this in the next version.

For now, can you please make the following changes to TWindow class in window.prg and test?

Present code:
Code: Select all  Expand view
METHOD SaveState() CLASS TWindow

   if !Empty( ::hWnd ) .and. !::IsKindOf( "TCONTROL" ) .and. !::WinStyle( WS_CHILD )
      return STRTOHEX( GetWindowPlacement( ::hWnd ) )
   endif

return ""
 


Please change this as:
Code: Select all  Expand view
METHOD SaveState() CLASS TWindow

   if !Empty( ::hWnd ) .and. !::IsKindOf( "TCONTROL" ) //.and. !::WinStyle( WS_CHILD )
      return STRTOHEX( GetWindowPlacement( ::hWnd ) )
   endif

return ""
 


Present code:
Code: Select all  Expand view
METHOD RestoreState( cState ) CLASS TWindow

   if !Empty( ::hWnd ) .and. !Empty( cState ) .and. !::IsKindOf( "TCONTROL" ) .and. !::WinStyle( WS_CHILD )
      SetWindowPlacement( ::hWnd, HEXTOSTR( cState ) )
   endif

return nil
 


Please change this as:
Code: Select all  Expand view
METHOD RestoreState( cState ) CLASS TWindow

   if !Empty( ::hWnd ) .and. !Empty( cState ) .and. !::IsKindOf( "TCONTROL" ) //.and. !::WinStyle( WS_CHILD )
      SetWindowPlacement( ::hWnd, HEXTOSTR( cState ) )
   endif

return nil
 


Can you please test after making these changes and let us know how is it working?

Re: Posible Bug method SaveState() Mr.Rao.

PostPosted: Fri Nov 01, 2019 7:17 pm
by jvtecheto
Hello Mr. Rao.

I Sobrecharged these methods and it works fine. Many Thanks

It Saves this line in ini file.

window=2C0000000000000001000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8FFFFFFE1FFFFFF5E05000053020000


now how do I retrieve the coordinates to define the window ?

Code: Select all  Expand view

DEFINE WINDOW OWndObr MDICHILD OF oWndMain ;
   FROM ??, ?? TO ??, ??
 


Thanks in advance.

Jose