RE: [flexcoders] Re: HistoryManger state is undefined on loading

2005-07-14 Thread Matt Chotin










I asked the engineer who wrote history
manager:



This is expected behavior.
The history manager saves states upon entry, not exit.



If you've called saveState()
twice, your app is now in the second state. The first press of the Back button
returns to the first saved state. The second press of the Back button returns
the app to its initial state and will call loadState() with an
undefined state object.





Matt









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of rockmoyosa
Sent: Thursday, July 14, 2005 1:22
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re:
HistoryManger state is undefined on loading





Guess I'm right!!.

But anyway, I'm writing a buffer
between the HistoryManager and
Application in which I store my
Model-state(Object). 

But but I still got this weird problem with the
first save I make and
if I push the back button the state (yes the
normal procedure with
strings) is undefined. 

For example i save twice an object in an array and
than I store the
index in the state Object I want to store.

var state:Object = new Object();
state.currentIndex =this.historyArray.length-1;

When I trace this action the result is:

CurrentIndex: 0
CurrentIndex: 1

Now I push the back button and the loadstate is
executed. When I trace
the incoming state object:

Log.debug(state: +state);
Log.dump(state);

first back :

DEBUG: state: [object Object]

 DUMP START  
this:Object
|
currentIndex = 0 (string)

Second back:

DEBUG: state: undefined

 DUMP START  
this = undefined (undefined)

On the third back:
it's a new request or nothing. This is the
expected result.

It's link it's out of sync or something.Twice the
saveState is
executed and twice the loadState is executed. What
is wrong with it.

Please anybody




--- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED] wrote:
 I'm beginning to get the idee that this part
of Flex is pushed in 1.5
 (Or what version it was introduced). No
documentation is minimal so
 are the supported functionality. 
 
 I hope somebody can prove me wrong.
 
 be continued??
 
 
 --- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED] wrote:
  --- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED]
wrote:
   This thing is really
weird:
   
   first save state:
   
   DEBUG: - saveState 
   
DUMP START  
   this:Object
  
| view = false (boolean)
  
| detailId =
7bd21a76-b716-4501-a196-1acf4265d847 (string)
   
   
   And if I click on Back:
   
   DEBUG: - loadState 
   
DUMP START  
   this:Object
  
| detailId =
7bd21a76-b716-4501-a196-1acf4265d847 (string)
  
| view = true (string)
   
   What the @[EMAIL PROTECTED] view = true???
... More documentation on the
   HistoryManager would be
appreciated. Are perhaps more samples. 
   
   I found one but it to damn
simple it doesn't say anything on how
   it's working only how to use it for
simple things.
   
  
 

http://www.richinternet.de/blog/index.cfm?mode=entryentry=3CF01C8E-CFBB-A5CA-36BCC797581D2CFB
   
   
   
   --- In flexcoders@yahoogroups.com,
jacksodj [EMAIL PROTECTED] wrote:
I personnaly have seen really
flakey behavior from that history 
controller. I have posted
before, but have not been able to see a 
good resolution
--- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED] 
wrote:
 My case:
 
 - saveState is executed 
 - On Back
loadState is executed.
 
 But.
 Than my state is
undefined
 
 
 private var
changed:Boolean;

 

 public function initHistory():Void {

 
mx.managers.HistoryManager.register(this);

 
storeInternalState();

 }

 

 public function saveState():Object {

  // called by
HistoryManager, tells the component

  // to create a
state object and to return it\

  var state = new
Object();

  state.model =
Model.getInstance();

  state.view =
this._scope.m_detailview;

  

 
mx.controls.Alert.show
   
(+this._scope.m_detailview.visible);

 
Log.debug(hello+state);

  return state;

 }

 

 public function loadState(state:Object):Void {

  // called by
HistoryManager, passes in a state

  // object so the
component can rebuild it's state

 
mx.controls.Alert.show(state: +state.view);

 
restoreInternalState(state);

 }

 

 public function savePresent():Void {

  storeInternalState(
);

 }
 

 public function storeInternalState():Void {

 
mx.managers.HistoryManager.save();

 }

 

 public function restoreInternalState(state:Object):Void
{

  Log.dump(state);

  Log.debug
   
(state.view.visible: +state.view.visible);

  

 
if(state.view.visible == true  
this._scope.m_detailview.visible
==
 false ||

  
 
 state.view.visible == false 


this._scope.m_detailview.visible == true){

 
 toggleView();

  }
 

Model.getInstance

RE: [flexcoders] Re: HistoryManger state is undefined on loading

2005-07-12 Thread Matt Chotin










In looking at the code it looks like
anything that isnt an object will be returned as a string. All strings
turn themselves to true when examined as a Boolean so you may need to do string
comparison instead. Sorry, not much more help than that since I dont
know that code very well.



Matt











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of rockmoyosa
Sent: Tuesday, July 12, 2005 12:17
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re:
HistoryManger state is undefined on loading





I'm beginning to get the idee that this part of Flex is pushed in 1.5
(Or what version it was introduced). No
documentation is minimal so
are the supported functionality. 

I hope somebody can prove me wrong.

be continued??


--- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED] wrote:
 --- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED] wrote:
  This thing is really weird:
  
  first save state:
  
  DEBUG: - saveState 
  
   DUMP START  
  this:Object
 
