DataGrid: Selecting a row by single/double clicking 
Author Message
 DataGrid: Selecting a row by single/double clicking
One last question on datagrids and I'll leave y'all along...

In my project I display a grid full of data from a recordset object in one
form.

What I want is to be able to double-click anywhere in a row and pop-up
another form to display that record field by field.

When I double-click in the "row selector" column, everything works just as
I'd like it to.  I put my code in the DataGrid1_DblClick() event.

If I try clicking on a data cell, it actually takes *3* click for things
to work.  The first click seems to select the cell, then the next 2 clicks
seem to fire the DblClick event.

Is there someother event I should be trapping to get the desired behaviour
when double-clicking on a data cell?

Once again, I *have* snooped in the docs and the object browser looking
for likely events, but I haven't found anything.

Once again, clues would be vastly appreciated!

Ooops... Just one more, please?

In the second form where I display a single record, I've added basic
recordset navigation (ie. MoveNext, MovePrevious).  Because I've passed a
reference to the form1 (w/ the grid) record object to form2 (the single
rec form), when I navigate on form2, I can see the little arrow in the
row selector column moving up and down just fine.

Unhappily, the dark backgroud of the row I orignally selected doesn't
move.

Is there some way I can either move the dark backgroud with the row
selector arrow (i.e. some event + some property in the datagrid) or can I
simply "un-darken" the originally selected row?

Simeon

--
The address in the header *is* actually replyable.
If replying, use mail or post here.  Please, not both

If you're not outraged, you're not paying attention



Tue, 11 Oct 2005 13:45:38 GMT  
 DataGrid: Selecting a row by single/double clicking
Simeon,

I'm only going to tackle the "three click thing".
In a datagrid, the row itself doesn't change the same way it would if you
use a keystroke.
You can examine this yourself by going into the rowcolchange event :
There are two values in this event
LastRow As Variant, ByVal LastCol As Integer
Until the row is actually changed which is what begins on your
first click right up until the time you actually change to the new
row, there are a series of other events that must be triggered first.
In the past, I've made attempts to force the click event to
autochange the row on the focus using the mousedown and
mouseup event, but it was never very satisfactory.

My suggestion is that you may want to investigate using a subroutine
that is triggered by the first click which will call the row col change
event by keeping track of the row and col globally.  It isn't a very
effective method and makes the grid a not so useful tool.  Others
may have a suggestion for this, but I would be wary of the solution.
It was never solved by TrueGrid in their Version 5.  Supposedly
in version 6, the events trigger at cell level rather than row and col
level and the click is fixed.  I never bothered testing it because at the
time, the company I was working for wanted it to work with v5.

Giacomo

event that headers

Quote:
> One last question on datagrids and I'll leave y'all along...

> In my project I display a grid full of data from a recordset object in one
> form.

> What I want is to be able to double-click anywhere in a row and pop-up
> another form to display that record field by field.

> When I double-click in the "row selector" column, everything works just as
> I'd like it to.  I put my code in the DataGrid1_DblClick() event.

> If I try clicking on a data cell, it actually takes *3* click for things
> to work.  The first click seems to select the cell, then the next 2 clicks
> seem to fire the DblClick event.

> Is there someother event I should be trapping to get the desired behaviour
> when double-clicking on a data cell?

> Once again, I *have* snooped in the docs and the object browser looking
> for likely events, but I haven't found anything.

> Once again, clues would be vastly appreciated!

> Ooops... Just one more, please?

> In the second form where I display a single record, I've added basic
> recordset navigation (ie. MoveNext, MovePrevious).  Because I've passed a
> reference to the form1 (w/ the grid) record object to form2 (the single
> rec form), when I navigate on form2, I can see the little arrow in the
> row selector column moving up and down just fine.

> Unhappily, the dark backgroud of the row I orignally selected doesn't
> move.

> Is there some way I can either move the dark backgroud with the row
> selector arrow (i.e. some event + some property in the datagrid) or can I
> simply "un-darken" the originally selected row?

> Simeon

> --
> The address in the header *is* actually replyable.
> If replying, use mail or post here.  Please, not both

> If you're not outraged, you're not paying attention



Tue, 11 Oct 2005 19:50:30 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Double-click vs single-click on macro button

2. System tray icon, single click event fires before double click

3. Double clicks and single clicks

4. How to differ double click from single click?

5. Column Value of a Clicked/Selected Row in a DataGrid

6. Single/double clicks

7. Single vs Double mouse click

8. Double-click on Grid Row

9. Datagrid double click

10. Double click in datagrid

11. Mouse disappears after double click in datagrid

12. Double-click to open selected record...

 

 
Powered by phpBB® Forum Software