1

Konu: FoxyClasses and sorting/searching

Hello:

First, the form's Themes must be set to .F. for the sorted column header to be either blue or red.

Second, when I sort on a column and then do a search, the search is always performed in the first column, regardless of which column is the sort column.

Am I doing something wrong?

Hans L

2

Re: FoxyClasses and sorting/searching

You can sort on any column by clicking on the header. Then, regardless of the sorted column, you can search on any column. To make the search make sure you click on a cell in that column (a row and not to header). You can also use TAB to move to the column.

3

Re: FoxyClasses and sorting/searching

Aha, did not know that. Thanks!

Hans L

4

Re: FoxyClasses and sorting/searching

cetinbasoz yazdı:

You can sort on any column by clicking on the header. Then, regardless of the sorted column, you can search on any column. To make the search make sure you click on a cell in that column (a row and not to header). You can also use TAB to move to the column.


Cetin, do I understand you correctly:

-  I click on the header of column 1. Column 1 is sorted

-  I click on a cell in column 2. Then, this column gets sorted, resulting in

Column 1 A
    Column 2 a
    Column 2 b
    Column 2 c

Column 1 B
    Column 2 a
    Column 2 b
    Column 2 c

etc. ?

That would be neat (but I do not see it happening. It was a question I was going to ask: how can I sort on column 1, then on 2, etc?

------------

Also, when you sort on one column, how do you unsort?

------------

I would also want to ask what you need to do if you want to "step" using Prev/Next buttons. I have the locator grid on the screen, and also text boxes based on data from the table (dragged from the Data Environment, as per a recommendation of yours in an earlier e-mail).

Should I "step" the cursor of the grid or should I "step" the table?

--------------

Thanks,

Hans L

5

Re: FoxyClasses and sorting/searching

No, I am afraid you understood me wrong. At any time the sort is only on one column. You can however type and 'searching' works on other columns. The effect you say, I agree is neat but something that I could never find time to implement.

Stepping in the cursor is a better idea because what they see is the grid and it may be in a particular sort order. If they are seeing say "Fred" in next row (either it is in the sorted column or not) they would expect Fred when they step.

Visual Fox Pro
* sample

with thisform.LocatorGrid1
   select (.RecordSource)
   if !eof()
      skip 1 && skip -1
      if eof()
         go bottom
     endif
endif
 
   .RecChange() && this causes highlight refresh
  * you may want to call this
  .AfterRowColChange(1) && It has parent refreshing code
endwith

6

Re: FoxyClasses and sorting/searching

Okay, fair enough (it would be neat but time-consuming, I agree).

Now, is it possible to undo the sorting, or once you click sort, will one of the columns always be sorted (not a problem, but I was just wondering)?

And, if I want to sort on two columns, I would create an index for that, and then start the program. However, in that case, the click-in-header sorting would interfere, I guess. Is it possible to temporarily disable it, and then enable it again?

Regards,

Hans L

7

Re: FoxyClasses and sorting/searching

As far as I remember the only way to remove sorting is to click on a column that doesn't support sorting (like a numeric column).

The sorting code is in MyHeader.prg. Maybe you would want to edit that code to remove sorting and/or add 'combined' sorting. For example, when the source is not large a simple implementation might look like this in pseudocode (roughly):

* if Shift + Click and already sorted
select * from (.RecordSource) ;
order by < currentOrder > ;
into cursor (.Recordsource) ;
nofilter
index on ...

8

Re: FoxyClasses and sorting/searching

Okay, I will try, and let you know.

Thanks!

Hans L