Page 1 of 1

Find in a DataGrid

Posted: Mon Aug 29, 2011 6:44 pm
by lohill
Each execution of Find "XXX" will will look for the next field on a card containing those characters and, if found, will place a box around them. When all the such occurrences have been found, the search moves on to the next card and continues looking for fields containing those characters. My first question is to ask if there is a way that the search my be limited to just the current card?

Find "XXX" will also find all the places in the visible portion of a DataGrid that contain those characters. However, if the datagrid has more rows than can be shown at the same time, any other places with "XXX" will not be scrolled to and found.

Datagrids have the provision to Find by using FindIndex or FindLine so the first occurrence of "XXX" in "Col 5" could be found with:
Dispatch "FindIndex" to group "DataGrid 1" with "Col 5", "XXX"

If found, an index value greater than 0 would be returned ( say some value pIndex) and you could scroll to that place and hilite the line with the combination:
Dispatch "ScrollIndexIntoView" to group "DataGrid 1" with pIndex
set the dgHilitedIndexes of group "DataGrid 1" to pIndex

My question here is: How do I go about finding then next occurrence of "XXX"?
Also if it is in a different column from "Col 5" how would I find it.

Thanks in advance for any help,
Larry

Re: Find in a DataGrid

Posted: Mon Aug 29, 2011 9:13 pm
by dunbarx
It is not explicitly mentioned in the dictionary, but you can restrict the find to a particular card:

find yourText in field yourField of card cardOfInterest

Craig Newman

Re: Find in a DataGrid

Posted: Mon Aug 29, 2011 10:13 pm
by lohill
Thanks Craig,

I had read the dictionary very carefully but, as you say, there was no mention even in the user tips. I guess I should have experimented with exactly what you suggested and I would have surprised myself.

Do you have any clues about how to handle the datagrids? I had tried restricting the find to the group but it didn't like that. And even though the components of a datagrid are actually fields, I have no idea how to address then individually.

Regards,
Larry

Re: Find in a DataGrid

Posted: Tue Aug 30, 2011 11:42 pm
by lohill
Craig,
find yourText in field yourField of card cardOfInterest
I am working with datagrids which are composed of many, many fields. I can say: find chars "pit" in field "Breed 0002" of card "Adopted" and this outlines the characters. Another execution of the same command stops and does not continue to the next card. However I have found just that one occurrence.

If I say: find chars "pit": It finds and moves to the next occurrence with each issue of the command. Unfortunately after the last find on the card it moves to search the next card.

If I say: find chars "pit" in any field of card "Adopted": The command is accepted but I get the result "Not Found". At least I don't go to the next card.

How can I not mention a specific field and confine myself to searching all fields on the card without moving to the next card?

Thanks in advance,
Larry