FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Posible Bug method SaveState() Mr.Rao.
Posts: 607
Joined: Mon Mar 04, 2013 04:32 PM
Posible Bug method SaveState() Mr.Rao.
Posted: Tue Oct 29, 2019 03:10 PM
Reabro este hilo que se ha quedado sin respuesta, me interesa mucho el tema

Hi Mr. Rao.

this code works perfectly

Code (fw): Select all Collapse
oIni:Set( "states", "browse", oBrw:SaveState()


but this not save anything

Code (fw): Select all Collapse
oIni:Set( "states", "window", oWnd:SaveState()


I use this function.

Code (fw): Select all Collapse
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 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
Posts: 607
Joined: Mon Mar 04, 2013 04:32 PM
Re: Posible Bug method SaveState() Mr.Rao.
Posted: Wed Oct 30, 2019 05:27 PM

[emoji23][emoji23][emoji23]

Enviado desde mi POCOPHONE F1 mediante Tapatalk

Fwh 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Posible Bug method SaveState() Mr.Rao.
Posted: Thu Oct 31, 2019 02:37 AM
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 (fw): Select all Collapse
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 (fw): Select all Collapse
METHOD SaveState() CLASS TWindow

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

return ""


Present code:
Code (fw): Select all Collapse
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 (fw): Select all Collapse
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
Posts: 607
Joined: Mon Mar 04, 2013 04:32 PM
Re: Posible Bug method SaveState() Mr.Rao.
Posted: Fri Nov 01, 2019 07:17 PM
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 (fw): Select all Collapse
DEFINE WINDOW OWndObr MDICHILD OF oWndMain ;
   FROM ??, ?? TO ??, ??


Thanks in advance.

Jose
Fwh 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64

Continue the discussion