• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

(Phoenix) GRID Class

Started by Theo Gottwald, May 19, 2007, 03:41:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald


'###############################################################################
' BEGIN Phnx_Grid_Class32
'###############################################################################

' Keyboard Interface
' ------------------
' Key                Action
' --------------------------------------------------------------------
' Arrow key           | Moves focus one cell in direction of the arrow
' ENTER               | Moves the focus to the cell in the next row
' SHIFT+ENTER         | Moves the focus to the cell the previous row
' TAB                 | Moves the focus to the cell the next column
' SHIFT+TAB           | Moves the focus to the cell the previous column
' SHIFT+UP            | Extends the selection to the previous row(focus is not changed)
' CTRL+SHIFT+UP       | Extends the selection to the last first row
' SHIFT+DOWN          | Extends the selection to the next row(focus is not changed)
' CTRL+SHIFT+DOWN     | Extends the selection to the last row
' SHIFT+LEFT          | Extends the selection to the previous column(focus is not changed)
' CTRL+SHIFT+LEFT     | Extends the selection to the first column
' SHIFT+RIGHT         | Extends the selection to the next column(focus is not changed)
' CTRL+SHIFT+RIGHT    | Extends the selection to the last column
' HOME                | Moves the focus to the first column in the current row
' SHIFT+HOME          | Extends the selection to the first column
' CTRL+HOME           | Moves the focus to the first column and first row
' CTRL+SHIFT+HOME     | Extends the selection to the first column and the first row
' END                 | Moves the focus to the last column in the current row
' SHIFT+END           | Extends the selection to the last column
' CTRL+END            | Moves the focus to the last column and the last row
' CTRL+SHIFT+END      | Extends the selection to the last column and the last row
' PAGE UP             | Moves the focus up one screen
' SHIFT+PAGE UP       | Extends the selection up one screen
' ALT+PAGE UP         | Moves the focus left one screen
' ALT+SHIFT+PAGE UP   | Extends the focus left one screen
' PAGE DOWN           | Moves the focus down one screen
' SHIFT+PAGE DOWN     | Extends the focus down one screen
' ALT+PAGE DOWN       | Moves the focus right one screen
' ALT+SHIFT+PAGE DOWN | Extends the focus right one screen

' left button                 | Drag move selection
' CTRL+left button            | Drag copy selection
' CTRL+SHIFT+left button      | Drag move insert selection
' CTRL+ALT+SHIFT+left button  | Drag copy insert selection

' Cell types
%GCT_GENERAL      = 0
%GCT_CHECKBUTTON  = 1
%GCT_PUSHBUTTON   = 2
%GCT_FLATBUTTON   = 3
%GCT_CHECKBOX     = 4
%GCT_RADIO        = 5
%GCT_LIST         = 6
%GCT_EDITLIST     = 7
%GCT_URL          = 8
%GCT_OWNERDRAW    = 9

' Grid item masks (dwMask member of structures)
%GIF_STATE       = &H1         ' the dwStateMask and dwState members must be filled in
%GIF_FONT        = &H2         ' the tlf member must be filled in
%GIF_TEXT        = &H4         ' the pszText and cchTextMax members must be filled in
%GIF_ALIGN       = &H8         ' the bAlign, bImageOnRight, bClip, and bCenterAcross members must be filled in
%GIF_IMAGE       = &H10        ' the iImage member must be filled in
%GIF_STATEIMAGE  = &H20        ' the iImageState member must be filled
%GIF_BITMAP      = &H40        ' the hInstance, pszImage, bImageType, and bStretch members must be filled in
%GIF_LPARAM      = &H80        ' the lParam member must be filled in
%GIF_COLOR       = &H100       ' the dwTextColor and dwBackColor members must be filled in
%GIF_BORDER      = &H200       ' the bBorderStyle, bPenStyle, dwPenColor and bPenWidth members must be filled in
%GIF_CELLTYPE    = &H400       ' the bCellType member must be filled in
%GIF_INDENT      = &H800       ' the bIndentIntegral member must be filled in
%GIF_SIZE        = &H1000      ' the wSize member must be filled in
%GIF_MERGER      = &H2000      ' this flag cannot be used to merge or unmerge cells. Its is use as a read only flag with GCM_GETITEM, or to initialize a grid (GCM_SETITEM) with predefined data.
%GIF_FORMAT      = &H4000
%GIF_ALL         = %GIF_STATE OR %GIF_FONT OR %GIF_TEXT OR %GIF_ALIGN OR _
                   %GIF_IMAGE OR %GIF_STATEIMAGE OR %GIF_BITMAP OR %GIF_LPARAM OR _
                   %GIF_COLOR OR %GIF_BORDER OR %GIF_CELLTYPE OR %GIF_INDENT OR _
                   %GIF_SIZE OR %GIF_MERGER OR %GIF_FORMAT

