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!

Interactive grid item selection

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
Hi all,
I'm having a small problem with a grid I have on a form. The source of the grid is a cursor, and the grid uses interactive change to create a highlight back color on every other item for easier reading.
I also just below the grid have a text box I call "Fast Search" which allows you to enter as little or as much as you want to "narrow down" search items. To do this, I just use a "SEEK" on an indexed column, in the interactive change event of the text box. NEAR is set on so that exact matches aren't required.
I've done this kind of thing in other places, but on this form, for some reason, the grid's "current selected" record does not highlight in the darker blue with white text that you normally get when you change the record. I've tried a number of things but I can't figure out why this is happening.
Has this ever happened to anyone, and how did you fix it? Any suggestion on where I should look? It's very weird, when I didn't intuitively do anything different with this one than I have with others.

One other thing, that may be helpful... I build the grid source from a SELECT statement in the Grid's INIT event, thought that's where I've built it for other similar grids, without a problem. I've been ignoring this issue for a couple of days, but now the interface is getting polished up a bit, and this one just sticks out.

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I would create the source in the form's INIT, then you can just point the grid at it without any worries.

Are you doing a thisform.grid1.refresh after your seek and perhaps a thisform.grid1.setfocus to ensure the
interactive change is triggered.

One thing I do is link my changes to the afterrowcolchange event, not the interactive one - some changes are
programmatic not interactive

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
Hi Griff,
I do have code in the AfterRowCol change, I don't make a call to refresh in the interactive change (or a setfocus, because that has it's own set of issues, especially if you have both interactive and programatic change).


Now, I hadn't thought about creating the grid source in the form init... interesting notion. Let me give that a try, because the "link" I have now found about what grids work as expected and those that don't is whether they are "table" bound or "cursor" bound.
I'll give it a try and see what happens.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Scott, there's really no difference between a "table-bound" or a "cursor-bound" grid. Deep down, they are the same thing.

The only point to watch is that, if you create the cursor with a SELECT, it will be read-only by default. But I doubt if that's relevant to this particular problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike,
I set all the CURSORS to READWRITE when I create them (because I use the cursor with added "Ledgercontrol" field to manage the dynamicbackcolor (I think you were involved/influenced me back a few weeks ago on that point). But that isn't the issue, I don't believe, because that works similarly in other areas. It's a real mystery, which I still haven't solved. Some work, some don't and I've even copied the ones that work, put a different table/source on them and they don't work... which is a real erratic behavior that I wish I could track down, but so far eludes me still. I have in the "AfterRowCol" change in the base class "This.Click" which should have the effect of clicking the item, and highlighting the row. In the case where it doesn't "track" if I leave the object (lost focus), the "record" selection vanishes again...


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Mike,
I finally got this working... what I hate is HOW, because I still don't know why this grid and interactive change combination worked, and the other didn't. I wound up copying it from another form where I also had it working, (different place), put it in place, and then it worked... I have a copy of the original one that wasn't working and when I have time, I'll go back and see what the difference is. Strangely though, there really doesn't appear to be anything different. I had even copied and pasted the various code snippets from the one I copied over to the existing one, and still it didn't work. (I didn't copy it initially as the whole grid, as they had different fields to display, and kind of different role in the system, but I'm finally getting the behaviour out of it that I wanted.
Thanks for hanging in there and the suggestions.

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Scott, I'm glad you got it working, but I also hate it when you solve a problem without discovering the underlying cause. That said, I often take the same approach that you did: start with a version that works, and gradually change it to match the version that doesn't work. Most of the times, that will enable you to home in on the error. But, sometimes, the error simply goes away, and you are none the wiser - as seems to be the case here.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top