Jump to content

CM SETGRIDINFO

From EDM2
Revision as of 23:07, 20 April 2025 by Martini (talk | contribs) (Created page with "This message sets the characteristics of the grid. ==Syntax== <PRE> param1 PGRIDINFO pGridInfo; Pointer to a GRIDINFO structure.: param2 BOOL bRepaint; Repaint the window at this time?: </PRE> ==Parameters== ;pGridInfo (PGRIDINFO) - Input : Pointer to a GRIDINFO structure. ;bRepaint (BOOL) - Input : Repaint the window at this time? ::TRUE: If this field is TRUE, the container is immediately invalidated and repainted. ::FALSE: If this fiel...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This message sets the characteristics of the grid.

Syntax

param1
PGRIDINFO pGridInfo;   /* Pointer to a GRIDINFO structure. */

param2
BOOL bRepaint;        /* Repaint the window at this time? */

Parameters

pGridInfo (PGRIDINFO) - Input
Pointer to a GRIDINFO structure.
bRepaint (BOOL) - Input
Repaint the window at this time?
TRUE: If this field is TRUE, the container is immediately invalidated and repainted.
FALSE: If this field is FALSE, no repositioning or repainting of items occurs. If the application sets this field to FALSE, it must send a CM_ARRANGE or CM_SNAPTOGRID message afterward.

Returns

rc (BOOL) - returns
Success indicator.
TRUE: Grid characteristics were set successfully.
FALSE: An error occurred while setting grid information; grid has not been changed.

Remarks

This message can be used to change the size of the grid squares after a grid has been created.

The only fields in the GRIDINFO structure that can be set by the application are the cb, cxGrid, cyGrid, and pGrid fields. If the cxGrid and cyGrid fields are nonzero and the pGrid field is NULL, the container creates a grid with grid squares of width cxGrid and height cyGrid.

If cxGrid and cyGrid are zero, the container will create default-size grid squares. It is not necessary to send this message to create default-size grid squares because they will be created the first time an arrange with the CM_ARRANGEGRID option is performed.

The application can completely control the placement of icons by marking the squares it wants occupied and then sending the CM_ARRANGE message with mp1 equal to CMA_ARRANGEGRID and mp2 equal to CMA_USER. Here is how the application uses CM_SETGRIDINFO to mark the squares:

  • If the pGrid field of the GRIDINFO structure is non-NULL, the container expects a pointer that points to an array of GRIDSQUARE structures, one for each available grid square in the grid. In this case, the cxGrid and cyGrid fields are ignored.
  • The container uses the grid square array to mark the grid squares as available or unavailable. If the ulState field of the GRIDSQUARE structure is marked CMA_AVAIL, the square can be occupied by an icon; if it is marked CMA_UNAVAIL, it is not available.

Marking of grid squares is used only when the arrangement pattern is CMA_USER and has no effect on the placement of icons when any other pattern is specified.

Default Processing

The default window procedure does not expect to receive this message and therefore takes no action on it other than to return FALSE.