' Grid item states
%GIS_CHECKED     = &H00000001
%GIS_SELECTED    = &H00000002
%GIS_READONLY    = &H00000004
%GIS_LOCKED      = &H00000008   ' the grid sends GCN_ITEMCLICK notifications
%GIS_NOLABELEDIT = &H00000010
%GIS_DISABLED    = &H00000020   ' the grid does not send GCN_ITEMCLICK notifications
%GIS_MODIFIED    = &H00000040
%GIS_HOTTRACK    = &H00000080
%GIS_PUSHED      = &H00000100
%GIS_HIGHLIGHTED = &H00000200
%GIS_SHADOWED    = &H00000400

' Hit test values
' Object type(lowrd).  Combined with one of the values below
%GHT_CAPTION    = &H0001??
%GHT_SELALLBTN  = &H0002??
%GHT_COLHEADER  = &H0004??
%GHT_ROWHEADER  = &H0008??
%GHT_CELL       = &H0010??
%GHT_NOOBJECT   = &HFFFF??
' Location (hiwrd).
%GHT_LABEL      = &H0001??          ' label
%GHT_IMAGE      = &H0002??          ' normal image
%GHT_STATEIMAGE = &H0004??          ' state image
%GHT_LDIVIDER   = &H0008??          ' left divider (in header)
%GHT_RDIVIDER   = &H0010??          ' right divider (in header)
%GHT_LMARGIN    = %GHT_LDIVIDER     ' left margin (in cell)
%GHT_RMARGIN    = %GHT_RDIVIDER     ' right margin (in cell)
%GHT_TMARGIN    = &H0040??          ' top margin (in cell)
%GHT_BMARGIN    = &H0080??          ' bottom margin (in cell)
%GHT_NOWHERE    = &HFFFF??

' Imagelist types
%GISIL_CELL      = 0
%GISIL_STATE     = 1
%GISIL_HEADER    = 2

' Cell border index
%GCBI_LEFT        = 0
%GCBI_TOP         = 1
%GCBI_RIGHT       = 2
%GCBI_BOTTOM      = 3
%GCBI_OUTLINE     = 4       ' used for outlining selections

' Cell border pen style
%GCBP_SOLID       = 0
%GCBP_DASH        = 1
%GCBP_DOT         = 2
%GCBP_DASHDOT     = 3
%GCBP_DASHDOTDOT  = 4
%GCBP_NULL        = 5
%GCBP_DOUBLE      = 6

' Source of font used object
%FONT_DEFAULT     = &H00?
%FONT_USER        = &H01?

' Default color flag (alias CLR_DEFAULT)
%COLOR_DEFAULT    = &HFF000000&

' Maximum size of tooltip and text callback buffers
%GRIDTIPSIZE      = 2048
%LABELEDITSIZE    = 8192

' Line ending bytes.  Examples -
' byte sequence byte1 byte2 count
' <cf><lf>      &H0D  &H0A  2
' <cr>          &H0D  &H0D  1
' <cr><cr>      &H0D  &H0D  2

TYPE EOLBYTES         ' eol
  bByte1  AS BYTE     ' First byte in end of line sequence
  bByte2  AS BYTE     ' Second byte in end of line sequence
  bByte3  AS BYTE     ' Third byte in end of line sequence
  bCount  AS BYTE     ' Count of bytes in EOL sequence
END TYPE

TYPE GRIDITEM   ' gi
  wSize           AS WORD         ' width/height of item
  dwHitCode       AS DWORD        ' type of item
  dwMask          AS DWORD        ' attributes of item being requested or set
  dwStateMask     AS DWORD        ' state of item being requested or set
  dwState         AS DWORD        ' state of item
  pszText         AS ASCIIZ PTR   ' item text
  cchTextMax      AS LONG         ' maximum size of buffer receiving text
  iImage          AS LONG         ' index of image in normal imagelist
  iImageState     AS LONG         ' index of state image in state imagelist
  pszImage        AS ASCIIZ PTR   ' fully qualified path and filename or resource id of background image
  bImageType      AS BYTE         ' image type of background image
  bStretch        AS BYTE         ' stretch background image flag
  bIndentIntegral AS BYTE         ' number of increments of the state image width by which text/image is indented
  dwAlign         AS DWORD        ' text alignment
  bClip           AS BYTE         ' clipping flag
  bCenterAcross   AS BYTE         ' center across selection flag
  bImageOnRight   AS BYTE         ' image right of text flag
  bFontSrc        AS BYTE         ' source of font flag
  tlf             AS LOGFONT      ' font attributes
  dwTextColor     AS DWORD        ' text color
  dwBackColor     AS DWORD        ' background color
  bCellType       AS BYTE         ' cell type of item
  bBorderStyle(4) AS BYTE         ' draw border flag. If TRUE, a border is drawn on the associated edge
  bPenStyle(4)    AS BYTE         ' style of pen used to draw border
  dwPenColor(4)   AS DWORD        ' color of pen used to draw border
  bPenWidth(4)    AS BYTE         ' width of pen used to draw border
  bBorderEdit(4)  AS BYTE         ' border modified flag
  bMerge          AS BYTE         ' If TRUE, cell is part of a merger
  iLeft           AS LONG         ' column index of cell in upper left corner of merger
  iTop            AS LONG         ' row index of cell in upper left corner of merger
  iRight          AS LONG         ' column index of cell in bottom right corner of merger
  iBottom         AS LONG         ' row index of cell in bottom right corner of merger
  lParam          AS LONG         ' application-defined value
