Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Method that handles the GroupDestroyed event. (Read 4080 times)
mbg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Mar 25th, 2009
Method that handles the GroupDestroyed event.
Mar 25th, 2009 at 8:16am
Print Post  
Hallo,

Method that handles the GroupDestroyed event doesn't work as I expect?

I work with FlowChartX 4.2 via the OCX interface.

If this event is triggered the group parameter has always a count (vBoxNr) of zero while there are still boxes in this group?
I know that the group is the correct group because the group Tag number is the number I expect.

Can somebody tell me what I do wrong here?

Thanks in advance.



Here my event source code:


trigger GroupDestroyed
  params
       handle group : inout
endparams

variables
      Handle vBoxes, vBox
      Numeric vBoxNr, vTag
endvariables

group->Get_AttachedBoxes(vBoxes)
vBoxes->Get_Count(vBoxNr)   ???
group->Get_Tag(vTag)             Smiley

putmess "GroupDestroyed: found %%vBoxNr boxes to delete of the group with Tag:%%vTag"

while (vBoxNr > 0)
       vBoxNr -= 1
       vBoxes->Get_Item(vBox, vBoxNr)
       $FlowChartX$->DeleteItem(vBox)
endwhile

end ; trigger GroupDestroyed
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Method that handles the GroupDestroyed event.
Reply #1 - Mar 25th, 2009 at 9:47am
Print Post  
What kind of language are you using? This worked for me in VB6:

Private Sub fcx_GroupDestroyed(ByVal group As FLOWCHARTLibCtl.IGroupItem)
     For Each b In group.AttachedBoxes
           fcx.DeleteItem b
     Next b
End Sub

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mbg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Mar 25th, 2009
Re: Method that handles the GroupDestroyed event.
Reply #2 - Mar 25th, 2009 at 2:12pm
Print Post  
I use Uniface Proc language that communicate with FlowChartX  via OCX layer. But I think that this problem is language independent. 

The group I get via  the "GroupDestroyed" event is correct because it is the same tag number I used for creation. And this event is fired because the main box that hold the group is destroyed.  Although the Get_Tag function seems to be the only function which return correct information others functions don't.  It looks like that the group is already partly cleaned up.

If I run this same routine out side the "GroupDestroyed" event it works fine! (before the main box is destroyed)

Second issue:
I also run  into a second issue which look like the same kind of problem. This is with the event "RequestDeleteBox" where also only the Get_Tag function seems to be the only function which return correct information.  And if I return on this event with a  delete="false" to cancel the operation the box is still deleted?


Just for your information: my complete application works fine besides from this 2 issues.  Other events are working fine Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Method that handles the GroupDestroyed event.
Reply #3 - Mar 25th, 2009 at 2:37pm
Print Post  
It shows the correct Count in VB6. If you need this only to delete the attached boxes, you could use the Group.DeleteSubordinates() method:

Code
Select All
Private Sub fcx_GroupDestroyed(ByVal group As FLOWCHARTLibCtl.IGroupItem)
	MsgBox Str(group.AttachedBoxes.Count)
	group.DeleteSubordinates
End Sub
 



You might also try accessing Count using "Get_count" with lower case 'c'. VB6 shows 'count' in the code completion dropdown, so the case might be related to the problem.

The pbDelete argument of RequestDeleteBox is defined as [in, out] in the IDL. Have you applied to it that same 'inout' modifier I can see in the params section under your trigger GroupDestroyed code?

Stoyan
  
Back to top
 
IP Logged
 
mbg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Mar 25th, 2009
Re: Method that handles the GroupDestroyed event.
Reply #4 - Mar 25th, 2009 at 4:01pm
Print Post  
(A)
If I use the DeleteSubordinates() I get this Error:

Windows exception 0xc0000005 (EXCEPTION_ACCESS_VIOLATION) occurred in external COM method "DeleteSubordinates"

And I can not find any information in the documentation about "DeleteSubordinates" function.


(B)
Get_count" with lower case 'c' also didn't help.


(C)
Hereby my used source code:

trigger RequestDeleteBox
   params
     handle pBox : inout
     boolean pbDelete : inout
   endparams

   pbDelete = "false"

end ; trigger RequestDeleteBox
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Method that handles the GroupDestroyed event.
Reply #5 - Mar 25th, 2009 at 4:08pm
Print Post  
Does that Uniface Proc language has a compiler? If you send us a compiled executable file, our developer will trace through the flowchartx code to see what happens.
  
Back to top
 
IP Logged
 
mbg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Mar 25th, 2009
Re: Method that handles the GroupDestroyed event.
Reply #6 - Mar 26th, 2009 at 8:21am
Print Post  
It is not easy to run a Uniface application because it doesn't create an executable file, you need a Uniface environment.
Currently I will program around these problems. Later I will debug FlowChartX if we have have the source code. (still running with the trial version)

Thanks for your help.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint