Crainiate Community

Support and discussion for users of Crainiate component software products
Welcome to Crainiate Community Sign in | Join | Help
in Search

Ireneusz Patalas please come in , need your help again.

Last post 08-23-2007 10:02 PM by James Westgate. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 08-23-2007 7:07 AM

    Ireneusz Patalas please come in , need your help again.

    This is my question that you answered for me. http://support.crainiate.net/Community/forums/t/205.aspx First thanks a lot. I already did like you told me, but something looks does not like you said. Anyway, maybe I am a newer for this tool, I will keep going. this time my question is could you tell me how to capture/handle line.Start.DockChanged event ?

    • 64.59.144.88
  • 08-23-2007 8:30 AM In reply to

    Re: Ireneusz Patalas please come in , need your help again.

    I do not exactly understand what do you mean by "how to capture .... event", could you please describe it more precisely ?
    • 87.105.212.19
  • 08-23-2007 5:14 PM In reply to

    Re: Ireneusz Patalas please come in , need your help again.

    Below is what you said :

    As I wrote earlier you have to detect whether the connection was changed.

    e.Actions[0] is the new line
    e.Actions[1] is the old Start docked element
    e.Actions[2] is the old End docked element

    All you have to do is to compare the newline.Start.DockedElement with e.Actions[1] and the same for the End element respectively. If they are all the same, the connection was not changed and you don't have to perform any special actions.

    This line.Start.DockChanged and line.End.DockChanged events seems to be better (and they are not raised if you just move a line).
    I didn't know about that. I am wondering if I can still restore the connection in that event. CanDock won't help me, because when I return false there and release the button on forbidden element the connection will be left unconnected on that element, which is not good for me. It should be restored to its previous state.
    I do it by changing the connector.Start.Shape and connector.End.Shape, but will this DockChanged event be called then ?
    It could cause a forever loop when changed from inside of this event, so maybe I should remove these event handler for a moment of restoring the line or is it safe ?
     
    There is a stentence : "This line.Start.DockChanged and line.End.DockChanged events seems to be better", I just want to know how to use these events ?
    • 64.59.144.88
  • 08-23-2007 5:15 PM In reply to

    Re: Ireneusz Patalas please come in , need your help again.

    Below is what you said :

    As I wrote earlier you have to detect whether the connection was changed.

    e.Actions[0] is the new line
    e.Actions[1] is the old Start docked element
    e.Actions[2] is the old End docked element

    All you have to do is to compare the newline.Start.DockedElement with e.Actions[1] and the same for the End element respectively. If they are all the same, the connection was not changed and you don't have to perform any special actions.

    This line.Start.DockChanged and line.End.DockChanged events seems to be better (and they are not raised if you just move a line).
    I didn't know about that. I am wondering if I can still restore the connection in that event. CanDock won't help me, because when I return false there and release the button on forbidden element the connection will be left unconnected on that element, which is not good for me. It should be restored to its previous state.
    I do it by changing the connector.Start.Shape and connector.End.Shape, but will this DockChanged event be called then ?
    It could cause a forever loop when changed from inside of this event, so maybe I should remove these event handler for a moment of restoring the line or is it safe ?
     
    There is a sentence : "This line.Start.DockChanged and line.End.DockChanged events seems to be better", I just want to know how to use these events ?
    • 64.59.144.88
  • 08-23-2007 9:42 PM In reply to

    Re: Ireneusz Patalas please come in , need your help again.

    The 'line' in that sentence is a Crainiate.ERM4.Connector class that has a property Start and End (which corresponds to the beginning and end of the line), both of type Crainiate.ERM4.Origin. That Origin has the event we are talking about and you can add a handler to it.
    If you want to add a handler to all of the lines at once, it might be better to subclass the Connector class and add proper event handlers in the constructor or sth like that. Then you can use that class instead of original Connector when adding new elements. It can even be overriden, so you don't have to worry about connectors created by the component itself (ie. when adding a connector in interactive mode, where you don't have control over elements creation).
    • 212.109.132.242
  • 08-23-2007 10:02 PM In reply to

    Re: Ireneusz Patalas please come in , need your help again.

    Refer to the Model.Runtime.Create* factory methods for items that are created at runtime interactively. Override this class to allow interactive users to create instances of your own custom classes.

    • 81.156.197.178
Page 1 of 1 (6 items)