END TYPE

TYPE GRIDITEMEX         ' gdix
  iLeft           AS LONG
  iTop            AS LONG
  iRight          AS LONG
  iBottom         AS LONG
  hInstance       AS DWORD            ' handle of module containing background images
  tgi             AS GRIDITEM
END TYPE

' Used by the GCM_HITTEST message
TYPE GRIDHITTEST   ' ght
  tpt             AS POINTAPI       ' IN: location to test in client coordinates
  iCol            AS LONG           ' OUT: zero-based column index of item
  iRow            AS LONG           ' OUT: zero-based row index of item
  trcBnd          AS RECT           ' OUT: bounding rectangle of item
  dwHitCode       AS DWORD          ' OUT: object type and location (hit-test value)
END TYPE

' Used by the GCM_SETHEADERIDEALSIZE, GCM_GETHEADERIDEALSIZE messages
TYPE GRIDHEADERSIZE 'ghs
  iStart          AS LONG
  iEnd            AS LONG
  dwHitCode       AS DWORD        ' GHT_CAPTION, GHT_COLHEADER, or GHT_ROWHEADER
  pwWidth         AS WORD PTR     ' address of variable used to receive width or set to TRUE if setting width
  pwHeight        AS WORD PTR     ' address of variable used to receive height or set to TRUE if setting height
END TYPE

TYPE GRIDLABELEDIT  ' gle
  hdr             AS NMHDR
  iCol            AS LONG
  iRow            AS LONG
  hWndEdit        AS DWORD        ' handle of label edit control
  fCancelled      AS LONG
  tgi             AS GRIDITEM
END TYPE

' Used by the GCN_ITEMCHANGED, GCN_GETDISPINFO, and GCN_GETINFOTIP
' notification messages.
' GCN_ITEMCHANGED:
' the iLeft, iTop, iRight, and iBottom members specify the relevant items.
' The dwMask member specifies the attributes that have changed.
' GCN_GETDISPINFO:
' the iLeft, iTop, members specify the relevant item.
' if the hInstance member is null, the pszImage member of the GRIDITEM
' structure is set to the filename of the image to load.  If it is
' non-null, the pszImage member is set to the identifier of a resource
' image in the module referenced by the hInstance member.
' GCN_GETINFOTIP:
' the iLeft, iTop, members specify the relevant item.
' if hInstance is null, the buffer pointed to by the pszText member
' of the GRIDITEM structure is used to set the item's informative
' text.  This buffer has a maximum size of GRIDTIPSIZE. If it is
' non-null, the pszText member is set to the identifier of a resource
' string in the module referenced by the hInstance member.
TYPE GRIDDISPINFO     ' gdi
  hdr             AS NMHDR
  iLeft           AS LONG
  iTop            AS LONG
  iRight          AS LONG
  iBottom         AS LONG
  hInstance       AS DWORD            ' instance of module containing string or image resource
  tgi             AS GRIDITEM
END TYPE

' key flags stored in wKeyFlags
%GKF_ALT       = &H0001??
%GKF_CONTROL   = &H0002??
%GKF_SHIFT     = &H0004??

TYPE GRIDITEMACTIVATE   ' gia
  hdr             AS NMHDR
  iCol            AS LONG           ' zero-based column index of item that was clicked
  iRow            AS LONG           ' zero-based row index of item that was clicked
  tpt             AS POINTAPI       ' location where the event occurred in client coordinates
  wKeyFlags       AS WORD           ' flags specifying the modifier keys that were pressed at the time of the activation
  tgi             AS GRIDITEM
END TYPE

TYPE GRIDKEYDOWN      ' gkd
  hdr             AS NMHDR
  wVirtKey        AS WORD
  wKeyFlags       AS WORD           ' flags specifying the modifier keys that were pressed at the time of the activation
END TYPE

' This structure is used by the GCN_ITEMDRAW notification message
TYPE GRIDITEMDRAW       ' gid
  hdr             AS NMHDR
  iCol            AS LONG           ' zero-based column index of item to be drawn
  iRow            AS LONG           ' zero-based column index of item to be drawn
  hInstance       AS DWORD          ' handle of module containing background images
  hDC             AS DWORD          ' device context to use when performing drawing operations
  trc             AS RECT           ' bounding (clipping) rectangle of item
  tgi             AS GRIDITEM
END TYPE

' Used by the GCN_HOTITEMCHANGE notification message
TYPE GRIDHOTITEM    ' ghi
  hdr             AS NMHDR
  iCol            AS LONG           ' zero-based column index of item
  iRow            AS LONG           ' zero-based column index of item
  fLeaving        AS LONG           ' TRUE if mouse is leaving the item
  tgi             AS GRIDITEM
END TYPE

' Used by the GCN_SETFOCUS/GCN_KILLFOCUS notification messages
TYPE GRIDCONTROLFOCUS   ' gcf
  hdr             AS NMHDR
  hWndFocus       AS DWORD          ' handle of window gaining or losing the input focus
