NO

Author Topic: SimpleGrid  (Read 283 times)

Offline Grincheux

  • Member
  • *
  • Posts: 365
  • Never be pleased, always improve
    • Arachne
SimpleGrid
« on: December 21, 2021, 05:43:59 pm »
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.
-------------------------
Kenavo / Bye

What disturbs me the most is not dying but not knowing what I will do after.

Offline Grincheux

  • Member
  • *
  • Posts: 365
  • Never be pleased, always improve
    • Arachne
Re: SimpleGrid
« Reply #1 on: December 21, 2021, 07:26:45 pm »
I have added a dummy column.
Is it possible to align the first column?
Is it possible to align the grid header?
-------------------------
Kenavo / Bye

What disturbs me the most is not dying but not knowing what I will do after.

Offline DMac

  • Member
  • *
  • Posts: 268
Re: SimpleGrid
« Reply #2 on: December 23, 2021, 08:34:55 am »
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.

Code: [Select]
//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:

Code: [Select]
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:

Code: [Select]
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
« Last Edit: December 23, 2021, 09:07:44 am by DMac »
No one cares how much you know,
until they know how much you care.

Offline Grincheux

  • Member
  • *
  • Posts: 365
  • Never be pleased, always improve
    • Arachne
Re: SimpleGrid
« Reply #3 on: December 23, 2021, 11:46:35 am »
Windows does not allow to align the first column.
If you want to do this, recreate the first column and remove the first column;

-------------------------
Kenavo / Bye

What disturbs me the most is not dying but not knowing what I will do after.

Offline DMac

  • Member
  • *
  • Posts: 268
Re: SimpleGrid
« Reply #4 on: December 23, 2021, 07:23:47 pm »
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.

Code: [Select]
SimpleGrid_SetItemTextAlignmentEx(hgrid, 0,0,GSA_RIGHT);should set the contents of the first cell to a right alignment.

Code: [Select]
SimpleGrid_SetColWidth(hgrid,0,100);should set the width of the first column to 100 pixels.

HTH
DMac
« Last Edit: December 23, 2021, 07:52:37 pm by DMac »
No one cares how much you know,
until they know how much you care.