S
simonrigby_uk
Hi folks,
Small issue with sender argument in mouse events.
I have a container control that users can add instances to of a another
control at runtime. In response to the user adding a new control (Task)
to the container (Pad), I create a new instance of Task, add two
handlers, one for MouseUp and one for MouseDown and then add the Task
to Pad.Controls.
I then want the user to be able to link them by dragging from one to
the other, so the user MousesDown on one instance and MousesUp one
another.
If i quiz the sender argument in the MouseDown delegate and the MouseUp
delegate it seems that sender is always the instance that raised the
MouseDown. I have quizzed the hascodes of the sender as well as
declaring a private member of the Task when its created that just
records the time it was created.
Both instances of the Task control are unique (different hashcodes,
different private variable values, instanceA.Equals(instanceB) ==
False).
Its like the sender remembers the instance that raised the MouseDown.
Any help greatly appreciated.
Bonnie, if you read this, your help got me through making sure they
were unique instances but still the same problem.
Cheers
Simon Rigby
Small issue with sender argument in mouse events.
I have a container control that users can add instances to of a another
control at runtime. In response to the user adding a new control (Task)
to the container (Pad), I create a new instance of Task, add two
handlers, one for MouseUp and one for MouseDown and then add the Task
to Pad.Controls.
I then want the user to be able to link them by dragging from one to
the other, so the user MousesDown on one instance and MousesUp one
another.
If i quiz the sender argument in the MouseDown delegate and the MouseUp
delegate it seems that sender is always the instance that raised the
MouseDown. I have quizzed the hascodes of the sender as well as
declaring a private member of the Task when its created that just
records the time it was created.
Both instances of the Task control are unique (different hashcodes,
different private variable values, instanceA.Equals(instanceB) ==
False).
Its like the sender remembers the instance that raised the MouseDown.
Any help greatly appreciated.
Bonnie, if you read this, your help got me through making sure they
were unique instances but still the same problem.
Cheers
Simon Rigby