END TYPE

' Used by the GCN_FOCUSCHANGING/GCN_FOCUSCHANGED notification messages
TYPE GRIDITEMFOCUS      ' gif
  hdr             AS NMHDR
  iColOld         AS LONG           ' zero-based column index of old item
  iRowOld         AS LONG           ' zero-based column index of old item
  iColNew         AS LONG           ' zero-based column index of new item
  iRowNew         AS LONG           ' zero-based column index of new item
END TYPE

' This structure is used by the GCM_SETTEXT message
' IF wParam is null, the defaults are used.
TYPE GRIDSETTEXT   ' gst
  iCol            AS LONG           ' zero-based column index of start of write operation
  iRow            AS LONG           ' zero-based row index of start of write operation
  fInsert         AS LONG           ' if TRUE, text is inserted.  If FALSE, existing text is overwritten
  fLine1IsHeaders AS LONG           ' if TRUE, the first line in the text defines the column headers
  bDelimiter      AS BYTE           ' ascii character delimiting strings. If zero, double quote (") is used
  bColSeparator   AS BYTE           ' ascii character separating fields. Set to zero to autodetect
  teol            AS EOLBYTES       ' bytes defining the end of a row. The default is CRLF.
  fSetProperty    AS LONG           ' if TRUE, the GRIDITEM structure is used to set the attributes of the cells
  tgi             AS GRIDITEM       ' structure defining cell attributes
END TYPE

' This structure is used by the GCM_GETITEMTEXT/GCM_SAVETEXTFILE messages
TYPE GRIDGETTEXT   ' ggt
  iLeft           AS LONG           ' zero-based column index of start of write operation
  iTop            AS LONG           ' zero-based row index of start of write operation
  iRight          AS LONG
  iBottom         AS LONG
  fCopyHeaders    AS LONG           ' if TRUE, the first line in the text defines the column headers
  bDelimiter      AS BYTE           ' ascii character delimiting strings. If zero, double quote (") is used
  bColSeparator   AS BYTE           ' ascii character separating fields. If zero, comma (,) is used
  teol            AS EOLBYTES       ' bytes defining the end of a row. The default is CRLF.
END TYPE

' This structure is used by the GCM_GETFIELDMETRIC/GCM_SETFIELDMETRIC message
TYPE GRIDFIELDMETRIC    ' gfm
  bDelimiter      AS BYTE           ' ascii character delimiting strings. If zero, double quote (") is used
  bColSeparator   AS BYTE           ' ascii character separating fields. If zero, comma (,) is used
  teol            AS EOLBYTES       ' bytes defining the end of a row. The default is CRLF.
END TYPE

'------------------ [ Custom Styles/Messages/Notifications ] -------------------

' Phnx_Grid_Class32 styles
' ------------------------
%GCS_CAPTION                                = &H0001??
' The control has a caption.

%GCS_HORZGRIDLINES                          = &H0002??
' The control displays horizontal grid lines.

%GCS_VERTGRIDLINES                          = &H0004??
' The control displays vertical grid lines.

%GCS_FLATHEADER                             = &H0008??
' The headers of the control have a flat appearence.

%GCS_READONLY                               = &H0010??
' The contents of the grid control can be copied but not edited.

%GCS_TOOLTIPS                               = &H0020??
' The grid control creates a tooltip control when it is created.  The
' tooltip control always uses the LPSTR_TEXTCALLBACK flag even
' even when it is assigned via the GCM_SETTOOLTIPS message.

%GCS_TWOCLICKACTIVATE                       = &H0040??
' Clicking an unselected item selects the item, and clicking the item
' a second time activates label editing. If this style is not set, clicking
' the item once, activates label editing.

%GCS_CYCLESTATEONCLICK                      = &H0080??
' The grid control changes the state image of an item each time
' the state image is clicked.  The first image in a state image-list
' not used.

%GCS_DRAGDROPEDIT                           = &H0100??
' Enables drag and drop editing of grid items.

%GCS_CUSTOMEDITOR                           = &H0200??
' Enables customization of the grid control via built-in property editors.

%GCS_DISABLENOSCROLL                        = &H0400??
' The scroll bars are always displayed even when all items are visible.
' To display a scroll bar, set the WS_HSCROLL or WS_VSCROLL style.

%GCS_TEXTCALLBACK                           = &H0800??
' The control sends the GCN_GETDISPINFO notification to retrieve
' item information that is stored by the application rather than the control.

' Phnx_Grid_Class32 messages
' --------------------------
%GCM_INITDONE                               = %WM_USER + &H0064??
' Purpose: Posted to ensure that the grid control draws its entire client
'          area to the memory device contexts it manages when the
'          control is initially created.  The control may not paint its entire
'          client area during the initial WM_PAINT message because it
'          ma
' wParam:  N/A
' lParam:  N/A
' Return:  No return value

%GCM_GETITEM                                = %WM_USER + &H0065??
' Purpose: Retrieves some or all of a grid item's attributes.
' wParam:  N/A
' lParam:  Address of GRIDITEMEX structure
' Return:  TRUE if successful, FALSE on failure.

