Live Move Events like Live Resize Events

0
0

Hi, All,

I’m working on an application that will display connections (lines/curves) using the canvas, between controls, on a form/panel.

(Proof of concept, learning, practicing for other migrations, not really trying to reinvent the wheel…)

The basic logic is working.

For the “Designer Mode” I would like to have the connections redraw live as a control is moved.

I have this working for control resizing, using the javascript InitScript “this.setUseResizeFrame(false);”

The speed is OK for the very few times this would be needed.

I would like to know how to have the same live events for moving a control.

So far have not found any guidance to achieve that.

I have implemented the startmove, move and endmove event handlers, but the connection redraw is only done after the move is complete.

Any advice will be appreciated.

Thanks,

Geoff

  • You must to post comments
0
0

You can use the MouseMove event. Note that MouseMove is a “lazy event”- it is not fired unless you attach to it. https://docs.wisej.com/docs/controls/general/lazy-events#lazy-events

You’ll want to attach to the MouseMove event when you start moving the control (startmove) and detach when you stop moving the control (endmove). Otherwise the event will fire too often, eg when you are moving the mouse around on top of the control and not dragging it.

Code to attach to the MouseMove event for picturebox1:

this.pictureBox1.MouseMove += new Wisej.Web.MouseEventHandler(this.pictureBox1_MouseMove);

MouseMove documentation: https://docs.wisej.com/api/wisej.web/general/control#mousemove

Inside the handler for the MouseMove event (ie pictureBox1_MouseMove), call your code to draw the lines between the controls.

 

Hope this helps!

Julie

  • You must to post comments
0
0

Hi, Julie,

Attached is the actual code, trimmed down to fit the file upload size limit.

I have confirmed that it works in this reduced form.

If you resize a control on the right side of the form, the curves will track ‘live’ – vertical is best.

I need to have the same behaviour when a control on the left side of the form is moved (resize is not implemented on the left side controls).

Thanks,

Geoff

  • Julie (ITG)
    To clarify- you mention a “Designer Mode”. I ran your sample and I see the lines being drawn at runtime, but not in the Wisej.NET Designer. Your “Designer Mode” is referring to your application at runtime, not the Wisej. NET Designer, correct?
  • Geoff Sorensen
    Yes, that’s correct.
  • You must to post comments
0
0

Hello,

Can you please provide a small runnable test case that shows what you have implemented so far, so that we can better assist you?

Thanks,

Julie

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.