Posible Bug method SaveState() Mr.Rao.

Post Reply
User avatar
jvtecheto
Posts: 357
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Posible Bug method SaveState() Mr.Rao.

Post 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

oIni:Set( "states", "browse", oBrw:SaveState()
 
but this not save anything

Code: Select all

oIni:Set( "states", "window", oWnd:SaveState()
 
I use this function.

Code: Select all

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.
Fwh 19.06 32 bits + Harbour 3.2dev(r2011030937)+ Borland 7.4 + FivEdit
User avatar
jvtecheto
Posts: 357
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

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

Post by jvtecheto »

[emoji23][emoji23][emoji23]

Enviado desde mi POCOPHONE F1 mediante Tapatalk
Fwh 19.06 32 bits + Harbour 3.2dev(r2011030937)+ Borland 7.4 + FivEdit
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post 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

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

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

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

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?
Regards

G. N. Rao.
Hyderabad, India
User avatar
jvtecheto
Posts: 357
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

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

Post 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

DEFINE WINDOW OWndObr MDICHILD OF oWndMain ;
   FROM ??, ?? TO ??, ?? 
 
Thanks in advance.

Jose
Fwh 19.06 32 bits + Harbour 3.2dev(r2011030937)+ Borland 7.4 + FivEdit
Post Reply