%GCM_SETITEM                                = %WM_USER + &H0066??
' Purpose: Sets some or all of a grid item's attributes.
' wParam:  If TRUE, sets the attributes of selected items
' lParam:  Address of GRIDITEMEX structure
' Return:  TRUE if successful, FALSE on failure.

%GCM_GETITEMSTATE                           = %WM_USER + &H0067??
' Purpose: Retrieves the state of an item in a grid control.
' wParam:  N/A
' lParam:  Address of a GRIDITEMEX structure.
' Return:  The current state of the item.

%GCM_SETITEMSTATE                           = %WM_USER + &H0068??
' Purpose: Changes the state of an item in a grid control.
' wParam:  N/A
' lParam:  Address of a GRIDITEMEX structure.
' Return:  TRUE if successful or FALSE otherwise.

%GCM_GETLABELEDITCONTROL                    = %WM_USER + &H0069??
' Purpose: Sent to retrieve the handle to the control being used
'          to edit a grid item's text.
' wParam:  N/A
' lParam:  N/A
' Return:  Handle to the label editing control if successful, or NULL otherwise.

%GCM_GETDROPLISTCONTROL                     = %WM_USER + &H006A??
' Purpose: Sent to retrieve the handle of the drop-list control that is being used
'          to edit a grid item's text. The value returned is the handle of the child
'          listbox control of the drop-list container.
' wParam:  N/A
' lParam:  N/A
' Return:  Handle to the child listbox control if successful, or NULL otherwise.

%GCM_GETIMAGELIST                           = %WM_USER + &H006B??
' Purpose: Retrieves the image list associated with a grid control.
' wParam:  Type of image list
' lParam:  N/A
' Return:  Handle to the image list associated with the grid control or NULL.

%GCM_SETIMAGELIST                           = %WM_USER + &H006C??
' Purpose: Assigns an image list to a grid control.
' wParam:  Type of image list
' lParam:  Handle to the image list to assign
' Return:  The handle to the image list previously associated with the control if successful, or NULL otherwise.

%GCM_GETITEMRECT                            = %WM_USER + &H006D??
' Purpose: Retrieves the bounding rectangle of a grid  item in the current view.
'          When the message is sent, the nLeft and nTop members of the RECT
'          structure specify the indices of the item.
' wParam:  lowrd specifies the grid item type
' lParam:  address of RECT structure to receive coordinates.
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_INSERTCOLUMN                           = %WM_USER + &H006E??
' Purpose: Sent to insert columns in a grid control.
'          The new column is inserted before the specified column.
'          Set iCol to -1 to insert the column at the end of the grid.
' wParam:  Position at which to insert the new column
' lParam:  Number of columns to insert
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_INSERTROW                              = %WM_USER + &H006F??
' Purpose: Sent to insert rows in a grid control.
'          The new row is inserted before the specified row.
'          Set iRow to -1 to insert the row at the end of the grid.
' wParam:  Position at which to insert the new row
' lParam:  Number of columns to insert
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_DELETECOLUMN                           = %WM_USER + &H0070??
' Purpose: Sent to a grid control to delete one column or
'          a range of columns.
' wParam:  Zero-based index of first column in range
' lParam:  Zero-based index of last column in range.
' Return:  No return value.

%GCM_DELETEROW                              = %WM_USER + &H0071??
' Purpose: Sent to a grid control to delete one row or
'          a range or rows.
' wParam:  Zero-based index of first row in range
' lParam:  Zero-based index of last row in range.
' Return:  No return value.

%GCM_DELETEALLITEMS                         = %WM_USER + &H0072??
' Purpose: Deletes all columns and rows from a grid control.
' wParam:  N/A
' lParam:  N/A
' Return:  No return value.

%GCM_REFRESHGRID                            = %WM_USER + &H0073??
' Purpose: Sent to redraw the visible area of the grid.  This message
'          recalculates the position and dimension of the various grid
'          components before redrawing them.
' wParam:  N/A
' lParam:  N/A
' Return:  No return value.

%GCM_CLEARCONTENTS                          = %WM_USER + &H0074??
' Purpose: Sent to clear the contents of the specified items.
' wParam:  lowrd = type of item. Set to &HFFFF to clear all items. hiwrd = set format to default if TRUE
' lParam:  address of RECT structure specifying the range.
' Return:  N/A

%GCM_LOADTEXTFILE                           = %WM_USER + &H0075??
' Purpose: Loads data from a Comma Separated Values (CSV) file or
'          a Tab Delimited file.  The lobyte of wParam can be used
'          to specify the delimiter.
' wParam:  lobyte = optional field separator (set to zero to autodetect). hiwrd = headers flag (set to TRUE if first line in file defines t
'          he column headers)
' lParam:  Fully qualified path and filename
' Return:  FALSE if file was opened successfully, or nonzero on failure.

