Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Restrict boxes to containers (Read 4023 times)
jgedrim
YaBB Newbies
*
Offline


FCX works. I like it.

Posts: 4
Joined: Jul 20th, 2011
Restrict boxes to containers
Jul 23rd, 2011 at 8:48am
Print Post  
Hi,

I am trying to keep boxes contained within one of a set of containers but with erratic results. (v4.4)
hosted in web page with vbscript.

1) I am using drag drop from one fcx document to another by using DragDropMode = drProgrControlVB

This works succesfully to drag drop a box into a container but also allows me to drop in the document even though I have a handler as follows:

Public Sub WorkArea_DragOverDocVB(ByVal dataObj, ByVal docX, ByVal docY, ByVal keyState, byref effect)
       effect = vbDropEffectNone
End Sub

I do not get the not allowed icon and the rop succeeds.

2) I respond to the event ObjectDroppedInBox and am able to move the box from one container to another and resize it to fit but cannot stop it from being dropped into the document body.

3) I respond to the event BoxModifying and even though I can see that the box is being resized bigger than the container, I cannot resize it programmatically from within the event handler. Setting Confirm = False also has no effect.

Do you have any ideas on this?

Thanks
John


  
Back to top
 
IP Logged
 
Iva
Junior Member
**
Offline


MindFusion support

Posts: 55
Joined: Aug 6th, 2005
Re: Restrict boxes to containers
Reply #1 - Jul 23rd, 2011 at 2:44pm
Print Post  
Hi John,

I have reproduced the drag&drop problem. The value set with ByRef in the event handler when used in a VB Script web page is not received by the control. We are trying to find out the reason, in a desktop VB project everything works as expected.

I am sure your 3rd question is caused by the same problem. We're trying hard to figure out a solution as quickly as possible.

Regards,
Iva
  
Back to top
 
IP Logged
 
jgedrim
YaBB Newbies
*
Offline


FCX works. I like it.

Posts: 4
Joined: Jul 20th, 2011
Re: Restrict boxes to containers
Reply #2 - Jul 24th, 2011 at 8:08am
Print Post  
Hi Iva,

Your reply reminded me of a problem I had before with creating ActiveX controls for embedding in web pages, so I whipped one together in VB and found the following.

1) VBScript does not support type declarations e.g. integer, string, boolean etc.

2) For byref parameters to work in event handlers in vbscript, they have to be declared as type variant in the ActiveX control that raises the event.

e.g. 1 (This does not work)

Sub DoSomething()
   dim Cancel as boolean

   RaiseEvent SomeEvent(Cancel)
   if Cancel then
     ---
   else
     ---
   end if
end sub

e.g. 2 (This does work)
Sub DoSomething()
   dim Cancel as variant

   RaiseEvent SomeEvent(Cancel)
   if cbool(Cancel) then
     ---
   else
     ---
   end if
end sub


3) I know that FlowChartX is written in C++, but chances are that the same logic applies.

4) Hopefully there is a better way of handling this without having to change the FlowChart ActiveX control, so I will keep looking for another solution.

5) The worst case may be for me to embed the flowchart object into a custom control and create my own event handlers with variant parameters. I will just need the licencing implications from you to do this.

Thanks and regards
John

  
Back to top
 
IP Logged
 
jgedrim
YaBB Newbies
*
Offline


FCX works. I like it.

Posts: 4
Joined: Jul 20th, 2011
Re: Restrict boxes to containers
Reply #3 - Jul 24th, 2011 at 9:00am
Print Post  
I checked this on Microsoft's website and found knowldge base article 253282.

It states:

[color=Blue]The default OLE Automation Marshaller cannot convert a strongly-typed ByRef parameter into a ByRef Variant, so it converts the parameter into a normal ByVal Variant, and passes that to the scripting engine.

To allow Visual Basic Script (VBScript) event handlers to change parameter values of events that are fired by Visual Basic ActiveX controls, declare the parameters as ByRef Variants.[/color]


This is the result that I got with the tests above. Also, even though I have not used it, any Methods with byref parameters will also not work.


The best solution then is probably for me to write my app as an ActiveX control with embedded FCX controls to handle the diagrams.

  
Back to top
 
IP Logged
 
Iva
Junior Member
**
Offline


MindFusion support

Posts: 55
Joined: Aug 6th, 2005
Re: Restrict boxes to containers
Reply #4 - Jul 24th, 2011 at 4:25pm
Print Post  
I consulted our senior developers and they said that embedding FlowChartX in a custom ActiveX control is a very good solution if you don't want to modify the control.

Regards,
Iva
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint