VFP8 SP1, XP Pro SP1

I have a grid for which, at runtime, I use BINDEVENT to bind the
MouseUp method of the headers to a Form method that creates an
index for that column if necessary, then sets the order of the
table so that it is sorted by the clicked column.

This all works great, but when the user drags a column to a
new location, the BINDEVENT also fires. Ideally, I would
like to distinguish between the dragging of a column and
the clicking of the header. That way, the user could move
the column and the table order would not change to the
column moved - only a non-dragging click on the header
would sort by that column.

It seems I always find a solution right after I post the question,
but I'm open to suggestions.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

Re: BINDEVENTS on grid header causing problem by Jack

Jack
Thu Oct 06 15:55:16 CDT 2005

On Thu, 06 Oct 2005 20:42:55 GMT, trw7at@ixdot.netcomdotcom (Tim
Witort) wrote:

>VFP8 SP1, XP Pro SP1
>
>I have a grid for which, at runtime, I use BINDEVENT to bind the
>MouseUp method of the headers to a Form method that creates an
>index for that column if necessary, then sets the order of the
>table so that it is sorted by the clicked column.
>
>This all works great, but when the user drags a column to a
>new location, the BINDEVENT also fires. Ideally, I would
>like to distinguish between the dragging of a column and
>the clicking of the header. That way, the user could move
>the column and the table order would not change to the
>column moved - only a non-dragging click on the header
>would sort by that column.

Have you tried binding to the Click event?

Re: BINDEVENTS on grid header causing problem by Dan

Dan
Thu Oct 06 16:21:33 CDT 2005

Why are you binding to MouseUp instead of Click?

Click's very definition is MouseDown followed by MouseUp without a major
change in the mouse location. (That last part is why you can mousedown, drag
off the control, and not get a click.) So on a drag, you wouldn't get click
and it would behave pretty much as you expect.

Dan


Tim Witort wrote:
> VFP8 SP1, XP Pro SP1
>
> I have a grid for which, at runtime, I use BINDEVENT to bind the
> MouseUp method of the headers to a Form method that creates an
> index for that column if necessary, then sets the order of the
> table so that it is sorted by the clicked column.
>
> This all works great, but when the user drags a column to a
> new location, the BINDEVENT also fires. Ideally, I would
> like to distinguish between the dragging of a column and
> the clicking of the header. That way, the user could move
> the column and the table order would not change to the
> column moved - only a non-dragging click on the header
> would sort by that column.
>
> It seems I always find a solution right after I post the question,
> but I'm open to suggestions.
>
> -- TRW
> _______________________________________
> t r w 7
> at
> i x dot n e t c o m dot c o m
> _______________________________________



Re: BINDEVENTS on grid header causing problem by trw7at

trw7at
Mon Oct 10 11:22:29 CDT 2005

> Tim Witort wrote:
>> VFP8 SP1, XP Pro SP1
>>
>> I have a grid for which, at runtime, I use BINDEVENT to bind the
>> MouseUp method of the headers to a Form method that creates an
>> index for that column if necessary, then sets the order of the
>> table so that it is sorted by the clicked column.
>>
>> This all works great, but when the user drags a column to a
>> new location, the BINDEVENT also fires. Ideally, I would
>> like to distinguish between the dragging of a column and
>> the clicking of the header. That way, the user could move
>> the column and the table order would not change to the
>> column moved - only a non-dragging click on the header
>> would sort by that column.

Dan Freeman seemed to utter in
news:uxemuvryFHA.3892@TK2MSFTNGP12.phx.gbl:

> Why are you binding to MouseUp instead of Click?
>
> Click's very definition is MouseDown followed by MouseUp without a
> major change in the mouse location. (That last part is why you can
> mousedown, drag off the control, and not get a click.) So on a drag,
> you wouldn't get click and it would behave pretty much as you expect.
>
> Dan

Initially I used CLick, but it behaved even worse than
MouseUp when moving the columns. At least with MouseUp,
when a column is moved, the data moves with it. When using
Click, it does not.

I've tried Click, MouseDown and MouseUp. None of them yield
the correct results. In fact, you would think that, when using
MouseUp or Click, the event would not fire if the mouse
were clicked down on the header, moved off the header, then
released. But it does. So, not only can I not get the sorting
logic to cooperate with moving the columns, but just the
header clicking alone does not work right! This is very easy
to demonstrate. Just drop a grid on an empty form and put
something like this in the click event method of one of the
headers:

SET MESSAGE TO "Clicked on "+TRANSFORM(seconds())

Run the form and test the header clicking. It will register
a click even if the mouse is moved off the header between
the mousedown and mouseup. This is incorrect behavior.

For the time being, I've set the columns' Movable property to
.F. to avoid one problem. But the header clicking bug remains.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

Re: BINDEVENTS on grid header causing problem by Dan

Dan
Mon Oct 10 12:43:43 CDT 2005

Wow. That's weird behavior for click. (And I've just repro'd it.)

Have you turned it in as a bug?

Dan


Tim Witort wrote:
>> Tim Witort wrote:
>>> VFP8 SP1, XP Pro SP1
>>>
>>> I have a grid for which, at runtime, I use BINDEVENT to bind the
>>> MouseUp method of the headers to a Form method that creates an
>>> index for that column if necessary, then sets the order of the
>>> table so that it is sorted by the clicked column.
>>>
>>> This all works great, but when the user drags a column to a
>>> new location, the BINDEVENT also fires. Ideally, I would
>>> like to distinguish between the dragging of a column and
>>> the clicking of the header. That way, the user could move
>>> the column and the table order would not change to the
>>> column moved - only a non-dragging click on the header
>>> would sort by that column.
>
> Dan Freeman seemed to utter in
> news:uxemuvryFHA.3892@TK2MSFTNGP12.phx.gbl:
>
>> Why are you binding to MouseUp instead of Click?
>>
>> Click's very definition is MouseDown followed by MouseUp without a
>> major change in the mouse location. (That last part is why you can
>> mousedown, drag off the control, and not get a click.) So on a drag,
>> you wouldn't get click and it would behave pretty much as you expect.
>>
>> Dan
>
> Initially I used CLick, but it behaved even worse than
> MouseUp when moving the columns. At least with MouseUp,
> when a column is moved, the data moves with it. When using
> Click, it does not.
>
> I've tried Click, MouseDown and MouseUp. None of them yield
> the correct results. In fact, you would think that, when using
> MouseUp or Click, the event would not fire if the mouse
> were clicked down on the header, moved off the header, then
> released. But it does. So, not only can I not get the sorting
> logic to cooperate with moving the columns, but just the
> header clicking alone does not work right! This is very easy
> to demonstrate. Just drop a grid on an empty form and put
> something like this in the click event method of one of the
> headers:
>
> SET MESSAGE TO "Clicked on "+TRANSFORM(seconds())
>
> Run the form and test the header clicking. It will register
> a click even if the mouse is moved off the header between
> the mousedown and mouseup. This is incorrect behavior.
>
> For the time being, I've set the columns' Movable property to
> .F. to avoid one problem. But the header clicking bug remains.
>
> -- TRW
> _______________________________________
> t r w 7
> at
> i x dot n e t c o m dot c o m
> _______________________________________



Re: BINDEVENTS on grid header causing problem by trw7at

trw7at
Tue Oct 11 11:56:07 CDT 2005

> Tim Witort wrote:
[snip]
>> but just the
>> header clicking alone does not work right! This is very easy
>> to demonstrate. Just drop a grid on an empty form and put
>> something like this in the click event method of one of the headers:
>>
>> SET MESSAGE TO "Clicked on "+TRANSFORM(seconds())
>>
>> Run the form and test the header clicking. It will register
>> a click even if the mouse is moved off the header between
>> the mousedown and mouseup. This is incorrect behavior.

Dan Freeman seemed to utter in news:eoXbpIczFHA.4032@TK2MSFTNGP15.phx.gbl:

> Wow. That's weird behavior for click. (And I've just repro'd it.)
>
> Have you turned it in as a bug?
>
> Dan

No I have not reported it. It seemed such an obvious problem that
surely it has been reported already. But I just duplicated it with
VFP9 on XP Pro as well, so maybe it hasn't been reported yet... or
worse yet... it's "by design."

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________