%GCM_SAVETEXTFILE                           = %WM_USER + &H0076??
' Purpose: Saves data in grid as Comma Separated Values (CSV) or
'          as Tab Delimited values.  The wParam parameter can be
'          to specify the address of a GRIDGETTEXT structure
'          to set the delimiter and range of items to be saved.
' wParam:  address of optional GRIDGETTEXT structure or null to save the entire grid
' lParam:  Fully qualified path and filename
' Return:  FALSE if data was saved successfully, of nonzero on failure.

%GCM_GETITEMTEXT                            = %WM_USER + &H0077??
' Purpose: Sent to retrieve data from the grid control.
'          Set lParam to zero to retrieve the size of the
'          buffer required for the text (including the
'          terminating null).
' wParam:  Address of GRIDGETTEXT structure.
' lParam:  Address of buffer to receive data
' Return:  Size of buffer needed or count of bytes retrieved.

%GCM_SETITEMTEXT                            = %WM_USER + &H0078??
' Purpose: Sent to fill specific portions of the grid control with data.
'          The data must be null-terminated.
' wParam:  Address of GRIDSETTEXT structure.  Set to null to use the defaults
' lParam:  Address of buffer with null-terminated data.
' Return:  FALSE if successful, TRUE on failure.

%GCM_MERGECELLS                             = %WM_USER + &H0079??
' Purpose: Sent to merge or unmerge cells. If wParam is FALSE, the cells are
'          merged.  If wParam is TRUE, the cells are unmerged.
' wParam:  If TRUE, the cells are unmerged
' lParam:  address of RECT structure specifying the range.
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_REDRAWITEMS                            = %WM_USER + &H007A??
' Purpose: Sent to redraw items.
' wParam:  lowrd specifies the grid item to redraw or zero to redraw all items
' lParam:  address of RECT structure specifying the range or Null
' Return:  No return value.

%GCM_SETTOOLTIPS                            = %WM_USER + &H007B??
' Purpose: Sent to associate a tooltip control with the grid condrol.
' wParam:  Handle to the tooltip control
' lParam:  N/A
' Return:  No return value.

%GCM_GETTOOLTIPS                            = %WM_USER + &H007C??
' Purpose: Sent to retrieve the handle to the tooltip control, if any, associated
'          with the grid control.
' wParam:  N/A
' lParam:  N/A
' Return:  Returns the handle to the tooltip control or NULL if the grid control has no associated tooltip.

%GCM_GETVISIBLERANGE                        = %WM_USER + &H007D??
' Purpose: Sent to retrieve the indices of the leftmost, topmost, rightmost,
'          and bottommost visible items.  The rightmost and bottommost
'          items may be partially visible.
' wParam:  N/A
' lParam:  address of RECT structure to receive item indices
' Return:  No return value.

%GCM_SETFIRSTVISIBLECELL                    = %WM_USER + &H007E??
' Purpose: Sent to set the cell that is located at the leftmost column
'          and topmost row of a grid control.
' wParam:  zero-based column index of cell
' lParam:  zero-based row index of cell
' Return:  No return value.

%GCM_ISCELLMERGED                           = %WM_USER + &H007F??
' Purpose: Sent to determine whether or not the specified cell is merged.
'          On return, the RECT structure contains the vectors of the cell
'          if it is merged.
' wParam:  N/A
' lParam:  address of RECT structure specifying column and row index of cell
' Return:  TRUE if cell is merged, FALSE if it is not.

%GCM_SETFOCUSCELL                           = %WM_USER + &H0080??
' Purpose: Sent to set the focus to the specified cell.  The cell
'          is also selected if it is not already selected.  The focus
'          is set to a different cell if the specified cell is disabled,
'          locked, or its dimensions make it invisible.
' wParam:  zero-based column index of cell
' lParam:  zero-based row index of cell
' Return:  TRUE if the focus was set to a cell that is different from the specified cell.

%GCM_GETFOCUSCELL                           = %WM_USER + &H0081??
' Purpose: Sent to retrieve the cell with the focus.
' wParam:  address of variable to receive the column index
' lParam:  address of variable to receive the row index
' Return:  TRUE if successful, FALSE otherwise.

%GCM_ENSUREVISIBLE                          = %WM_USER + &H0082??
' Purpose: Sent to ensure that a grid item is either entirely or partially
'          visible, scrolling the grid control if necessary.  Only the
'          iLeft, iTop, dwHitCode members of the GRIDITEMEX
'          are valid.
' wParam:  If TRUE, no scrolling occurs if the item is partially visible
' lParam:  address of GRIDITEMEX structure
' Return:  No return value.

%GCM_GETCOLUMNCOUNT                         = %WM_USER + &H0083??
' Purpose: Sent to retrieve the number of columns in a grid control.
'          The return value does not include the marker column.
' wParam:  N/A
' lParam:  N/A
' Return:  The number of columns.

%GCM_GETROWCOUNT                            = %WM_USER + &H0084??
' Purpose: Sent to retrieve the number of rows in a grid control.
'          The return value does not include the marker row.
' wParam:  N/A
' lParam:  N/A
' Return:  The number of rows.

%GCM_GETTEXTCOLOR                           = %WM_USER + &H0085??
' Purpose: Sent to retrieve the default text color of cells and headers
'          in a grid control.
' wParam:  if TRUE, get the header text color.
' lParam:  N/A
' Return:  The current text color.

