Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Serializing AnchorPatterns (Read 6603 times)
Remko
YaBB Newbies
*
Offline



Posts: 12
Joined: Dec 7th, 2005
Serializing AnchorPatterns
Jan 5th, 2006 at 12:06pm
Print Post  
Hi,
one quick question, are AnchorPatterns created for a BoxItem serialized with the flowchart ?

Remko
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Serializing AnchorPatterns
Reply #1 - Jan 5th, 2006 at 1:03pm
Print Post  
Hi,

Only pattern's PatternId is saved. When a patternId is loaded from a file, the AnchorPattern with that id must be defined in your application.

Stoyan
  
Back to top
 
IP Logged
 
Remko
YaBB Newbies
*
Offline



Posts: 12
Joined: Dec 7th, 2005
Re: Serializing AnchorPatterns
Reply #2 - Jan 5th, 2006 at 1:16pm
Print Post  
Ok,
I guessed as much, but that brings me to the next problem/challenge.

When i try to serialize the Pattern myself with
Code
Select All
// stream out the dockingPoints
	  long anchorPoints = m_dockingPoints.GetAnchorPointCount();
	  ar << anchorPoints;
	  for ( long i = 0; i < anchorPoints; i++ ) {
		m_dockingPoints.GetAnchorPoint( i, &x, &y, &in, &out, &mark, &color, &chArrStyle, &arrStyle, &segments );
		ar << x << y << in << out << mark << color;
	  }
 



I am rewarded with a rather undescriptive OleException, any ideas ?.


(a thought just hit me, could it have to do with the VARIANT_BOOL vs. BOOL size problem in MFC wrappers ?)


Remko
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Serializing AnchorPatterns
Reply #3 - Jan 5th, 2006 at 1:33pm
Print Post  
Is there any HRESULT code mentioned ?

The VARIANT_BOOL vs. BOOL problem happens when overwriting a VARIANT_BOOL value through a BOOL pointer, i.e. writing 4 bytes to 2-bytes memory location . GetAnchorPoint gets VARIANT_BOOL values through BOOL* pointers, writing 2-bytes to 4-bytes memory location, so there should not be a problem with that.

Stoyan
  
Back to top
 
IP Logged
 
Remko
YaBB Newbies
*
Offline



Posts: 12
Joined: Dec 7th, 2005
Re: Serializing AnchorPatterns
Reply #4 - Jan 5th, 2006 at 1:45pm
Print Post  
Stepping through the call I found:

Warning: constructing COleException, scode = DISP_E_TYPEMISMATCH ($80020005).




to be complete, the exception is thrown in the GetAnchorPoint method(), so I'm pretty shure it's not the m_dockingPoints being invalid as the GetAnchorPointsCount() yields the expected result.


Remko
  
Back to top
 
IP Logged
 
Remko
YaBB Newbies
*
Offline



Posts: 12
Joined: Dec 7th, 2005
Re: Serializing AnchorPatterns
Reply #5 - Jan 5th, 2006 at 2:07pm
Print Post  
Some more info,

after
Code
Select All
SCODE sc = m_lpDispatch->Invoke(dwDispID, IID_NULL, 0, wFlags,
&dispparams, pvarResult, &excepInfo, &nArgErr);
 



nArgErr == 3

which would be the BOOL *in parameter

which is defined as
Code
Select All
static BYTE parms[] =
VTS_I4 VTS_PI2 VTS_PI2 VTS_PBOOL VTS_PBOOL VTS_PI4 VTS_PI4 VTS_PBOOL VTS_PI4 VTS_PI2;
 


i.e. VTS_PBOOL,  in the generated MFC wrappers.

Remko
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Serializing AnchorPatterns
Reply #6 - Jan 5th, 2006 at 2:10pm
Print Post  
That could be returned by the standard OLE implementation of IDispatch. Try calling the method directly through the VTBL IFlowChart* pointer; that will bypass the IDispatch parameter translation layer. I.e. use the "flowchart'h" included with the control and query for IID_IFlowChart, then call the GetAnchorPoint method using the exact parameter types.

Stoyan
  
Back to top
 
IP Logged
 
Remko
YaBB Newbies
*
Offline



Posts: 12
Joined: Dec 7th, 2005
Re: Serializing AnchorPatterns
Reply #7 - Jan 5th, 2006 at 2:32pm
Print Post  
My memory is definitly deteriorating Sad

I just found that I've had the same problem while handling the OnDrawMark event ....  Embarrassed
Code
Select All
   IUnknown *unknown = m_dockingPoints.m_lpDispatch;
		IAnchorPattern *pat;
		unknown->QueryInterface( &pat );
		pat->GetAnchorPoint( i,
				     &px,
				     &py,
				     &in,
				     &out,
				     &mark,
				     &color,
				     &changeStyle,
			    &style,
			    &segments );
 



works just fine.

(that reminds me that there is a problem when you mix the standard flowchart.h and the MFC wrappers, several types get defined in both versions .... minor problem though)


Yet again, thanks for the support,
Remko
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Serializing AnchorPatterns
Reply #8 - Jan 5th, 2006 at 2:43pm
Print Post  
It seems that GetAnchorPattern method is undocumented and was implemented for internal use - the XmlWriter uses it. So the XmlWriter writes all information related to an anchor pattern, but in binary format only the pattern id is saved.

Stoyan
  
Back to top
 
IP Logged
 
Remko
YaBB Newbies
*
Offline



Posts: 12
Joined: Dec 7th, 2005
Re: Serializing AnchorPatterns
Reply #9 - Jan 6th, 2006 at 8:18am
Print Post  
Ok, I allready had a suspicion it might be internal (the function not being mentioned in the docs was a bit of a giveaway Smiley).

But OTOH GetAnchorPoint() is quite usefull when you need to get info about anchorpatterns, so maybe you could add it to the list of feature requests ?.


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Serializing AnchorPatterns
Reply #10 - Jan 6th, 2006 at 9:19am
Print Post  
Sure, and we'll probably implement some more humane way to get anchor point information, e.g. with and array of AnchorPoint objects that expose their info  as properties.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint