Posible Bug method SaveState() Mr.Rao.

Posible Bug method SaveState() Mr.Rao.

Postby jvtecheto » Tue Oct 29, 2019 3:10 pm

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  RUN

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


but this not save anything

Code: Select all  Expand view  RUN

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


I use this function.

Code: Select all  Expand view  RUN

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
User avatar
jvtecheto
 
Posts: 600
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

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

Postby jvtecheto » Wed Oct 30, 2019 5:27 pm

[emoji23][emoji23][emoji23]

Enviado desde mi POCOPHONE F1 mediante Tapatalk
Fwh 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
User avatar
jvtecheto
 
Posts: 600
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

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

Postby nageswaragunupudi » Thu Oct 31, 2019 2: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: Select all  Expand view  RUN
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  RUN
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  RUN
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  RUN
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
nageswaragunupudi
 
Posts: 10663
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby jvtecheto » Fri Nov 01, 2019 7: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: Select all  Expand view  RUN

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


Thanks in advance.

Jose
Fwh 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
User avatar
jvtecheto
 
Posts: 600
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: EASYSOFT, karinha and 68 guests