%GCM_SETTEXTCOLOR                           = %WM_USER + &H0086??
' Purpose: Sent to set the default text color of cells and headers
'          in a grid control.
' wParam:  if TRUE, sets the header text color
' lParam:  new text color or COLOR_DEFAULT
' Return:  The old text color.

%GCM_GETBACKCOLOR                           = %WM_USER + &H0087??
' Purpose: Sent to retrieve the default back color of cells and headers
'          in a grid control.
' wParam:  if TRUE, get the header back color.
' lParam:  N/A
' Return:  The current back color.

%GCM_SETBACKCOLOR                           = %WM_USER + &H0088??
' Purpose: Sent to set the default back color of cells and headers
'          in a grid control.
' wParam:  if TRUE, sets the header back color
' lParam:  new back color or COLOR_DEFAULT
' Return:  The old back color.

%GCM_GETGRIDCOLOR                           = %WM_USER + &H0089??
' Purpose: Sent to retrieve the color of the grid lines in a grid control.
' wParam:  N/A
' lParam:  N/A
' Return:  The current grid color.

%GCM_SETGRIDCOLOR                           = %WM_USER + &H008A??
' Purpose: Sent to set the color of the grid lines in a grid control.
' wParam:  N/A
' lParam:  new grid color or COLOR_DEFAULT
' Return:  The old grid color.

%GCM_GETURLCOLOR                            = %WM_USER + &H008B??
' Purpose: Sent to retrieve the default text color of Universal Resource Locators
'          (URL) in a grid control.
' wParam:  N/A
' lParam:  N/A
' Return:  The current URL color.

%GCM_SETURLCOLOR                            = %WM_USER + &H008C??
' Purpose: Sent to set the default text color of Universal Resource Locators
'          (URL) in a grid control.
' wParam:  N/A
' lParam:  new URL color or COLOR_DEFAULT
' Return:  The old URL color.

%GCM_GETEDITRECTCOLOR                       = %WM_USER + &H008D??
' Purpose: Sent to retrieve the color of the rectangle that is drawn
'          around editable cells with the focus in a grid control.
' wParam:  N/A
' lParam:  N/A
' Return:  The current edit rectangle color.

%GCM_SETEDITRECTCOLOR                       = %WM_USER + &H008E??
' Purpose: Sent to set the color of the rectangle that is drawn
'          around editable cells with the focus in a grid control.
' wParam:  N/A
' lParam:  new edit rectangle color or COLOR_DEFAULT
' Return:  The old edit rectangle color.

%GCM_GETFIELDMETRIC                         = %WM_USER + &H008F??
' Purpose: Sent to retrieve the ascii characters delimiting strings, columns,
'          and rows in a grid control.  The double quote (") is the default
'          string delimiter, the comma (,) is the default column separator
'          and the CRLF pair is the default row separator.
' wParam:  N/A
' lParam:  address of GRIDFIELDMETRIC structure
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_SETFIELDMETRIC                         = %WM_USER + &H0090??
' Purpose: Sent to set the ascii characters delimiting strings, columns, and
'          rows in a grid control.  The double quote (") is the default string
'          delimiter, the comma (,) is the default column separator and the
'          CRLF pair is the default row separator.
' wParam:  N/A
' lParam:  address of GRIDFIELDMETRIC structure
' Return:  Always returns TRUE.

%GCM_EDITLABEL                              = %WM_USER + &H0091??
' Purpose: Sent to begin in-place editing of the specified grid item's text.
'          The message implicitly selects and focuses the specified item.
'          This message fails if the grid control does not have the input
'          focus.  Send the WM_CANCELMODE message to cancel editing.
' wParam:  N/A
' lParam:  address of GRIDITEMEX structure
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_SCROLL                                 = %WM_USER + &H0092??
' Purpose: Sent to scroll the contents of a grid control.
' wParam:  number of columns to scroll
' lParam:  number of rows to scroll
' Return:  No return value.

%GCM_SELECTITEM                             = %WM_USER + &H0093??
' Purpose: Sent to select items in a grid control.  If wParam is TRUE,
'          this message does not deselect previously selected items
'          or change the focus.
' wParam:  if TRUE, previously selected items are not deselected
' lParam:  address of GRIDITEMEX structure
' Return:  No return value.

%GCM_GETHEADERIDEALSIZE                     = %WM_USER + &H0094??
' Purpose: Retrieves the ideal size of a grid item.  Valid item types are
'          GHT_CAPTION, GHT_COLHEADER and GHT_ROWHEADER.
'          The width or height is returned if the value of the  pwWidth
'          or pwHeight member is set to the address of a variable.
' wParam:  N/A
' lParam:  address of GRIDHEADERSIZE structure
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_SETHEADERIDEALSIZE                     = %WM_USER + &H0095??
' Purpose: Sent to set the ideal size of a grid item.  Valid item types are
'          GHT_CAPTION, GHT_COLHEADER and GHT_ROWHEADER.
'          The width or height is set if the value of the  pwWidth or pwHeight
'          member is set to TRUE.
' wParam:  N/A
' lParam:  address of GRIDHEADERSIZE structure
' Return:  Returns TRUE if successful, or FALSE otherwise.

