I have installed SimpleGrind into my Cfe Program.
I would like to know if it is possible to avoid the user enters non numeric characters.
He is allowed to enter negative and positive numbers only.
On the image, I have a matrix 3x3
Do I have to create a dummy column for having the same width for all colums?
That's all for now.
I have added a dummy column.
Is it possible to align the first column?
Is it possible to align the grid header?
Hello Grincheux,
As it is currently; it is not possible to override the alignment of the row and column headers (GSA_GENERAL).
However you can hide the row and column headers if you don't need them.
//Hide row headers
SimpleGrid_SetRowHeaderWidth(hgrid,0);
//Hide column header
SimpleGrid_SetHeaderRowHeight(hgrid, 0);
The cells in the columns can be aligned using the following:
VOID SimpleGrid_SetItemTextAlignmentEx(
HWND hGrid
INT iCol
INT iRow
DWORD dwAlign
);
/*Parameters
hGrid
Handle to the SimpleGrid control.
iCol
The column index of the item.
iRow
The row index of the item.
dwAlign
One of the following alignments: GSA_LEFT, GSA_GENERAL, or GSA_RIGHT.
Return Values
The return value is not meaningful.
*/
You can use the SGN_KEYDOWN notification monitor the key presses in a cell and respond to them appropriately.
Setting column width:
INT SimpleGrid_SetColWidth(
HWND hGrid
INT iCol
INT nWidth
);
/*Parameters
hGrid
Handle to the SimpleGrid control.
iCol
The index of the column.
nWidth
The desired width (in pixels) of the column.
Return Values
ERROR_SUCCESS otherwise SG_ERROR if desired column is out of bounds.
*/
HTH
Windows does not allow to align the first column.
If you want to do this, recreate the first column and remove the first column;
Hello Grincheux,
The grid columns and rows are numbered beginning with 0. So the first column is column 0 and first row is row 0.
SimpleGrid_SetItemTextAlignmentEx(hgrid, 0,0,GSA_RIGHT);
should set the contents of the first cell to a right alignment.
SimpleGrid_SetColWidth(hgrid,0,100);
should set the width of the first column to 100 pixels.
HTH
DMac