Date: 02-16-2022
Return to Index
created by gbSnippets
'Calling Convention
DIM I AS LONG
DIM row AS LONG
DIM col AS LONG
DIM s AS ASCIIZ * 255
SendMessage hGrid, %MLG_SETCELL, MAKLNG(row,col),VARPTR(s))
I= SendMessage(hGrid, %MLG_GETTOPROW, 0, 0)
'Message Detail
COMMAND MESSAGES
%MLG_REFRESH
Purpose: To visually update grid contents
Parameters:
wParam : non zero will force an update to the editfield within the cell
lParam : not used
Return: None
Comments or Restrictions: None
%MLG_MAKEDEFHEADERS
Purpose: To Generate Header Strings for rows and columns
Parameters:
wParam : Generates row and column headers ,or 1 Generate only row headers numbers
lParam : if non-zero will skip headers with data in them
Return: None
Comments or Restrictions: MLG calls this message when a grid is first created (wParam=0). The programmer will probably only find a need to call this message when rows are being added or deleted and sequential numbers in the rows need to be restored (wParam=1).
%MLG_INSERTCOLBEFORE
Purpose: To add columns in the grid to the left of the specified column.
Parameters:
wParam : Number of columns to be added
lParam : Reference column (The selected column if 0)
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_INSERTCOLAFTER
Purpose: To add columns in the grid to the right of the specified column.
Parameters:
wParam : Number of columns to be added
lParam : Reference column (The selected column if 0)
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_INSERTROWBEFORE
Purpose: To add rows in the grid above the specified row.
Parameters:
wParam : Number of rows to be added
lParam : Reference row (The selected row if 0)
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_INSERTROWAFTER
Purpose: To add rows in the grid below the specified row.
Parameters:
wParam : Number of rows to be added
lParam : Reference row (The selected row if 0)
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_DELETECOLS
Purpose: Delete columns in the grid
Parameters:
wParam : First column
lParam : Last column
Return: 0=No err, 1=Failed
Comments or Restrictions: Does not alter dimensioning.
%MLG_DELETEROWS
Purpose: Delete rows in the grid
Parameters:
wParam : First row
lParam : Last row
Return: : 0=No err, 1=Failed
Comments or Restrictions: Does not alter dimensioning.
%MLG_REDIMARRAY
Purpose: To alter the size of the memory block holding the grid string contents and the number of rows and columns in the grid. Limited to grids with 65000 rows or less
Parameters:
wParam : LowWord=Total Rows, HighWord= Total Columns
lParam : LowWord Dimensioned Rows, HighWord Dimensioned Columns
Return: : 0=No err, <> 0 Failed Check the include file for errors 1 to 13
Comments or Restrictions: Dimensioned rows should be greater or equal to the Total Rows and likewise the dimensioned columns should be greater or equal to the total columns. In workbooks the currently active sheet is redimensioned.
IMPORTANT NOTE WHEN REDIMENSIONING SHEETS WITHIN A WORKBOOK:
Select the sheet you wish to redimension and toggle back to your current sheet. For instance if sheet 2 is active and you with to redim sheet1 then use the following code:
SendMessage g.hGridMultimaster, %MLG_SELECTSHEET,1,1
SendMessage g.hGridMultimaster, %MLG_REDIMARRAY, MAKLNG(1000, 21) ,MAKLNG(1020, 24)
SendMessage g.hGridMultimaster, %MLG_SELECTSHEET,2,1
%MLG_MAKELONG
Purpose: To store row and column numbers into a long integer.
Parameters:
wParam : Row
lParam : Column
Return: : Long Integer
Comments or Restrictions: Many messages need the row and column stored into a long integer. In languages that this is not readily avaiable, this message can be used.
%MLG_CLEARGRID (Improved in 2.06)
Purpose: To reset the grid string data to initial empty conditions (headers included).
Parameters:
wParam : 0 keep headers text but clear cell data
1 clear header text in addition to clearing cell data.
2 leave all cell data alone and only deal with formatting using lParam
lParam : 0 no formatting action
1 set row extra and extra2 (probably used as record numbers) to zero
2 unhide all hidden rows and columns
3 clear row and column formatting while leaving the row extra and extra2 (RecNo?)
4 clear cell formatting
Return: : None
Comments or Restrictions: This message may have to be run more than once to achieve desired effect
%MLG_UNDO
Purpose: If cell edit mode is active in a cell (blinking caret) then reload the original string when selection of cell was made.
Parameters:
wParam : 1 will force an exit of the edit mode of the currently selected cell (new ver 2.03)
lParam : not used
Return: None
Comments or Restrictions: None
%MLG_REDIMARRAYEX
Purpose: To alter the size of the memory block holding the grid string contents and the number of rows and columns in the grid.
Parameters:
wParam : Pointer to a string. Format="TotRows,TotCols,DimRows,DimCols"
lParam : String Length
Return: 0=No err, <> 0 Failed Check the include file for errors 1 to 13
Comments or Restrictions: Dimensioned rows should be greater or equal to the Total Rows and likewise the dimensioned columns should be greater or equal to the total columns. An example string would be "1000,12,1100,13".
IMPORTANT NOTE WHEN REDIMENSIONING SHEETS WITHIN A WORKBOOK:
Select the sheet you wish to redimension and toggle back to your current sheet. For instance if sheet 2 is active and you with to redim sheet1 then use the following code:
SendMessage g.hGridMultimaster, %MLG_SELECTSHEET,1,1
SendMessage g.hGridMultimaster, %MLG_REDIMARRAY, MAKLNG(1000, 21) ,MAKLNG(1020, 24)
SendMessage g.hGridMultimaster, %MLG_SELECTSHEET,2,1
%MLG_HIDECOLUMN
Purpose: To temporarily hide a column and allow for it to be restored to previous width.
Parameters:
wParam : %MLG_HIDECOL, %MLG_UNHIDECOL, %MLG_UNHIDEALLCOLS
lParam : Column 1 to 255 (ignored with %MLG_UNHIDEALLCOLS)
Return: None
Comments or Restrictions: None
%MLG_SORT
Purpose: Sort grid based on a 's value. Will honor character,number or date data types of the selected column.
Parameters:
wParam : %MLG_ASCEND or %MLG_DESCEND
lParam : Column 1 to 255
Return: Return 1 if operation failed
Comments or Restrictions: Assumes no formatting at the row level (.ie row headers will not be included in the sort)
%MLG_CLEARBLOCKSEL
Purpose: To unhighlight row or col hilighting.
Parameters:
wParam : 1 Clear Row Highlighting, 2 Clear Column Highlighting, 3 Clear Row and Column Highlighting
lParam : if non zero then do not refresh
Return: : None
Comments or Restrictions: None
SET DATA MESSAGES
%MLG_SETNUMFORMATROW
Purpose: Assign a predefined number formatting mask to a row.
Parameters:
wParam : Row number
lParam : slot 1 to 20
Return: None
Comments or Restrictions: The row must be formatted as a number. See Formatting
%MLG_SETNUMFORMATCOL
Purpose: To define a number formatting mask string in one of 20 slots.
Parameters:
wParam : Column number
lParam : slot 1 to 20
Return: None
Comments or Restrictions: The column must be formatted as a number. See Formatting
%MLG_SETSELECTED
Purpose: To set the selected cell
Parameters:
wParam : row
lParam : column (if column is negative, a flag is set not to adjust grid for cell for visibility)
Return: LowWord=actual set row (if less than 65,000), HighWord=actual set column
Comments or Restrictions: If either the row or column is out of range, it will be adjusted to be on the grid if column is a positive number. The column will be taken as an absolute value to allow auto scrolling flag. A MLGN_SELCHANGE notification is sent.
%MLG_SETROWFORMAT
Purpose: To set the format structure for a particular row.
Parameters:
wParam : Row
lParam : Pointer to Format Structure
Return: :0= No err, 1=Failed
Comments or Restrictions: None
%MLG_SETTOPROW
Purpose: To set the top row of grid (or secondary top row with splitter) visually on the grid.
Parameters:
wParam : New Row
lParam : 0=No refresh, 1=refresh : 2= Secondary TopRow No Refresh ,3= Secondary TopRow with Refresh
Return: Row actually set as the row.
Comments or Restrictions: Vertical Splitter has to be active to alter secondary TopRow
%MLG_SETCOLFORMAT
Purpose: To set the format structure for a particular column.
Parameters:
wParam : Column
lParam : Pointer to Format Structure
Return: 0=No err, 1=Failed
Comments or Restrictions: The widths are ignored on this call. They were probably already set with the X switch.
%MLG_SETROWCOLTEMPLATE
Purpose: To set the format template for added rows or columns that use the RowColDataType Structure.
Parameters:
wParam : Row that format would be used
lParam : Column that format would be used
Return: None
Comments or Restrictions: If Row number is bad then Row 1 is used. If Column number is bad then Column 1 is used.
%MLG_SETGRIDEXSTYLE
Purpose: To set the format items in the GridInit Structure.
Parameters:
wParam : Pointer to GridInit Structure
lParam : not used
Return: 0=No err, 1=Failed
Comments or Restrictions: This call should probably only be called once. It will DELETE the objects that it is replacing. Calling only once will only effect the objects that MLG created by default so no problems should arise. Due to this behaviour, only use fonts specifically created for this particular grid since MLG will destroy the font objects when the grid is destroyed.
%MLG_SETDIRTYFLAG
Purpose: To set the dirty flag to allow notifications on change of selected cells.
Parameters:
wParam : not used
lParam : not used
Return: None
Comments or Restrictions: None
%MLG_SETLEFTCOL
Purpose: To set the left column (or secondary left column with splitter) visually on the grid.
Parameters:
wParam : New left column
lParam : 0=No refresh, 1=refresh :: 2= Secondary LeftCol No Refresh ,3= Secondary LeftCol with Refresh
Return: None
Comments or Restrictions: Horizontal splitter has to be active to alter secondary LeftCol
%MLG_SETSKIPRECFLAG
Purpose: If last row append mode (e3 switch) is active and after a validation failure and it is desired not to append row.
Parameters:
wParam : set to 1 to skip append.
lParam : not used
Return: None
Comments or Restrictions: None
%MLG_SETROWEXTRA
Purpose: To set a long integer in the row format structure which is typically a record number.
Parameters:
wParam : Row Number
lParam : Long Integer
Return: None
Comments or Restrictions: None
%MLG_SETROWEXTRAQUAD
Purpose: To set a quad integer in the row format structure which is typically a record number.
Parameters:
wParam : Row Number
lParam : Pointer to a Quad Integer
Return: None
Comments or Restrictions: None
%MLG_SETCOLEXTRA
Purpose: : To set a long integer in the column format structure which user defined.
Parameters:
wParam : Column Number
lParam : Long Integer
Return: None
Comments or Restrictions: None
%MLG_SETCOLWIDTH
Purpose: To set the width of a column without using the mouse in the column header.
Parameters:
wParam : Column number
lParam : Width
Return: 0=No err, 1=Failed
Comments or Restrictions: Maximum column length will be clipped to 255.
%MLG_SETCELL
Purpose: To set the string contents of a cell without refresh. For use with rows less than 65000.
Parameters:
wParam : LowWord=Row, HighWord= Column
lParam : Pointer to a zero terminated string
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_SETCELLR
Purpose: To set the string contents of a cell with a grid visual refresh. For use with rows less than 65000.
Parameters:
wParam : LowWord=Row, HighWord= Column
lParam : Pointer to a zero terminated string
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_SETDIRTYFLAGZERO
Purpose: To set both cell dirty flag and row dirty flag to zero
Parameters:
wParam : not used
lParam : not used
Return: None
Comments or Restrictions: Will refresh the grid in case a row dirty indicator is showing in the row header.
%MLG_SETNUMFORMATSTR
Purpose: To define a number formatting mask string in one of 20 slots.
Parameters:
wParam : slot 6 to 20 (Slots 1 to 5 are predefined for the user.
lParam : Pointer to a string
Return: Zero if successful
Comments or Restrictions: The mask has a maximum length of 32 characters. See Formatting
PreDefined Mask(1)="#"
PreDefined Mask(2)="#,"
PreDefined Mask(3)="#,.00"
PreDefined Mask(4)="$* #,.00"
PreDefined Mask(5)="0.0%"
%MLG_SETCELLEX
Purpose: To set the string contents of a cell to contents of the Buffer without refresh.
Parameters:
wParam : Row
lParam : Column
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_SETCELLREX
Purpose: To set the string contents of a cell to the contents of the Buffer with a grid visual refresh.
Parameters:
wParam : Row
lParam : Column
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_SETBUFFER
Purpose: To set the Buffer string to be used with MLG_SETCELLEX and MLG_SETCELLREX.
Parameters:
wParam : Row
lParam : Column
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_SETHEADERCOLOR
Purpose: To set the color of the header and set shadow.
Parameters:
wParam : Header Color RGB
lParam : Set to 1 to show a shadow
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_SETWORKBOOKPROP
Purpose: Set user workbook options
Parameters:
wParam :%MLG_USERTABMOVE, or %MLG_USERTABEDIT
lParam : %TRUE or %FALSE
Return: None
Comments or Restrictions: These are MS Excel like tab name edit plus drag and drop tab repositioning
%MLG_SETSHEETUSER
Purpose: Store information by the programmer for a particular sheet.
Parameters:
wParam :zero or tab position array number
lParam : 4 byte number
Return:None
Comments or Restrictions:If wParam is zero, the number will be stored in the active sheets data structure which will be moved to it array slot when it is deselected. If the number is stored in the active sheets array slot it will be mistakenly overwritten when the current sheet is deselected.
%MLG_SETROWHEIGHT
Purpose: To set the height of a row in pixels of a designated row
Parameters:
wParam : MyRow
lParam : MyNewHeight
Return: None
Comments or Restrictions: New row height will be between 4 and 255 pixels.
GET DATA MESSAGES
%MLG_GETSELECTED
Purpose: To retrieve the currently selected cell. For use with row counts less than 65000.
Parameters:
wParam : not used
lParam : not used
Return: LowWord=selected row, HighWord=selected column
Comments or Restrictions: None
%MLG_GETROWFORMAT
Purpose: To retrieve the format of a row
Parameters:
wParam : row
lParam : Pointer to a RowColDataType Structure
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_GETROWHEIGHT
Purpose: To retrieve the height of a row in pixels
Parameters:
wParam : MyRow
lParam : Not used
Return: RowHeight
Comments or Restrictions: None
%MLG_GETTOPROW
Purpose: To retrieve the top most row visual on the grid
Parameters:
wParam : 0 for main TOPROW ,1 for secondary TOPROW when splitter is used
lParam : not used
Return: TopRow
Comments or Restrictions: None
%MLG_GETCOLFORMAT
Purpose: To retrieve the format of a row
Parameters:
wParam : Column
lParam : Pointer to a RowColDataType Structure
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_GETDIRTYFLAG
Purpose: To retrieve the cell dirty flag.
Parameters:
wParam : not used
lParam : not used
Return: 0=not dirty , 1=dirty
Comments or Restrictions: Dirty is actually not zero. It can be any number.
%MLG_GETROWCOLTOT
Purpose: To retrieve the total rows and total columns of the grid. For use with grid row count less than 65000.
Parameters:
wParam : not used
lParam : not used
Return: LowWord=total rows, HighWord=total columns
Comments or Restrictions: Total row and column should be less or equal to the dimensioned values for the rows and columns respectively.
%MLG_GETROWCOLDIM
Purpose: To retrieve dimensioned rows and columns. For use with grid row count less than 65000
Parameters:
wParam : not used
lParam : not used
Return: LowWord=dimensioned rows, HighWord=dimensioned columns
Comments or Restrictions: None
%MLG_GETLEFTCOL
Purpose: To retrieve the left most visual column on the grid
Parameters:
wParam : 0 for main LEFTCOL , 1 for secondary LEFTCOL when splitter in use
lParam : not used
Return: Left Column
Comments or Restrictions: None
%MLG_GETOLDCELL
Purpose: To retrieve the cell previously selected to the current cell. To be used with row count less than 65000.
Parameters:
wParam : 0
lParam : 0
Return: LowWord=prev cell row, HighWord=prev cell column
Comments or Restrictions: None
%MLG_GETUNDO
Purpose: To retrieve the string data upon entry into a cell.
Parameters:
wParam : 0 = current cell, 1 = previous cell
lParam : Pointer to zero teminated string
Return: 0=No err, 1=Failed
Comments or Restrictions: The undo string will be copied to the zero terminated string supplied.
%MLG_GETCELLTYPE
Purpose: To retrieve the cell type of a cell
Parameters:
wParam : Row
lParam : Column
Return: -1=Failed, 0=Edit, 1=Edit, 2=Checkbox 3=Combo Static, 4=Combo Editable
Comments or Restrictions: None
%MLG_GETROWEXTRA
Purpose: To retrieve the user defined data stored with the row (typically a record number)
Parameters:
wParam : Row
lParam : not used
Return: Long Integer
Comments or Restrictions: None
%MLG_GETROWEXTRAQUAD
Purpose: To retrieve the user defined data stored with the row (typically a record number)
Parameters:
wParam : Row
lParam : Pointer to a Quad Integer which the return Quad will be put
Return: None
Comments or Restrictions: None
%MLG_GETCOLEXTRA
Purpose: To retrieve the user designated long value for a given column
Parameters:
wParam : Column
lParam : 0
Return: Long Integer
Comments or Restrictions: None
%MLG_GETCOLWIDTH
Purpose: To retrieve the column with in pixels
Parameters:
wParam : Column
lParam : 0
Return: Column Width
Comments or Restrictions: None
%MLG_GETCELL
Purpose: To retrieve string contents of a cell. For use with row count less than 65000.
Parameters:
wParam : LowWord=Row, HighWord= Column
lParam : Pointer to zero teminated string
Return: 0=No err, 1=Failed
Comments or Restrictions: None
%MLG_GETBUILD
Purpose: To retrieve the build number of the MLG.DLL
Parameters:
wParam : not used
lParam : not used
Return: Long Integer
Comments or Restrictions: The build is in the form mmddyy
%MLG_GETROWCOLALLBLOCKSEL
Purpose: To retrieve if total grid is selected
Parameters:
wParam : not used
lParam : not used
Return: 0= Total grid not selected, Not zero = Total grid selected
Comments or Restrictions: None
%MLG_GETROWBLOCKSEL
Purpose: To retrieve row selection block. To be used with row count less than 65000.
Parameters:
wParam : not used
lParam : not used
Return: LowWord=Start Row, HighWord=End Row
Comments or Restrictions: None
%MLG_GETCOLBLOCKSEL
Purpose: To retrieve column selection block.
Parameters:
wParam : not used
lParam : not used
Return: LowWord=Start Column, HighWord=End Column
Comments or Restrictions: None
%MLG_GETMENUHANDLE
Purpose: To retrieve the right click menu handle
Parameters:
wParam : 0 for right click menu , 1 for right click tab menu, 2 right click infobar menu
lParam : not used
Return: MenuHandle
Comments or Restrictions: None
%MLG_GETROWCOLTOTEX
Purpose: To retrieve the total rows and total columns of the grid.
Parameters:
wParam : Pointer to row 4 byte variable
lParam : Pointer to column 4 byte variable
Return: None - row and column long integers are filled
Comments or Restrictions: Total row and column should be less or equal to the dimensioned values for the rows and columns respectively.
%MLG_GETROWCOLDIMEX
Purpose: To retrieve dimensioned rows and columns
Parameters:
wParam : Pointer to row 4 byte variable
lParam : Pointer to column 4 byte variable
Return: None - row and column long integers are filled
Comments or Restrictions: None
%MLG_GETROWBLOCKSELEX
Purpose: To retrieve row selection block
Parameters:
wParam : Pointer to rowstart 4 byte variable
lParam : Pointer to rowend 4 byte variable
Return: None - rowstart and rowend long integers are filled
Comments or Restrictions: None
%MLG_GETCOLBLOCKSELEX
Purpose: To retrieve column selection block
Parameters:
wParam : Pointer to columnstart 4 byte variable
lParam : Pointer to columnend 4 byte variable
Return: columnstart and columnend long integers are filled
Comments or Restrictions: None
%MLG_GETOLDCELLEX
Purpose: To retrieve the cell previously selected to the current cell
Parameters:
wParam : Pointer to row 4 byte variable
lParam : Pointer to column 4 byte variable
Return: None - row and column long integers are filled
Comments or Restrictions: None
%MLG_GETSELECTEDEX
Purpose: To retrieve the cell currently selected to the current cell
Parameters:
wParam : Pointer to row 4 byte variable
lParam : Pointer to column 4 byte variable
Return: None - row and column long integers are filled
Comments or Restrictions: None
%MLG_GETCELLEX
Purpose: To retrieve the contents of a cell and put it in the Buffer
Parameters:
wParam : row
lParam : column
Return: None
Comments or Restrictions: None
%MLG_GETBUFFER
Purpose: To retrieve the buffer and put the contents in a string variable
Parameters:
wParam : Pointer to a string variable
lParam : Length of buffer to retrieve (maximum is %MLG_MAXCELLLEN)
Return: None - the string is filled
Comments or Restrictions: None
WORKBOOK MESSAGES
%MLG_ADDSHEET
Purpose: To add a new sheet to the workbook
Parameters:
wParam : Requested number of rows - if zero, use the number of rows on the currently active sheet
lParam : Requested number of cols - if zero, use the number of cols on the currently active sheet.
Return: The array slot used be the newly created sheet.
Comments or Restrictions: If zeros are passed as parameters, the header names and column widths are used from the currently active sheet for rows. Columns copies over all formatting except for checkboxes and dropdown list. This helps in duplicating sheets. Other formatting than those copied over will have to be done manually.
%MLG_DELETESHEET
Purpose: To deleted a non actively selected sheet.
Parameters:
wParam : Sheet array slot of sheet being deleted
lParam : None
Return: Zero if no error. Non-zero if operation was aborted
Comments or Restrictions: This abandoned array slot may be reused.
%MLG_NAMESHEET
Purpose: To rename a sheet as displayed be the tab
Parameters:
wParam : Sheet array slot number to rename
lParam : Pointer to a string variable of new name
Return: Zero for success , Non-zero for failure
Comments or Restrictions: None
%MLG_SELECTSHEET
Purpose: To make a sheet active on the grid or only to make active to update data
Parameters:
wParam : Which sheet array slot to select - if zero simply copy current sheet to its place in the array.
lParam : Zero = Do Not Refresh. Nonzero = update grid upon selection
Return: None - Old sheet array slot number
Comments or Restrictions: Do not refresh the grid if the only reason to select the grid is to update data of a non selected sheet. The data in the sheet array may not be up to date for the currently loaded sheet. Using a zero for wParam will update the array without selecting a new sheet.
%MLG_SWAPSHEET
Purpose: To swap array slots for 2 sheets
Parameters:
wParam : Array slot number for sheet 1
lParam : Array slot number for sheet 2
Return: Zero for success , Non-zero for failure
Comments or Restrictions: The currently active slot may be swapped.
%MLG_SHOWSHEETTABS
Purpose: Show the sheet tab bar if hidden. Assumes that the horizontal scrollbar is visible.
Parameters:
wParam : Size of the tab bar in Pixels. 70 pixels is the minimum size. Zero hides the tab bar. The maximum size in the control width minus 70 pixels for the horizontal scrollbar.
lParam : None
Return: None
Comments or Restrictions: None
%MLG_COLORSHEETTAB
Purpose: To color a sheet tab to a RGB color
Parameters:
wParam : Array slot of desired tab
lParam : RGB color
Return: Zero for success , Non-zero for failure
Comments or Restrictions: None
%MLG_GETSHEETINFO
Purpose: To retrieve data about the which sheet is in which array slot etc.
Parameters:
wParam : Action
lParam : Pointer to string variable for GETNAME and GETNUMBER
Return: Slot Number (or Sheet ID) or zero for failure.
Comments or Restrictions: For action GETNAME, the name of the tab is returned in the string variable and the Sheet Number is passed to MLG as a string literal in the lParam. For GETNUM (get number), the name of the sheet is passed to MLG in the lParam and the number is returned by the function.
'WorkSheet Get Info Actions
%MLG_SHEET_GETNUM = 1 'Get sheet slot number of a sheet given the its name
%MLG_SHEET_GETNAME = 2 'Get the name of a sheet given the sheet slot number
%MLG_SHEET_GETTOT = 3 'Get count of sheets
%MLG_SHEET_GETRIGHT = 4 'Get sheet slot number directly to the right of given sheet
%MLG_SHEET_GETLEFT = 5 'Get sheet slot number directly to the left of given sheet
%MLG_SHEET_GETFIRST = 6 'Get sheet slot number of first sheet
%MLG_SHEET_GETLAST = 7 'Get sheet slot number of last sheet
%MLG_SHEET_GETID = 8 'Get Sheet ID given the sheet slot number
%MLG_SHEET_GETNUMFROMID = 9 'Get sheet slot number given the sheet id
%MLG_SHEET_GETCURRENT = 10 'Get sheet currently active sheet slot number
FORMAT OVERRIDE MESSAGES
%MLG_CREATEFORMATOVERRIDE
Purpose: To create a Format Override array for the currently selected sheet. The dimensions of this array now mirror that of the sheet. This message has been changed in version 2.00
Parameters:
wParam : Not Used
lParam : Not Used
Return: 0=No err, 1=Failed out of bounds , 2= Format Override already exists.
Comments or Restrictions: Only one Format Override array is permitted per sheet.
%MLG_DELETEFORMATOVERRIDE
Purpose: To delete the Format Override array from the currently selected sheet if one existed.
Parameters:
wParam : None
lParam : None
Return: None
Comments or Restrictions: None
%MLG_SETFORMATOVERRIDE
Purpose: To set the format override of a cell
Parameters:
wParam : LowWord=Row, HighWord= Column
lParam : Pointer to a FormatOverride Structure
Return: 0=No err, 1=Failed - mostly likely cell is out of bounds
Comments or Restrictions: If a font does not exist it will be created
%MLG_GETFORMATOVERRIDE
Purpose: To retrieve the format override of a cell
Parameters:
wParam :LowWord=Row, HighWord= Column
lParam : Pointer to a FormatOverride Structure
Return: 0=No err, 1=Failed - mostly likely cell is out of bounds
Comments or Restrictions: None
%MLG_GETFORMATOVERRIDEROWCOL
Purpose: To retrieve the dimensions of the format override.
Parameters:None
Return: LowWord=Row Dimension, HighWord= Column Dimension
Comments or Restrictions: This only works on the currently selected sheet.
%MLG_GETWORKBOOKPROP
Purpose: To retrieve user workbook options
Parameters:
wParam :%MLG_USERTABMOVE, or %MLG_USERTABEDIT
lParam : 0
Return: %TRUE or %FALSE (zero or one)
Comments or Restrictions: These are MS Excel like tab name edit plus drag and drop tab repositioning
.
%MLG_GETSHEETUSER
Purpose: Retrieve information by the programmer for a particular sheet.
wParam :zero or tab position array number.
lParam : 0
Return::If wParam is zero, the number will be retrieved from the active sheets data structure.
Comments or Restrictions: None
%MLG_FREEZE DEPRECATED
%MLG_GETNOTIFYPARAM
Purpose: To return one of the 4 extra parameters in the notify message
wParam :Which Parameter - 1 to 4
lParam : Not Used
Return::The contents of the parameter..
Comments or Restrictions: This is for Ebasic support
'MESSAGES NEW TO MLG IN VERSION 2.00
%MLG_SETBKGNDCELLCOLOR
Purpose: MLG comes with 15 colors predefined for the background colors assigned to particular cells.
wParam :Slots 1 to 15 (slot zero is not changable)
lParam : RGB number
Return::None
Comments or Restrictions: The background color slots come predefined as:
%CELLCOLORWHITE = 0
%CELLCOLORBLACK = 1
%CELLCOLORRED = 2
%CELLCOLORSALMON = 3
%CELLCOLORGREEN = 4
%CELLCOLORLIGHTGREEN = 5
%CELLCOLORBLUE = 6
%CELLCOLORLIGHTBLUE = 7
%CELLCOLORMAGENTA = 8
%CELLCOLORDARKMAGENTA = 9
%CELLCOLORCYAN = 10
%CELLCOLORAQUAMARINE = 11
%CELLCOLORKHAKI = 12
%CELLCOLORBROWN = 13
%CELLCOLORYELLOW = 14
%CELLCOLORORANGE = 15
%MLG_SETTEXTCELLCOLOR
Purpose: MLG comes with 15 colors predefined for the foreground colors assigned to particular cells.
wParam :Slots 1 to 15 (slot zero is not changable)
lParam : RGB Number
Return::None
Comments or Restrictions: The foreground text color slots come predefined as:
%CELLCOLORBLACK = 0
%CELLCOLORWHITE = 1
%CELLCOLORRED = 2
%CELLCOLORSALMON = 3
%CELLCOLORGREEN = 4
%CELLCOLORLIGHTGREEN = 5
%CELLCOLORBLUE = 6
%CELLCOLORLIGHTBLUE = 7
%CELLCOLORMAGENTA = 8
%CELLCOLORDARKMAGENTA = 9
%CELLCOLORCYAN = 10
%CELLCOLORAQUAMARINE = 11
%CELLCOLORKHAKI = 12
%CELLCOLORBROWN = 13
%CELLCOLORYELLOW = 14
%CELLCOLORORANGE = 15
%MLG_HIDEROW
Purpose: To hide or unhide row
wParam :0 - hide row , 1 - unhide row, 2 - unhide all rows
lParam : row number
Return::None
Comments or Restrictions: If wParam is unhide all rows the lParam is ignored
%MLG_SETROWHEIGHT
Purpose: To programmically change the row height
wParam :Row number to change height
lParam : New height in pixels
Return::None
Comments or Restrictions: None
%MLG_SHOWSPLITTERS
Purpose: Splitters a worksheet to be split into 4 sub panes with separate scrollbars
wParam : 0 - hide the worksheet splitters , 1 - show the worksheet splitters
lParam : non zero caused a refresh
Return::None
Comments or Restrictions: None
%MLG_ROWCOLHILITE
Purpose: Default action is show selected cells as a light brown color in both the column and row headers
wParam :0 - show row / column header hilighting of selected cells , 1 - turn off the feature
lParam : Not Used
Return::None
Comments or Restrictions: None
%MLG_GETGRIDDC
Purpose: Get the grid Device Context in order to do custom drawing on the grid. This is available to the advanced programming wanting to perhaps draw a chart on one of the worksheets for example. It is intended that a programmer would use this inside of a SheetTypeCallback. The sheet type of a sheet would need to be set to non zero positve value.
wParam :Not Used
lParam : Not Used
Return::Device Context of the grid.
Comments or Restrictions: None
%MLG_SETSHEETTYPE
Purpose: Set the sheet type greater than zero in conjuction with a SheeTypeCallback
wParam : Sheet Type number greater than zero
lParam : Not Used
Return::None
Comments or Restrictions: This directs the sheettype to the current worksheet. A non zero value will prevent MLG from drawing on the control. It is assume that drawing will be taken over by the SheetTypeCallback.
%MLG_ALTERATTRIBUTE
Purpose: To change the appearance of some to the attributes of MLG.
wParam : Attribute
lParam : Value
Return::None
Comments or Restrictions: Some of these attributes simply call internal MLG messages. This is done for convenience.
'Attributes
%MLG_SUPRESSROWCOLHILITE = 1 ' value 1 suppresses hilite , 0 allows hilite
%MLG_SUPPRESSGRIDLINES = 2 ' value 1 suppresses gridlines , 0 allows gridlines
%MLG_SHOWTHESPLITTERS = 3 ' value 0 suppresses splitters , 1 shows splitters
%MLG_SHOWCROSSCURSOR = 4 'non zero will load a thick cross if grid cell formatting
%MLG_SUPRESSROWCOLRESIZE = 5 ' value 1 suppresses row col resizing , 0 allows resizing
%MLG_SETMYSHEETTYPE = 6 'zero or positive number - non zero prevent normal MLG grid redraw
%MLG_SETCellLineColorRGB =7
%MLG_SETCellBkColorRGB = 8
%MLG_SETWindowBkColorRGB = 9
%MLG_SETRCHiLiteRGB = 10
%MLG_SETUserData = 11 ' Optional value asas
%MLG_SETHeaderSelectRGB =12
%MLG_KEEPCELLBUTTONSVISIBLE =13 '' value 0 will keep unselected cell comboboxes and user buttons hidden, 1 always shows these items.
%MLG_SHOWFORMATMENU =14 ' value 1 will allows use of control key and right clickmenu to edit cell formats on selected block.
%MLG_DELETEKEYERASE =15 ' 'value 1 will allows to delete block of cell data (no undo)
%MLG_TOPINFOBAR =16 'value 1 will show the top infobar
%MLG_SUPPRESSUSERSETPRINTAREA =17 'value 1 will suppress a user from selecting a printarea with a mouse
%MLG_PRINTPREVIEWAUTOCLOSE =18 ' value 0 no autoclose , 1 will autoclose printpreview upon print
%MLG_PRINTMILLIMETERS =19 'NEW 3 ' value 0 margins in inches (default), 1 margins in millimeters
%MLG_PRINTJUSTIFICATION =20 'value 0 no grid centering,1vert only,2horz only 3 vert and horz centering
%MLG_CELLDATA
Purpose: To be used by non Powerbasic programs to enter data into a cell on the grid.
wParam :Pointer to a celldata type structure
lParam : Pointer to an ASCIIZ string
Return::None
Comments or Restrictions:
TYPE CellData
MyAction AS LONG 'non zero is put 0 is get
MyRow AS LONG
MyCol AS LONG
MySheet AS LONG 'zero for the default (or current) sheet
RefreshFlag AS LONG 'non zero is refresh
END TYPE
%MLG_SETCALLBACK
Purpose: Put info here
wParam :Which callback type (described below)
lParam : Code pointer to a callback using the windows callback as a calling template
Return::None
Comments or Restrictions:
'Callbacks
%MLG_DRAWCALLBACK = 1
%MLG_FORMULACALLBACK = 2
%MLG_NUMBERCALLBACK = 3
%MLG_LISTBOXCALLBACK = 4
%MLG_DATECALLBACK = 5
%MLG_SHEETTYPECALLBACK = 6
%MLG_GETCELLFONTHANDLE
Purpose: Returns the handle of a cell font if it exists
wParam :Which font slot (0 to 15)
lParam : Not Used
Return::None
Comments or Restrictions: None
%MLG_CHANGEFONTNAME
Deprecated
%MLG_CHANGEFONTSIZE
Deprecated.
%MLG_SETUSERCELLFONT
Deprecated.
%MLG_SHOWFORMATCELLDIALOG
Deprecated.
%MLG_ADDFORMATOVERRIDELIST
Purpose: Put info here
wParam : 1 to 15
lParam : Pointer to ASCIIZ comma delimited string formatted as follows:
"ListName, Item1,Item2,Item3"
Return::Zero if successful
Comments or Restrictions: The ListName will show up in the Format Cells dialog box as displayed above. If more than 15 individual list are needed you will have to employ the LISTBOXCALLBACK option.
New to Version 2.066. The first item (after the ListName) in the comma delimited list is an optional string to define the number of choices in the dropdown. It has the format of "|7/8" where "|" is the flag,7 is for seven choices in the dropdown and 8 the number of pixels to adjust the dropdown when the choices are displayed above the cell. This number will have to be played with to get the combobox looking right. An example liststr could be:
"MyListName,|7/8,xx1,xx2,xx3,xx4,xx5,xx6,xx7,xx8,xx9,xx10"
%MLG_SETFORMATOVERRIDEEX
Purpose: Put info here
wParam : Which Cell -----> LowWord=Row, HighWord= Column
lParam : Which Cell Item -----> LowWord, HighWord= Item Value
Return::Zero if successful
Comments or Restrictions: Read more about the meaning of the value of an item in the Formatting section of this help file. Note that is a font does not exist, it will be created.
'Format Override Which Items
%MLG_TYPE_CELLTYPE = 0
%MLG_TYPE_WRITELOCK = 1
%MLG_TYPE_USING = 2
%MLG_TYPE_FONT = 3
%MLG_TYPE_BKGCOLOR = 4
%MLG_TYPE_FGCOLOR = 5
%MLG_TYPE_BORDER = 6
%MLG_TYPE_CASE = 7
%MLG_TYPE_JUST = 8
%MLG_GETFORMATOVERRIDEEX
Purpose: Put info here
wParam : Which Cell -----> LowWord=Row, HighWord= Column
lParam : Which Item as described in the comments
Return::Value of Item
Comments or Restrictions: Read more about the meaning of the value of an item in the Formatting section of this help file.
'Format Override Which Items
%MLG_TYPE_CELLTYPE = 0
%MLG_TYPE_WRITELOCK = 1
%MLG_TYPE_USING = 2
%MLG_TYPE_FONT = 3
%MLG_TYPE_BKGCOLOR = 4
%MLG_TYPE_FGCOLOR = 5
%MLG_TYPE_BORDER = 6
%MLG_TYPE_CASE = 7
%MLG_TYPE_JUST = 8
%MLG_SETDAYFORMATSTR
Deprecated
%MLG_SETMONTHFORMATSTR
Deprecated
%MLG_SETDEFAULTDATEFORMAT
Deprecated
%MLG_GETMULTICELLSELECTION
Purpose: Get a MultiCell Selection
wParam :Pointer to a Rectangle fromatted as below
lParam : Not Used
Return::None
Comments or Restrictions:
Top = StartRow
Left = StartCol
Bottom = EndRow
Right = EndCol
%MLG_SETMULTICELLSELECTION
Purpose: Programmically sets a multicell selection
wParam :Pointer to a Rectangle fromatted as below
lParam : Not Used
Return::None
Comments or Restrictions:
Top = StartRow
Left = StartCol
Bottom = EndRow
Right = EndCol
%MLG_SETMULTICELLBORDER
Purpose: To be used to facilitate drawing a border around a block of cells
wParam :Pointer to a Rectangle fromatted as below
lParam : Not Used
Return::None
Comments or Restrictions: This message will cycle through the cells described in the rectangle and set the the appropriate border for that cell to form an enclosing border.
Top = StartRow
Left = StartCol
Bottom = EndRow
Right = EndCol
%MLG_REGISTERBITMAP
Purpose: To be used for %MLG_TYPE_DRAW cell types
wParam :Slot 1 to 15
lParam : Handle to bitmap
Return::None
Comments or Restrictions: If a slot is already occupied with a bitmap, it will be destroyed with a DeleteObject call
%MLG_ASSIGNCELLBITMAP
Purpose: To be used for %MLG_TYPE_DRAW cell types
wParam : Which Cell -----> LowWord=Row, HighWord= Column
lParam : Slot 1 to 15
Return::None
Comments or Restrictions: None
%MLG_BITMAPTODRAWRECT
Purpose: Intended to be used in the Draw Callback for drawing pictures in cells.
wParam : Handle to a Bitmap
lParam : Pointer to a rectangle
Return::None
Comments or Restrictions: None
%MLG_INSERTRCLICKMENU
Purpose: Put info here
wParam : Pointer to ASCIIZ string formatted the same as using the M switch
lParam : 0 for right click menu , non zero for the right click tab menu
Return::None
Comments or Restrictions: MLG will destroy the existing menu handle (if one exists) before installing a new one. Example "Item1,Item2,-,Item3"
%MLG_SETMENUHANDLE
Purpose: Install you own right click menu. Could possibly be used to install a menu with submenus.
wParam :Menu Handle
lParam : 0 for right click menu , non zero for the right click tab menu
Return::Zero if successful
Comments or Restrictions: Use at your own risk. MLG will destroy the existing menu handle (if one exists) before installing a new one.
%MLG_GETLISTHANDLE
Purpose: Get the handle to the listbox used for Comboboxes
wParam :Not Used
lParam : Not Used
Return::None
Comments or Restrictions: This is for the programmer who wants to try and alter the font size or display rectangle of the listbox. Use at your own risk.
'NEW TO MLG VERSION 2.06
%MLG_SETVIEWROWCOL
Purpose: Set the viewable Rows and Columns
wParam :Viewable Rows
lParam : Viewable Columns
Return::None
Comments or Restrictions: The dimensioned Rows and Columns should be as large or larger than the view row and columns. If no, the viewable Rows and Columns will be limited to the Dimensioned Rows and Columns.
%MLG_SETDATEFORMATSTR
Purpose: Used to further format a data cell.
wParam :1 to 15
lParam : pointer to zero terminated format string
Return::None
Comments or Restrictions: This uses the Windows API call GetFormatInfo. See the Date Formatting in the Formatting item of this help file for more information on the 's usage.
%MLG_SETFOMATMENUDATENUMITEMS
Purpose: Sets which items will be listed in right click format menu under the CellType submenu
wParam :string containing comma numbers of 5 number format slots then 4 date format slots.
lParam : Not Used
Return::None
Comments or Restrictions: See the Date Formatting in the Formatting item of this help file for more information on the 's usage.
%MLG_SETMERGECELLS
Purpose: Merged cells to a group to act as a label or textbox. The group of cells take on the attributes of the upper left cell in the group. Since it is essentially a label the celltype is basically the cell edit type.
wParam :Upper left hand row and column of merged cell group, with low word being row and high word being column
lParam : Lower right hand row and column of merged cell group, with low word being row and high word being column
Return::None
Comments or Restrictions: Setting the lParam to equal the wParam will unset a mergered group. See the Merged Cells in the Formatting item of this help file for more information on the 's usage. Only 16 mergered cell groups are allowed per sheet. The mergered cell group can not be selected. All member cells of the merged group are locked.
%MLG_SAVESHEET
Purpose: Save the currently visible (active) sheet within a workbook to a file. All data is saved on the sheet except for 1) objects (merged cells) and 2) split panes and freeze pane info
wParam :0 save all cell data , 1 skip cells with no data (include cell formatting data
lParam : pointer to a zero terminated string of the 's path to be saved to.
Return::None
Comments or Restrictions: See the Save and Load item of this help file for more information on the 's usage.
%MLG_LOADSHEET
Purpose: Load a saved sheet file on to the currently visible (active) sheet of a grid
wParam: -1 get row info only
-2 get col info and cell info only
0 load everything
1 skip the cell data
2 skip the cell formatting
3 skip header data which may include some cell combobox data
4 Only load cell data
lParam :pointer to a zero terminated string of the 's path to be loaded.
Return::None
Comments or Restrictions: See the Save and Load item of this help file for more information on the 's usage. The programmer is responsible for a properly dimensioned grid to receive the data. This call will automatically set the proper viewing rows and columns if possible. This call will probably be used in conjuction with the MLG_CLEARGRID call. It is possible that the file may have had only the cells with data saved to it. Loading onto an uncleared grid will leave unupdated cells alone. This may or may not be what the programmer wants.
%MLG_MAKENEWFONT (The handling of fonts in MLG has significantly changed in version 2.06)
Purpose: Load new fonts into the 1 or more of the available font slots. There are 2 forms of this message.
Form 1 (MLG System Fonts - slots 0 to 6)
wParam :low word is set to zero
low byte of high word is the font height
high byte of the high work is the font family
lParam : pointer to a zero terminated string of the fonts face name ex "Tahoma"
Form 2 (User fonts slots 7 to 15)
wParam :slot 7 to 15
lParam : handle of new font
Return::None
Comments or Restrictions: See the Fonts in the Formatting item of this help file for more information on the 's usage. Form 1 uses the (0 - font height) form of the font height.
'NEW TO MLG VERSION 3.00
%MLG_PRINT
Purpose: Send area outlined by the PrintArea directly to the printer. If both wParam and lParam = -1 then only a print file will be generated and not sent to the printer. This file would probably be saved in another directory for printing later.
wParam :0 no print dialog , 1 show print dialog -1 for printfile only
lParam : 0 make new print file, 1 do not make a new print file -1 for printfile only
Return::None
Comments or Restrictions: Upon clicking OK the print job will be sent to the printer if wParam is set to 1. If lParam is set to 1 then a new printfile will not be generated from the print area and this allows to the programmer to copy an old printfile to the MLG root directory and reprint that old file. The name of this file is expected to be "MLG_Temp_Print.tmp" and can be reference with the string constant $MLGPRINTFILE. If MLG_Print.DLL is not present, the message will be ignored.
%MLG_PRINTPREVIEW
Purpose: Show the print preview dialog
wParam :0 no print dialog , 1 show print dialog
lParam : 0 make new print file, 1 do not make a new print file
Return::None
Comments or Restrictions: Upon clicking OK the print job will be sent to the page preview dialog if wParam is set to 1. If lParam is set to 1 then a new printfile will not be generated from the print area and this allows to the programmer to copy an old printfile to the MLG root directory and reprint that old file. The name of this file is expected to be "MLG_Temp_Print.tmp" and can be reference with the string constant $MLGPRINTFILE. If MLG_Print.DLL is not present, the message will be ignored.
%MLG_SETPRINTOPTIONS
Purpose: Set Print Dialog type parameters by hand
wParam :LOWRD is number of copies HIWRD is autoclose (-1 will skip the wParam settings)
lParam : LOWRD PrintPageFrom HIWRD PrintPageTo (-1 will skip the lParam settings)
Return::None
Comments or Restrictions: Also if any LOWRD or HIWRD is -1, its value assignment will be skipped
'%MLG_PRINTAUTOCLOSEOFF = 0
'%MLG_PRINTAUTOCLOSEON = 1
%MLG_SETPAGEOPTIONS
Purpose: Set Page Setup Dialog type parameters by hand
wParam :LOWRD the paper HIWRD is the tray (-1 will skip the wParam settings)
lParam : LOWRD is the orientation HIWRD is margins in millimeter flag (-1 will skip the lParam settings)
Return::None
Comments or Restrictions: Also if any LOWRD or HIWRD is -1, its value assignment will be skipped
%MLG_PRINT_DEFAULTORIENTATION=0 'Default Portrait
%MLG_PRINT_PORTRAIT=1
%MLG_PRINT_LANDSCAPE=2
%MLG_PRINTMARGINSINCHES = 0
%MLG_PRINTMARGINSMM = 1
Tray common constants
%DMBIN_UPPER = 1
%DMBIN_LOWER = 2
%DMBIN_MIDDLE = 3
%DMBIN_MANUAL = 4
%DMBIN_ENVELOPE = 5
%DMBIN_ENVMANUAL = 6
%DMBIN_AUTO = 7
%DMBIN_TRACTOR = 8
%DMBIN_SMALLFMT = 9
%DMBIN_LARGEFMT = 10
%DMBIN_LARGECAPACITY = 11
%DMBIN_CASSETTE = 14
%DMBIN_FORMSOURCE = 15
Paper common constants
%DMPAPER_LETTER = 1 Letter 8.5 x 11 inches
%DMPAPER_TABLOID = 3 Tabloid 11 x 17 inches
%DMPAPER_LEDGER = 4 Ledger 17 x 11 inches
%DMPAPER_LEGAL = 5 Legal 8.5 x 14 inches
%DMPAPER_STATEMENT = 6 Statement 5.5 x 8.5 inches
%DMPAPER_EXECUTIVE = 7 Executive 7.25 x 10.5 inches
%DMPAPER_A3 = 8 A3 297 x 420 mm
%DMPAPER_A4 = 9 A4 210 x 297 mm
%DMPAPER_A5 = 11 A5 148 x 210 mm
%DMPAPER_B4 = 12 B4 250 x 354 mm
%DMPAPER_B5 = 13 B5 182 x 257 mm
%DMPAPER_FOLIO = 14 Folio 8.5 x 13 inches
%DMPAPER_QUARTO = 15 Quarto 215 x 275 mm
%DMPAPER_10X14 = 16 10x14 10 x 14 inches
%DMPAPER_11X17 = 17 11x17 11 x 17 inches
%MLG_SETPRINTMARGINS
Purpose: Set the margins of the printed page in thousandths of inches by default or in hundredths of millimeters if the millimeter flag has been set.
wParam :pointer to a RECT that
lParam :LOBYT(LOWRD(lParam)) = Show Row and Column Headers
HIBYT(LOWRD(lParam)) = Show Gridlines
LOBYT(HIWRD(lParam)) = Print Page Order
LHBYT(HIWRD(lParam)) = Show Row and Column Headers
Return::None
Comments or Restrictions: If the lParam is -1 then it will be ignored. The default is for 0.25 inches all around the paper which would be represented by:
MyMarginRect.nTop = 250 'millimeter flag is not set thousandths of inches
MyMarginRect.nLeft = 250
MyMarginRect.nBottom = 250
MyMarginRect.nRight = 250
-OR-
MyMarginRect.nTop = 635 'millimeter flag is set hundredths of mm
MyMarginRect.nLeft = 635
MyMarginRect.nBottom = 635
MyMarginRect.nRight = 635
0.3937 thousandths of inch = 1 hundredths of mm
1 thousandths of inch = 2.54 hundredths of mm
Print Page Order
%MLG_PRINT_ACROSSTHENDOWN=0 'Default
%MLG_PRINT_DOWNTHENACROSS=1
Show Gridlines
%MLG_PRINT_SHOWGRIDLINES=0 'Default
%MLG_PRINT_SUPPRESSGRIDLINES=1
Show Row and Column Headers
%MLG_PRINT_SHOWNOROWANDCOLHEADERS=0 'Default
%MLG_PRINT_SHOWROWHEADERS=1
%MLG_PRINT_SHOWCOLHEADERS=2
%MLG_PRINT_SHOWROWANDCOLHEADERS=3
Print Justification
%MLG_PRINTNOCENTERING = 0
%MLG_PRINTVERTCENTERING = 1
%MLG_PRINTHORZCENTERING = 2
%MLG_PRINTBOTHCENTERING = 3
%MLG_GETPRINTMARGINS
Purpose:
wParam :Pointer to a RECT to receive the margin RECT
lParam : Pointer to a Long variable to receive the formatting options
Return::None
Comments or Restrictions: See SETPRINTMARGINS for parameter descriptions. The RECT will hold either 1000ths of inches or 100th of millimeters depending on the millimeter flag set in the SETPAGEOPTIONS message or the attributes flags:
SendMessage hGrid, %MLG_ALTERATTRIBUTE, %MLG_PRINTMILLIMETERS,%MLG_PRINTMARGINSMM
%MLG_SETPRINTAREA
Purpose: A print area MUST BE SET for MLG to know what needs to be printed. If the parameters are zero and %MLG_SUPPRESSUSERSETPRINTAREA attribute flag is not set then the print area will be derived from the current cell selection area. If the shift key is down and total rows are selected (up to a limit of 4) then those rows will be marked as repeat rows. A %MLGN_REPEATROWSSET notification will be sent. If the shift key is down and total cols are selected (up to a limit of 4) then those cols will be marked as repeat cols. A %MLGN_REPEATCOLSSET notification will be sent. If the control key and the shift key are held down during setting Repeat rows or cols then those repeat rows or repeat cols will be zeroed.
wParam :Pointer to the RECT of the Print Area (if -1 then the Print Area will be zeroed, zero for user action)
lParam : Pointer to the RECT of the Repeat Rows and Columns (if -1 then the Repeat Rows and Cols will be zeroed, zero for user action)
Return::None
Comments or Restrictions: For Repeat Rows and Columns RECT the nTop to nBottom members describe the repeat rows. the nLeft to nRight describe the repeat columns. IMPORTANT! - Each sheet has its own PrintAreaRect and RepeatRowColRect so the active sheet is the sheet referenced by this call.
%MLG_GETPRINTAREA
Purpose:
wParam :Pointer to the RECT of the Print Area
lParam :Pointer to the RECT of the Repeat Rows and Columns
Return::None
Comments or Restrictions: See SETPRINTERAREA for RECT members description. IMPORTANT! - Each sheet has its own PrintAreaRect and RepeatRowColRect so the active sheet is the sheet referenced by this call.
%MLG_SETINFOBARTEXT
Purpose:
wParam :LOBYT(LOWRD(wParam)) = Justification (left,center,right)
HIBYT(LOWRD(wParam)) = Font slot 1 to 15 excluding vertical fonts
LOBYT(HIWRD(wParam)) = not used at this time but must be positive
HIBYT(HIWRD(wParam)) = not used at this time but must be positive
lParam : Pointer to ASCIIZ string for infobar
Return::None
Comments or Restrictions: In practice the infobar string will probably be set the Infobar Callback
%MLG_SETPRINTHFTEXT
Purpose: Set optional headers or footers on your print out. A string of zero length will prevent a header or footer from displaying.
wParam :Pointer to ASCIIZ string for header
lParam : Pointer to ASCIIZ string for footer
Return::None
Comments or Restrictions: strings are $TAB delimited for left,center,right substrings. A substring can also be [DATE],[TIME],or [PAGE] to autofill the substring with the date,time or page number. An example of a header string may be
MyHeaderStr = "[PAGE]" + $TAB + "My Report" + $TAB + "[TIME]"
%MLG_INITCOLROWSIZES
Purpose: When defining a new default font it is sometimes desirable to reinitialize row and columns size to comfortably fit the new font.
wParam : if 0 then resize all the columns to standard sizes (100 pixels and 50 pixels for the row header width)
lParam : if 0 then resize all the rows to fit the new default font (adds in the the y switch extra pixels)
Return::None
Comments or Restrictions: This may be called after redefining a default font and you want the default row size to be recalculated.
%MLG_PAGESETUP
Purpose: Calls the standard windows page setup dialog.
wParam : Not used
lParam : Not used
Return::None
Comments or Restrictions: If it is desired to have your margins in millimeters then call
SendMessage hGrid, %MLG_ALTERATTRIBUTE, %MLG_PRINTMILLIMETERS,%MLG_PRINTMARGINSMM
before calling the page setup dialog. The %MLG_SETPAGEOPTIONS and %MLG_SETPRINTMARGINS can be called to manually set these attributes.
http://www.garybeene.com/sw/gbsnippets.htm