%GCM_GETHEADERHEIGHT                        = %WM_USER + &H0096??
' Purpose: Retrieves the height (GHT_COLHEADER, GHT_CAPTION)
'          or width (GHT_ROWHEADER) of a grid item.
' wParam:  lowrd specifies the type of item
' lParam:  N/A
' Return:  The height/width of the grid item.

%GCM_SETHEADERHEIGHT                        = %WM_USER + &H0097??
' Purpose: Sets the height (GHT_COLHEADER, GHT_CAPTION)
'          or width (GHT_ROWHEADER) of a grid item.
' wParam:  lowrd specifies the type of item
' lParam:  new height/width of item
' Return:  TRUE if successful, FALSE otherwise.

%GCM_GETDEFAULTSIZE                         = %WM_USER + &H0098??
' Purpose: Retrieves the default size of the specified item.  Valid item types are
'          GHT_CAPTION, GHT_COLHEADER and GHT_ROWHEADER.
' wParam:  lowrd specifies the type of item
' lParam:  N/A
' Return:  The default width (lowrd) and height (hiwrd) of the item if successful.

%GCM_GETSELECTION                           = %WM_USER + &H0099??
' Purpose: Sent to retrieve the indices of selected items in a grid control.
'          Set lParam to NULL to retrieve the number of selected items
'          of the specified type.
' wParam:  lowrd specifies the type of item
' lParam:  address of an array of POINTAPI structs to receive item indices
' Return:  The number of selected items if successful.

%GCM_HITTEST                                = %WM_USER + &H009A??
' Purpose: Sent to determine which item of the grid control, if any, is at a
'          specified position.
' wParam:  N/A
' lParam:  Address of GRIDHITTEST structure
' Return:  The hit-test value.

%GCM_ISRECTANGULARSEL                       = %WM_USER + &H009B??
' Purpose: Sent to determine whether or not the selection is contiguous (rectangular).
' wParam:  N/A
' lParam:  Address of optional RECT structure to receive indices.
' Return:  TRUE if selection is contiguous, FALSE if it is not.

' Phnx_Grid_Class32 notifications
' -------------------------------
%GCN_BEGINLABELEDIT                         = %WM_USER + &H0064??
' Purpose: Sent to the grid control's parent window about the start of label editing for an item. To replace
'          the built-in editor, set the value of the hWndEdit member of the GRIDLABELEDIT structure to
'          a valid control handle.
' wParam:  Identifier of control
' lParam:  Address of GRIDLABELEDIT structure
' Return:  To allow the user to edit the label, return FALSE.
'          To prevent the user from editing the label, return TRUE.

%GCN_ENDLABELEDIT                           = %WM_USER + &H0065??
' Purpose: Sent to a grid control's parent window when label editing for an item ends.
' wParam:  N/A
' lParam:  Address of GRIDLABELEDIT structure
' Return:  TRUE to set the item's label to the edited text.
'          FALSE to reject the edited text and revert to the original label.

%GCN_BEGINTRACK                             = %WM_USER + &H0066??
' Purpose: Sent by a grid control when the user begins to drag a divider in the control.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  Return TRUE to prevent the resizing of the header.

%GCN_ENDTRACK                               = %WM_USER + &H0067??
' Purpose: Notifies the parent window of a grid control that the user
'          has finished dragging a divider.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  N/A

%GCN_TRACK                                  = %WM_USER + &H0068??
' Purpose: Notifies the parent window of a grid control that the user
'          is dragging a divider.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  Return TRUE to cancel the resizing of the header.

%GCN_ITEMCLICK                              = %WM_USER + &H0069??
' Purpose: Sent to a grid control's parent window when the user clicks a grid item.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  Return TRUE to prevent the default operation.

%GCN_ITEMDOUBLECLICK                        = %WM_USER + &H006A??
' Purpose: Sent to a grid control's parent window when the user double-clicks a grid item.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  Return TRUE to prevent the default operation.

%GCN_ITEMRCLICK                             = %WM_USER + &H006B??
' Purpose: Sent to a grid control's parent window when the user clicks
'          the right mouse button on a grid item.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  Return TRUE to prevent the default operation.

%GCN_ITEMRDOUBLECLICK                       = %WM_USER + &H006C??
' Purpose: Sent to a grid control's parent window when the user double-clicks
'          the right mouse button on a grid item.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  Return TRUE to prevent the default operation.

%GCN_BEGINDRAG                              = %WM_USER + &H006D??
' Purpose: Sent by a grid control at the start of a drag operation on one of its items.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  TRUE to prevent the drag and drop operation.

%GCN_ENDDRAG                                = %WM_USER + &H006E??
' Purpose: Sent by a grid control when a drag and drop operation has ended.
' wParam:  Identifier of control
' lParam:  Address of GRIDITEMACTIVATE structure
' Return:  To prevent the dragged items from being placed, return TRUE.

%GCN_ITEMDRAW                        &n