| view = false (boolean)
 
| detailId =
7bd21a76-b716-4501-a196-1acf4265d847 (string)
  
  
  And if I click on Back:
  
  DEBUG: - loadState 
  
   DUMP START  
  this:Object
 
| detailId =
7bd21a76-b716-4501-a196-1acf4265d847 (string)
 
| view = true (string)
  
  What the @[EMAIL PROTECTED] view = true??? ...
More documentation on the
  HistoryManager would be appreciated. Are
perhaps more samples. 
  
  I found one but it to damn
simple it doesn't say anything on how
  it's working only how to use it for
simple things.
  
 

http://www.richinternet.de/blog/index.cfm?mode=entryentry=3CF01C8E-CFBB-A5CA-36BCC797581D2CFB
  
  
  
  --- In flexcoders@yahoogroups.com,
jacksodj [EMAIL PROTECTED] wrote:
   I personnaly have seen really
flakey behavior from that history 
   controller. I have posted before,
but have not been able to see a 
   good resolution
   --- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED] 
   wrote:
My case:

- saveState is executed 
- On Back
loadState is executed.

But.
Than my state is
undefined


private var changed:Boolean;



public function initHistory():Void {

 mx.managers.HistoryManager.register(this);

 storeInternalState();

}



public function saveState():Object {

 // called by HistoryManager, tells the component

 // to create a state object and to
return it\

 var state = new Object();

 state.model = Model.getInstance();

 state.view = this._scope.m_detailview;

 

 mx.controls.Alert.show
  
(+this._scope.m_detailview.visible);

 Log.debug(hello+state);

 return state;

}



public function loadState(state:Object):Void {

 // called by HistoryManager, passes in a state

 // object so the component can rebuild it's
state

 mx.controls.Alert.show(state:
+state.view);

 restoreInternalState(state);

}



public function savePresent():Void {

 storeInternalState( );

}


public function storeInternalState():Void {

 mx.managers.HistoryManager.save();

}



public function restoreInternalState(state:Object):Void {

 Log.dump(state);

 Log.debug
   (state.view.visible:
+state.view.visible);

 

 if(state.view.visible == true  
   this._scope.m_detailview.visible ==
false ||

  
 
state.view.visible == false 
   
this._scope.m_detailview.visible
== true){

  toggleView();

 }


Model.getInstance().restoreInstance(state.model);

}




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



  
  





  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











RE: [flexcoders] Re: HistoryManger state is undefined on loading

2005-07-07 Thread Matt Chotin










Yes, I think all history manager
information is stored as strings so type is not going to be maintained and youll
need to deal with that in your loadState method.



Matt











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of rockmoyosa
Sent: Thursday, July 07, 2005 7:18
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re:
HistoryManger state is undefined on loading





I tell what happened. state. objects are now STRINGS(!?)

 DUMP START  
this:Object
| model
= [object Object] (string)
| view =
false (string)

I can overcome the view by:
var detailVisible = Boolean(state.view ==
true);

But for model it's a different story.



--- In flexcoders@yahoogroups.com,
rockmoyosa [EMAIL PROTECTED] wrote:
 My case:
 
 - saveState is executed 
 - On Back loadState is executed.
 
 But.
 Than my state is undefined
 
 
 private var changed:Boolean;
  
  public
function initHistory():Void {
 
 mx.managers.HistoryManager.register(this);
 
 storeInternalState();
  }
  
  public
function saveState():Object {
 
 // called by HistoryManager, tells the component
 
 // to create a state object and to
return it\
 
 var state = new Object();
 
 state.model = Model.getInstance();
 
 state.view = this._scope.m_detailview;
 
 
 

mx.controls.Alert.show(+this._scope.m_detailview.visible);
 
 Log.debug(hello+state);
 
 return state;
  }
  
  public
function loadState(state:Object):Void {
 
 // called by HistoryManager, passes in a state
 
 // object so the component can rebuild it's
state
 
 mx.controls.Alert.show(state:
+state.view);
 
 restoreInternalState(state);
  }
  
  public
function savePresent():Void {
 
 storeInternalState( );
  }
 
  public
function storeInternalState():Void {
 
 mx.managers.HistoryManager.save();
  }
  
  public
function restoreInternalState(state:Object):Void {
 
 Log.dump(state);
 
 Log.debug(state.view.visible:
+state.view.visible);
 
 
 
 if(state.view.visible == true 
this._scope.m_detailview.visible ==
 false ||
 
  
 
state.view.visible == false 
 this._scope.m_detailview.visible == true){
 
  toggleView();
 
 }
 

Model.getInstance().restoreInstance(state.model);
  }




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



  
  





  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.