Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Movement 2

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
Hi all,
I noticed that the default behavior in a GRID is that a single click in a row will bring a row "highlight" (selected row) to that row. I have code then on the double-click event so that if you double click, it will select that item in the grid, and there is code to navigate to that record then.

What I'm wanting to do is have the behavior of the single-click to fire when the mouse enters the row instead. I tried putting This.Click in the MouseEnter event of the textbox in the grid column, but that seems to be ignored (I assume the GRID is somehow in control of mouse events and not the control in the column?)

Is there some way to do what I'm trying? I've tried several combinations of "This.Click()" in some events of various controls, but none seem to work.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
In your situation the solution is so much simpler:
Your opup form with the grid with choicec will have a pickeditem property defaulting to NULL
You only set that whn the user clicks on a row to the active item

If the user does end the form by clicking outside of it, the pickeditem is still NULL, so just like a real context menu you either have a choice and do something or no choice.

Why go through such complicated hoops?

An initial activated row means no choice, so you don't depend on the grid being able to have no active row, you bind yourself too much to the activerow as choice. The solution is to have an own property reflecting the result of the popup and it starts with no result, NULL.

Bye, Olaf.
 
Values are passed between both the calling for and return values. So the form has to be modal. To over come that, I have mouseleave event set to ThisForm.Release, and set the for 1 pixel wider than the grid itself. Maybe my way is not so elegant, and I can accept that. It was a path I started down, and knew I was close so I kept pushing that approach. Are there other approaches, it sounds like what you are saying there are, but the result behavior is still rather intuitive and I have a solution. If I had to do it again in another case, I might explore a different option, but for now, I need to move on to other problems. I know that probably makes you cringe, and I like your tenacity and your passion. You're just much more experienced at this than I am, and maybe as I keep pushing some of the more complicated things (that come easy to you) will start to make sense to me eventually. I'm not a smart guy, but I'm a persistent one.
Thanks Olaf. I have learned lots from you these past couple of years.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I thought we solved that problem of modality. Why do you still need it to be modal? Implement the pass over of THISFORM as the oCallerform.

Bye, Olaf.
 
It was still beyond my capability and to be fair, the form is kind of massive. I thought it would be problematic to pass it to the called form. This form has 8 tabs, one of which has about 300 objects on it, it seemed like it could be problematic. I was just sticking with what I felt I could implement given my skillset.

I may revisit it in the future, but at the moment, I need to get certain functionality working, and I've only got a couple of weeks. I knew the other solution was close (and even could accept the behaviour I had, though it wasn't exactly what I wanted). So this works now, and I will look at it again another day.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
If you pass an object, you pass a reference. To simplify this, you pass an address 4 Bytes, no more no less. Nothing is copied.

Bye, Olaf.
 
WOW! I had no idea. So I was worried for nothing...

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top