#define HGRM_ISSELECTED | | | (HGM_FIRST + 87) |
C:\Program Files (x86)\CA\Plex\6.1\include\WIDGETS.H
*So you will do something like
SelectRow, TurnOffRow, and TurnOnRow APIs
Platform
Windows C++
Pattern Library SRC Objects
WINAPI/SelectGridRow, WINAPI/DeselectGridRow, WINAPI/ReverseGridRowSelection
HWND hwndGrid = ObPanelAPI::GetControlHandleByName (ControlName);
SendMessage(hwndGrid, HGM_SELECTROW, RecordNumber,0);
HWND hwndGrid = ObPanelAPI::GetControlHandleByName(ControlName);
SendMessage(hwndGrid, HGM_TURNONROW, RecordNumber,0);
HWND hwndGrid = ObPanelAPI::GetControlHandleByName(ControlName);
SendMessage(hwndGrid, HGM_TURNOFFROW, RecordNumber,0);
Parameter | Meaning | Field type | Direction |
ControlName | The name of the grid control, as specified by its Control Name property in the Panel Designer. | Character | Input |
RecordNumber | The number of the row in the grid. Note: The first row is in the grid is 0 (not 1). | Numeric | Input |
Description
Use these APIs to select and deselect rows on a Windows grid:
The APIs support multiple selections, so selecting a row adds it to the existing set of selected rows. The grid scrolls to make the row visible before it is selected or deselected (if necessary). If you only require single selections note that you can use the Locate field statement for this purpose.
Note that the record number of the first row in the grid is 0. Within a For Each Row loop you can increment a counter in order to determine the record number (see example). In other situations it is more difficult to determine the record number since it changes dynamically when, for example, individual rows are deleted from the grid.
Note: These APIs do not work correctly if the Whole Row Selection property is set to No or if the Single Selection property is set to True. Avoid using these properties in conjunction with these APIs.
Example
The following code supports a Select All menu command on a typical OBASE grid. Note that this selects only those records that have been loaded into the grid (not necessarily all records in the associated database table). You can use the TurnOffRow and SelectRow APIs to create Deselect All and Invert Selections menu commands in the same way.
Edit Point Additional Events
Event Event: SelectAll
Set Local<record number> = <record number.-1>
For Each Row Grid
Set Local<record number> = Local<record number> + <record number.1>
API Call Source code: Select Row
The source code for the API looks like this:
HWND hwndGrid = ObPanelAPI::GetControlHandleByName("Grid");
SendMessage(hwndGrid, HGM_TURNONROW, &(1:),0);
In this example, the Control Name property of the grid control must be set to "Grid" (without the quotes).
Copyright © 2008 CA. All rights reserved.