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
_______________________________________