Date: 02-16-2022
Return to Index
created by gbSnippets
'Internal Functions:
'MLG_ArrayRedim(BYVAL hGrid AS DWORD, row AS LONG, col AS LONG, rowdim AS LONG, coldim AS LONG)AS LONG
'To change the row and colummns available to the grid plus any dimensioning expansion room.
'MLG_Get(hGrid AS LONG,row AS LONG,col AS LONG,OPT sheetnum AS LONG) AS STRING
'To retrieve the a cell's string content.
'MLG_GetEx (hGrid AS LONG,s() AS STRING)
'To retrieve a group of cell's string contents.
'MLG_Init()
'To register the grid control with Windows on languages that can not static address MLG.DLL.
'MLG_Put(hGrid AS LONG,row AS LONG,col AS LONG, mystr AS STRING,refresh AS LONG ,OPT sheetnum AS LONG)
'To change a cell's string contents.
'MLG_PutEx(hGrid AS LONG,s()AS STRING,op AS LONG, refresh AS LONG)
'To change a group of cell string contents based on how the string array is dimensioned.
'Wrapper Functions:
'MLG_FormatColCheck(hGrid AS DWORD,col AS LONG)
'format a column (col) as a checkbox. This call is meant to only be used once for a column.
'MLG_FormatColCombo(hGrid AS DWORD,col AS LONG,liststr AS STRING,OPT BYVAL op AS LONG)
'format a column (col) as a dropdown combobox. The liststr will be a comma delimited string of the combobox content and op = 1 for a non editable combobox and op=0 is for an editable combox (double click to enable to editable mode. This call is meant to only be used once for a column. The dropdown is limited to 3 choices.
'SUB MLG_FormatColDate(hGrid AS DWORD,col AS LONG,datetype AS LONG,OPT BYVAL justify AS LONG,OPT BYVAL mycolor AS LONG,OPT BYVAL writelock AS LONG)
'Used to format an edit column (col) specifically as a date. The datetype is one of the many built in constants such as %MMDDYYYY. Optionally justification,text color(RGB), or making the grid column non user editable can be set. This call is meant to only be used once for a column. See the include file for proper equates.
'SUB MLG_FormatColNumber(hGrid AS DWORD,col AS LONG,n AS SINGLE,OPT BYVAL justify AS LONG,OPT BYVAL mycolor AS LONG,OPT BYVAL writelock AS LONG)
'Used to format a edit column (col) specifically as a number. The number format (n) is a floating point number with the digit count represented by the portion of the number left of the decimal point and the fractional digit count to the right of the decimal point. It can be set to zero. Optionally justification,text color (RGB), or making the grid column non user editable can be set. This call is meant to only be used once for a column. See the include file for proper equates.
'SUB MLG_FormatColEdit(hGrid AS DWORD,col AS LONG,mylength AS LONG,mycase AS LONG,OPT BYVAL justify AS LONG,OPT BYVAL mycolor AS LONG,OPT BYVAL writelock AS LONG)
'Used to format a edit column (col). The field mylength can be 2 to 255 characters and mycase set to upper or lower case. Optionally justification,text color (RGB), or making the grid column non user editable can be set. This call is meant to only be used once for a column. See the include file for proper equates.
'SUB MLG_FormatColTitles(hGrid AS DWORD,liststr AS STRING)
'This function mirrors the "j" switch. It takes a comma delimited string and inserts them in the column header starting with column 1 to the parameter count of the string.
'SUB MLG_SetRowRecNo(hGrid AS DWORD,row AS LONG,RecNo AS LONG)
'Sets a 32 bit number in the rowextra field of the formatting structure. Mostly used for a record number.
'FUNCTION MLG_GetRowRecNo(hGrid AS DWORD,row AS LONG)AS LONG
'Retrieves a 32 bit number from the rowextra field of the formatting structure. Mostly used as a record number.
'SUB MLG_FormatGridex(hGrid AS DWORD,CellBkColorRGB AS LONG,WindowBkColorRGB AS LONG, CellLineColorRGB AS LONG, hFont AS LONG, hFontBold AS LONG, cyCharEx AS LONG,RCHiLiteRGB AS LONG,UserData AS LONG, BYVAL OPT hFontItalic AS LONG)
'If any of these fields are zero (except for UserData) they are ignored. This subroutine is meant only to be called once since it will destroy object it is replacing. The first time through these would be objects that MLG created so it would not be a problem but could be a problem is the programmer was not careful with their own objects. See the Structure and Equates topic for more info.
'SUB MLG_FormatRowHighLight(hGrid AS DWORD,row AS LONG,OPT BYVAL hilite)
'If the extra formating field is set to -1 (%MLG_HILITE) then the row will be hilighted using the RCHiLiteRGB color. Leaving the hilite parameter off will set the extra formatting field back to zero.
'SUB MLG_FormatColHighLight(hGrid AS DWORD,row AS LONG,OPT BYVAL hilite)
'If the extra formating field is set to -1 (%MLG_HILITE) then the row will be hilighted using the RCHiLiteRGB color. Leaving the hilite parameter off will set the extra formatting field back to zero.
'SUB MLG_SetFormatOverrideRange(hGrid AS DWORD,row1 AS LONG,col1 AS LONG,row2 AS LONG, col2 AS LONG, MyRGB AS LONG,MyFont AS BYTE,MyBorder AS BYTE,MyUsing AS BYTE)
'Retrieves the dimensioned rows and columns of the format override if it exists in the currently selected sheet. The Borders are defined OR'ing the first four bits of the BYTE. This Subroutine will also recognize %MLG_BOX which will draw a border around the range and %MLG_GRID which will grid the entire range with darker lines.
'SUB MLG_CopyRowBlockToClipBoard(hGrid AS DWORD,CopyColHeader AS LONG,OPT BYVAL AllowAllRowsCols AS LONG)
'Copies selected rows to the clipboard to be pasted in another program such as Excel. It the CopyColHeader parameter is non zero, the column header will be the first line. The second optional pararmeter will allow the copying of all rows. The wrapper has a row limit variable which the user may want to alter. Preparing a string to be placed on the clipboard can be time consuming. Pressing the escape key during this process will abort it.
'SUB MLG_HideColBlock(hGrid AS DWORD)
'This subroutine will temporary hide the highlighted columns. The b switch has to set to either 2 or 3 in order for MLG to highlight a column block. This subroutine will not hide the last column if all columns are selected. The columns can be unhid with the %MLG_HIDECOLUMN message (with proper parameters)
'SUB MLG_SetColMaxLen(BYVAL hGrid AS LONG, col AS LONG,OPT BYVAL ConsiderHeader AS LONG )
'This subroutine will resize the column (col) to fit the maximum text size. The optional ConsiderHeader parameter will consider the length of the header in the resize if it is non-zero.
'FUNCTION MLG_GetChecked(mygrid AS LONG, ROW AS LONG, COL AS LONG, OPT BYVAL sheet AS LONG) AS LONG
'This function will return %TRUE (1) if a cell is checked. It is assumed that the cell tested is of check type. A check type cell is checked if its string length is non zero
'SUB MLG_SetChecked(BYVAL mygrid AS LONG, ROW AS LONG, COL AS LONG, VALUE AS LONG, Refresh AS LONG, OPT BYVAL sheet AS LONG)
'This subroutine will put the ascii character 1 in a cell to check it. It is assumed that the cell targeted is of check type. A check type cell is checked if its string length is non zero
'SUB MLG_SetPrintOptions(BYVAL mygrid AS LONG, ShowRowColHeaders AS LONG, PrintPageOrder AS LONG, PrintJustification AS LONG,SuppressGridLines AS LONG)
'This subroutine will
'SUB MLG_SetPrintDlg(mygrid AS LONG, NumCopies AS LONG, AutoClose AS LONG, PageFrom AS LONG,PageTo AS LONG)
'This subroutine will set Print Dialog type attributes
'SUB MLG_SetPageSetupDlg(mygrid AS LONG, MyPaper AS LONG, MyTray AS LONG, MyOrientation AS LONG,MMFlag AS LONG)
'This subroutine will set Page Setup Dialog type attributes
'SUB MLG_SetPrintHeaderFooter(mygrid AS LONG, HeaderText AS STRING, FooterText AS STRING)
'This subroutine will set the data for the Header and Footer of the printed page. 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 and footer strings may be:
'SUB MLG_SetGridFont(BYVAL hGrid AS DWORD, fname AS ASCIIZ * 40, fpoint AS LONG,OPT slot AS WORD,OPT MyStyle AS STRING)
'This subroutine will make a new font for font slots 7 to 15. If the slot is omitted then the default font will be made. The MyStyle string is combination of the characters "b,u,i" to represent bold,underline, and italic. The MyStyle string is only for slots 7 to 15.
'SUB MLG_SetDefaultGridFont(BYVAL hGrid AS DWORD, fname AS ASCIIZ * 40, fpoint AS LONG , OPT BYVAL RecalcNewDefaultRowHeightsAndColWidths AS LONG)
'This subroutine will set the default slots (0,1,2,5,6). It the RecalcNewDefaultRowHeightsAndColWidths parameter is specified as 1 then the row and column sizes will be recalculated to better handle the new font.
'SUB MLG_FormatCellFont(BYVAL hGrid1 AS DWORD,BYVAL row1 AS LONG,BYVAL col1 AS LONG, MyFontSlot AS LONG, OPT row2 AS LONG, col2 AS LONG)
'This subroutine will set the font (slot 0 to 15) of the specified cell or range of cells if row2 and col2 are specified. This is a cell based action and the z switch must have been used to create the grid. If you specify slot 7 or above make sure the font is made for that slot.
'SUB MLG_FormatCellBgndColor(BYVAL hGrid1 AS DWORD,BYVAL row1 AS LONG,BYVAL col1 AS LONG, MyColorSlot AS LONG, OPT row2 AS LONG, col2 AS LONG)
'This subroutine will color the cell background of the specified cell or range of cells if row2 and col2 are specified. This is a cell based action and the z switch must have been used to create the grid. Background slot colors can be modified with other messages.
'SUB MLG_FormatCellTextColor(BYVAL hGrid1 AS DWORD,BYVAL row1 AS LONG,BYVAL col1 AS LONG, MyColorSlot AS LONG, OPT row2 AS LONG, col2 AS LONG)
'This subroutine will color the cell text of the specified cell or range of cells if row2 and col2 are specified. This is a cell based action and the z switch must have been used to create the grid. Text slot colors can be modified with other messages.
'SUB MLG_FormatCellWriteLock(BYVAL hGrid1 DWORD DWORD,BYVAL row1 DWORD LONG,BYVAL col1 AS LONG, MyLock AS LONG, OPT row2 AS LONG, col2 AS LONG)
'This subroutine will write lock the specified cell or range of cells if row2 and col2 are specified. This is a cell based action and the z switch must have been used to create the grid.
'SUB MLG_FormatCellBorder(BYVAL hGrid1 AS DWORD,BYVAL row1 AS LONG,BYVAL col1 AS LONG, MyBorder AS LONG, OPT row2 AS LONG, col2 AS LONG)
'This subroutine will make a border on the specified cell or range of cells if row2 and col2 are specified. The MyBorder parameter is OR'ed with the TOP,LEFT,BOTTOM,RIGHT bits. MLG_OUTLINE is used to frame a range of cells.
http://www.garybeene.com/sw/gbsnippets.htm