Property Boolean pbReverseOrdering
Read Access: | Get pbReverseOrdering to BooleanVariable |
Write Access: | Set pbReverseOrdering to BooleanVariable/Value |
pbReverseOrdering determines if current grid order is currently reversed. Normally the grid maintains this and you will never need to get or set it. Changes in ordering and order direction are usually instigated when the user click on a header column. Various properties control this behavior such as pbHeaderReorders and pbHeaderTogglesDirection.
See HeaderReorder, which is called to reorder the grid, for a complete description of this process.
piSortColumn and pbReverseOrdering are used differently with regular grids and data-aware grids. Normally, you will not need to use these properties in your grids, but if you do note the following differences.
Any time a data is initialized or re-initialized by sending InitializeData, the piSortColumn is set to undefined (-1) and pbReverseOrdering is set to False. At this point, new data has been loaded in an unknown order and these values must be reset. If you, as the developer, know what this order is, you can set these properties yourself, immediately after sending InitializeData. It is your responsibility to set these to a sensible value based on your data. Setting these properties at any time other than following InitializeData is not recommended.
Because piSortColumn and pbReverseOrdering are reset when data is initialized, setting these properties before a grid is activated and initialized (i.e., setting them at design-time) serves no purpose.
Procedure LoadMyData tDataSourceRow[] DataSourceArray Move "Zap" to DataSourceArray[0].sValue[0] Move "1345" to DataSourceArray[0].sValue[1] Move "Yow" to DataSourceArray[1].sValue[0] Move "1345" to DataSourceArray[1].sValue[1] Move "Gasp" to DataSourceArray[2].sValue[0] Move "1345" to DataSourceArray[2].sValue[1] Move "Aha" to DataSourceArray[3].sValue[0] Move "1345" to DataSourceArray[2].sValue[1] Send InitializeData DataSourceArray // Since this data was created in reverse order based on the first column, we will // these two properties as a visual clue. Set pbReverseOrdering to True Set piSortColumn to 0 End_Procedure
With data-aware grids, these properties might be static and can be set at design time. If your grid is dynamic, the ordering and direction of the data is determined by Ordering and pbReverseOrdering. A column may or may not be associated with the index ordering. If one is, you can set piSortColumn so that the column is visually distinguished. These properties can all be set at design time, although you should keep in mind that they may be changed as the grid is used. For example, if you support changing index ordering and direction by clicking on the header, all of these properties may be changed. If the grid is closed and activated again the property values will be whatever they were when the grid was deactivated and not values you set at design time. Often this behavior is desired as the grid will reactivate with the same characteristics it was closed with.
If you do need to make sure that your grid is re-activated with specific settings, you can set these properties while the grid is being created inside of the OnCreateGridControl event.
Procedure OnCreateGridControl Forward Send OnCreateGridControl // each time the grid is activated, we want the ordering to be 1, reversed and the // sort column designated as the third column. Set Ordering to 1 Set pbReverseOrdering to True Set piSortColumn to 2 End_Procedure
Use OnCreateGridControl and not Activating for this purpose.