| View previous topic :: View next topic |
| Author |
Message |
Dave Barcomb Guest
|
Posted: Thu Jun 22, 2006 9:29 pm Post subject: onStartDrag event ? |
|
|
I would like to drag items from a TMaskedit component, but not lose the
edit capability. I actually have this working, but to get this to work
I have to use the Mouse down event to set the beginDrag method to
false. When I use the mouse down event I do NOT get an onStartDrag
event even though my drag mode is dkDrag. Without an onStartDrag event
I cannot create my drag object and image for the drag cursor.
I have this all working using a button to switch from dmManual mode
where my edit capability works and then using the button to switch to
dmAutomatic mode where the drag works with an onStartDrag event.
However, if I can get the onStartDrag event with the mouse down event
in the dmManual mode then I can have everything working without a
button.
I have a Groupbox on a form that has a frame put into it and the frame
contains rows of TPanels that are dynamically generated at run time.
Inside these TPanels are dynamically generated TMaskEdit boxes that I
am trying to work with above. The Frame is the parent of the Tpanels
and the Tpanels are the Parents of the TMaskEdit boxes.
I have seen some postings about Borland bugs with the onStartDrag
event, but the bugs seemed a little different then the problem I am
seeing.
Any ideas on what to try or pointers to other onStartDrag bug info?
Thanks
Dave Barcomb |
|
| Back to top |
|
 |
JD Guest
|
Posted: Fri Jun 23, 2006 3:32 am Post subject: Re: onStartDrag event ? |
|
|
"Dave Barcomb" <vtmogulskier (AT) adelphia (DOT) net> wrote:
| Quote: |
[...] using a button to switch from dmManual mode where my
edit capability works and then using the button to switch to
dmAutomatic mode where the drag works
|
Set the DragMode to dmManual and in the OnMouseDown event, call
BeginDrag with the Imediate parameter set to false and some
Threshold value.
Another option is to record the click point in the OnMouseDown
event and add an OnMouseMove event where you compare the click
point with the current point and decide if your threshold has
been reached and if so, call BeginDrag.
| Quote: | I have seen some postings about Borland bugs with the
onStartDrag event,
|
No bugs - just buggy code.
~ JD |
|
| Back to top |
|
 |
Dave Barcomb Guest
|
Posted: Fri Jun 23, 2006 6:36 pm Post subject: Re: onStartDrag event ? |
|
|
JD wrote:
| Quote: |
dmAutomatic mode where the drag works
|
Set the DragMode to dmManual and in the OnMouseDown event, call
BeginDrag with the Imediate parameter set to false and some
Threshold value.
This is what I am doing now. I don't think I was as clear as I
wanted to be. The problem is that when I do this I do not get an
onStartDrag event. The event never happens. I set a breakpoint and the
onStartDrag event only occurs when I set the drag mode to dmAutomatic.
Thanks
Dave Barcomb
-- |
|
| Back to top |
|
 |
JD Guest
|
Posted: Fri Jun 23, 2006 11:26 pm Post subject: Re: onStartDrag event ? |
|
|
"Dave Barcomb" <vtmogulskier (AT) adelphia (DOT) net> wrote:
| Quote: |
[...] The problem is that when I do this I do not get an
onStartDrag event.
|
What is the Threshold parameters set to? Are you moving the
mouse far enough to break the threshold to cause the event to
be triggered? What does your actual code look like?
~ JD |
|
| Back to top |
|
 |
Dave Barcomb Guest
|
Posted: Tue Jun 27, 2006 6:33 pm Post subject: Re: onStartDrag event ? |
|
|
JD wrote:
| Quote: |
What is the Threshold parameters set to? Are you moving the
mouse far enough to break the threshold to cause the event to
be triggered? What does your actual code look like?
|
The Threshold parameter is set to 5. I figured out what was happening.
I get an onStartDrag event for the frame. I mentioned that I had a
Frame with dynamically allocated Tpanel boxes which then have TmaskEdit
boxes. When in DmAutomatic mode the TMaskEdit components get the
onStartDrag event. However, in manual mode the onStartDrag event only
goes to the frame which is the parent of the Tpanels. The Tpanel is the
parent of the TMaskEdit components. I tested the TPanel and the
onStartDrag event does not go there in dmManual mode.
I think this is a known Borland Delphi bug. I found something while
browsing one day, but I cannot find it again. How can I look up known
Delphi bugs?
The only problem I have with my work around is that I have to save a
variable in the BeginDrag method so that I will have the component
information that I need but do not get with the frame onStartDrag event.
The frames are then put into a Tgroupbox. The code is pretty simple and
I can post later if you think it's my bug and not Delphi. Thanks for
the offer. I have been struggling with Delphi for 6 weeks now, and I'm
starting to get the hang of it. It's really nice when it works right. I
can create test apps really quickly now.
Dave Barcomb
-- |
|
| Back to top |
|
 |
|