Posible Bug method SaveState() Mr.Rao.

Post Reply
User avatar
jvtecheto
Posts: 603
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 | Expand

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


but this not save anything

Code: Select all | Expand

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


I use this function.

Code: Select all | Expand

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: 603
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 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
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 | Expand

METHOD SaveState() CLASS TWindow   if !Empty( ::hWnd ) .and. !::IsKindOf( "TCONTROL" ) .and. !::WinStyle( WS_CHILD )      return STRTOHEX( GetWindowPlacement( ::hWnd ) )   endifreturn "" 


Please change this as:

Code: Select all | Expand

METHOD SaveState() CLASS TWindow   if !Empty( ::hWnd ) .and. !::IsKindOf( "TCONTROL" ) //.and. !::WinStyle( WS_CHILD )      return STRTOHEX( GetWindowPlacement( ::hWnd ) )   endifreturn "" 


Present code:

Code: Select all | Expand

METHOD RestoreState( cState ) CLASS TWindow   if !Empty( ::hWnd ) .and. !Empty( cState ) .and. !::IsKindOf( "TCONTROL" ) .and. !::WinStyle( WS_CHILD )      SetWindowPlacement( ::hWnd, HEXTOSTR( cState ) )   endifreturn nil 


Please change this as:

Code: Select all | Expand

METHOD RestoreState( cState ) CLASS TWindow   if !Empty( ::hWnd ) .and. !Empty( cState ) .and. !::IsKindOf( "TCONTROL" ) //.and. !::WinStyle( WS_CHILD )      SetWindowPlacement( ::hWnd, HEXTOSTR( cState ) )   endifreturn 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: 603
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 | Expand

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


Thanks in advance.

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