Notifications Reference

Top  Previous  Next

MLG sends many notifications back to the parent callback.  The programmer can intercept these messages and take actions upon their receipt.  Here is their explaination in the form of a callback snippet. It is written in Powerbasic but their meaning ought to be apparent for other languages.  MLG uses a user defined notification message of %MLG_NOTIFY which should be put in the parent's callback.  Note the notifications new to Version 1.08 at the bottom of this pane.

 

CASE %WM_SIZE

'code here

CASE %WM_PAINT

    'code here

CASE %WM_NOTIFY

          MLGN=lParam        

          IF @MLGN.NMHeader.idFrom = %IDC_MLGGRID THEN' Notification messages

             SELECT CASE @MLGN.NMHeader.code  '

                   CASE %MLGN_RETURN

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

The enter key has been pressed.  The grid will dismiss the edit box if it had focus and will move the cell selection box according to the "e" switch.

 

                   CASE %MLGN_DELETE

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

The delete key has been pressed.

 

                  CASE %MLGN_PASTE

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

Data has been pasted into the edit box. Check for formatting of a date, number, case, or length if desired.

 

                   CASE %MLGN_TAB

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

The tab key has been pressed.  The grid will dismiss the edit box if it had focus and will move the cell selection box according to the "t" switch.

 

                   CASE %MLGN_CHARPRESSED

hEdit=@MLGN.Param4   'edit box handle

mychar=@MLGN.Param3  'character

mycol=@MLGN.Param2   'current column

myrow=@MLGN.Param1   'current row

The character key has been pressed. This may be handy for validation.  NOTE: a problem may occur if too much time is taken to process this notification because the edit box could get out of sync.  With the handle to the edit box and the Windows API call of GetWindowText and the message EM_GETSEL, then mychar can be inserted into the edit string and evaluated.  Return non zero if you do not want the character entered in the cell.  ie FUNCTION=1.

 

                   CASE %MLGN_ESCAPEPRESSED

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

The escape key has been pressed.

 

                   CASE %MLGN_ROWDIRTY

myrow=@MLGN.Param1        'previous row

mycol=@MLGN.Param2        'previous col

The cell selection has changed rows and something on the row has changed since the cell selction entered the row.  The record needs to be updated in the database.  A handy place to keep the record number (a LONG INTEGER) is with the record by using the %SETROWEXTRA message.  This record number can be retrieved with the %GETROWEXTRA message.  If the "i" switch is set, the row header should be darken showing that the row is dirty and is in need of updating.

 

                   CASE %MLGN_CELLDIRTY

myrow=@MLGN.Param1 'previous row

mycol=@MLGN.Param2 'previous col

The cell selection has changed cells and something in the cell has changed since the cell selction was made.  This may be a good time for validation checks. If the "i" switch is set, the row header should be darken showing that the row is dirty and is in need of updating.

 

                   CASE %MLGN_ROWALTERED

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

The row has just become dirty and may be in need of updating at some point.  If the "i" switch is set, the row header should be darken showing that the row is dirty and is in need of updating.

 

                   CASE %MLGN_CELLALTERED

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

The cell has just become dirty and may be in need of updating at some point and a validation.  If the "i" switch is set, the row header should be darken showing that the row is dirty and is in need of updating.

 

                   CASE %MLGN_DATEPROBLEM

myrow=@MLGN.Param1 'previous row where the problem occured

mycol=@MLGN.Param2 'previous col where the problem occured

If a cell formatted as a date, a mistyping occurred and MLG made an alteration to the cell data.  A manual validation of the cell data may be in order. This notification is only sent if a date was materially changed like 40 was entered for the day and MLG changed it to 31.  If 4 was entered for the day and MLG reformatted it to 04 then no notification will be sent.

 

                  CASE %MLGN_CHECKCHANGED

mychar=@MLGN.Param3  'before toggle - if contains "0" then unselected else is selected

mycol=@MLGN.Param2   'column of check change

myrow=@MLGN.Param1                 'row of check change

If a cell formatted as a checkbox, the check has been toggled.  If the checkbox is in the unchecked state, the cell will hold a "0".  If the cell is in a checked state it will hold anything else.

 

                  CASE %MLGN_COMBOCHANGED

myrow=@MLGN.Param1 'current row

mycol=@MLGN.Param2 'current col

If a cell formatted as a combobox, the listbox had been dropped down or dismissed.

 

                   CASE %MLGN_COLWIDTHCHANGED

mycol=@MLGN.Param2 ' column of mouse

I=@MLGN.Param1      ' new width

If the user manually changes a column width with the mouse.

 

                   CASE %MLGN_SELCHANGE

myrow=@MLGN.Param1 'previous row

mycol=@MLGN.Param2 'previous col

visrows=@MLGN.Param3 'visible rows (includes partial rows)

viscols=@MLGN.Param4 'visible cols (includes partial columns)

The cell selection has changed. With LeftCol and Top Row and MLG_GETSELECTED you can determine if the selected cell is visible

 

                   CASE %MLGN_ROWCHANGE

myrow=@MLGN.Param1 'current row

oldrow=@MLGN.Param2'previous row

The row selection has changed.  May need to load a record into the application

 

                   CASE %MLGN_ROWSELCHANGE 

mystart=@MLGN.Param1 'start row

myend=@MLGN.Param2   'end row

If the block selection has been enabled with the "b" switch, the user has changed a row selection.

 

                   CASE %MLGN_COLSELCHANGE

mystart=@MLGN.Param1 'start col

myend=@MLGN.Param2   'end col

If the block selection has been enabled with the "b" switch, the user has changed a col selection.

 

                   CASE %MLGN_ROWCOLALLBLOCKSEL

mytotalrows=@MLGN.Param1 'total rows

mytotalcols=@MLGN.Param2 'total cols

If the block selection has been enabled with the "b" switch, the user has selected the whole grid.

 

                   CASE %MLGN_REDIMFAILED

I=@MLGN.Param1 'What calling function or messages when the problem occurred                               

J=@MLGN.Param2 'What part of the REDIMARRAY function failed (see err codes)

MLG has tried to get more memory for the grid but failed. If I>2 then the action failed while in an INSERTCOLAFTER, INCOLBEFORE, INSERTROWAFTER, or INSERTROWBEFORE messages. I will contain the message constants. If I=1 then the action failed while in a PutEX function.  If I=2 the action failed while rrying to append a row . J can be 1 to 13.  Check the error codes section of the MLGPB.Inc fial to see what part of the redimarray function failed.

 

                   CASE %MLGN_WANTNEWREC

mytotalrows=@MLGN.Param1

If the auto row append mode has been enabled with the "e3" switch, MLG is asking if it is OK to append a row to the bottom of the grid.  The user can prevent the append by sending a %MLG_SETSKIPRECFLAG message if a validation fails.

 

                   CASE %MLGN_MADENEWREC

mytotalrows=@MLGN.Param1

If the auto row append mode has been enabled with the "e3" switch, MLG has just appended a row to the bottom of the grid.

 

                   CASE %MLGN_RIGHTCLICK

myrow=@MLGN.Param1 'Current row

mycol=@MLGN.Param2 'Current col

skey=@MLGN.Parma3        'Is the shift key pressed.  Zero is NO

A cell has been right clicked.  If any changes are needed to the right click menu (such as greying a selection), then do it now.

 

                   CASE %MLGN_RCLICKMENU

myitem=@MLGN.Param3  ' menu item

mycol=@MLGN.Param2   ' column of mouse

myrow=@MLGN.Param1   ' row of mouse

skey=@MLGN.Param4                'is the shiftkey pressed? Zero is NO

If the right click menu has been enabled with the "m1" switch, the user has made a menu item selection.

 

'NOTIFICATIONS BELOW THIS LINE ARE NEW TO VERSION 1.08

 

                   CASE %MLGN_SHEETRCLICK

mytab=@MLGN.Param1 'Which tab was clicked

A sheet tab has been right clicked.  If any changes are needed to the right click menu (such as greying a selection), then do it now.

 

                   CASE %MLGN_RCLICKTABMENU

mytab=@MLGN.Param2   ' which tab was clicked

myitem=@MLGN.Param1  ' which menu item

If the sheet tab right click menu has been enabled with the "m2" switch, the user has made a menu item selection.

 

                   CASE %MLGN_SHEETSELECT

myoldsheet=@MLGN.Param2   'which tab is being deselected

mynewsheet=@MLGN.Param1   'which tab is being selected

myoldrow=@MLGN.Param3

myoldcol=@MLGN.Param4

A sheet tab has been selected. This is sent after the sheet has changed.

 

                   CASE %MLGN_SHEETSELECTCHANGING  (new in version 1.14)

myoldsheet=@MLGN.Param2   'which tab is being deselected

mynewsheet=@MLGN.Param1   'which tab is being selected

myoldrow=@MLGN.Param3

myoldcol=@MLGN.Param4

A sheet tab has been selected. This is sent before the sheet has changed.

 

                   CASE %MLGN_SHEETNAMECHANGE

mytab=@MLGN.Param1  ' which menu item

The sheet tab mytab was just renamed.

 

                   CASE %MLGN_SHEETPOSCHANGE

myarrayslot1=@MLGN.Param2   ' which tab was clicked

myarrayslot2=@MLGN.Param1  ' which menu item

Swap tab sheet array slot numbers.  One of the sheets may be the actively selected workbook sheet.

 

                   CASE %MLGN_SHEETCOLORCHANGE

mynewcolor=@MLGN.Param2   ' the color

mytab=@MLGN.Param1       ' which tab is being recolored

A tab has just been assigned a new RGB color

 

                   CASE %MLGN_SHEETADDED

mynewsheet=@MLGN.Param1  ' which tab is being selected

A new sheet has just been added and mynewsheet is the sheet array slot number assigned..

 

                   CASE %MLGN_SHEETDELETED

mytab=@MLGN.Param1  ' the is being deleteed

This is the sheet number that just got deleted.  The array slot is marked as deleted.  The actively selected workbook sheet MAY NOT be deleted.

 

                        CASE %MLGN_COLSIZEDOUBLECLICK

mycol=@MLGN.Param1  ' the is columns resize bare being cclicked

skey=@MLGN.Param2                ' the is shift key is down

ckey=@MLGN.Param3                ' the is control key is down

This cursor is an EW cursor shape in the column header and is double clicked.  Excel uses this action to fit the column to the data size.  The programmer may want to use the wrapper MLG_SetColMaxLen to resize the column to fit. If the shift key is down then 1 is returned in Param2 and likewise the control key state is in Param3

 

                        CASE %MLGN_THEMECHANGED

wParam=@MLGN.Param1 

lParam=@MLGN.Param2        

Theme has change.  This notification  is simply passing on the WM_THEMECHANGED message received by the application.  Reset header and background colors if desired.

 

'NOTIFICATIONS BELOW THIS LINE ARE NEW TO VERSION 1.12

 

CASE %MLGN_COLDOUBLECLICK

mycol=@MLGN.Param1  ' the is column double clicked

skey=@MLGN.Param2                ' the is shift key is down

ckey=@MLGN.Param3                ' the is control key is down

A column is double clicked while the EW cursor is not showing. If the shift key is down then 1 is returned in Param2 and likewise the control key state is in Param3

 

CASE %MLGN_ROWDOUBLECLICK

mycol=@MLGN.Param1  ' the is row double clicked

skey=@MLGN.Param2                ' the is shift key is down

ckey=@MLGN.Param3                ' the is control key is down

A row has been double clicked. If the shift key is down then 1 is returned in Param2 and likewise the control key state is in Param3

 

'NOTIFICATIONS BELOW THIS LINE ARE NEW TO VERSION 1.13

 

CASE %MLGN_SETFOCUS

mycntl=@MLGN.Param1  ' The handle of the control losing focus

Note: in a grid this could be the grid handle or a control within the grid which the grid handle could be verified by using the Windows API function GetParent.  The WM_SETFOCUS message of the grid control has been received and this notification is simply telling the user about it.  This may or may not be of value.

 

CASE %MLGN_KILLFOCUS

mycntl=@MLGN.Param1  ' handle of the control receiving focus

Note: in a grid this could be the grid handle or a control within the grid which the grid handle could be verified by using the Windows API function GetParent.    The WM_KILLFOCUS message of the grid control has been received and this notification is simply telling the user about it.  This may or may not be of value.

 

'NOTIFICATIONS BELOW THIS LINE ARE NEW TO VERSION 1.14

 

CASE %MLGN_ROWINSERT

mycntl=@MLGN.Param1  ' Msg %MLG_INSERTAFTER or %MLGINSERTBEFORE

rowsToAdd = @MLGN.Param2

pivotrow = @MLGN.Param3

 

Note: none.

 

CASE %MLGN_COLINSERT

mycntl=@MLGN.Param1  ' Msg %MLG_INSERTAFTER or %MLGINSERTBEFORE

rowsToAdd = @MLGN.Param2

pivotrow = @MLGN.Param3

 

Note: none.

 

CASE %MLGN_ROWDELETE

mycntl=@MLGN.Param1  ' Message

startrow = @MLGN.Param2

rowsdeleted = @MLGN.Param3

 

Note: none.

 

CASE %MLGN_COLDELETE

mycntl=@MLGN.Param1  ' Message

startcol = @MLGN.Param2

colsdeleted = @MLGN.Param3

 

Note: none.

 

                   CASE %MLGN_SHEETSELECTCHANGING

myoldsheet=@MLGN.Param2   'which tab is being deselected

mynewsheet=@MLGN.Param1   'which tab is being selected

myoldrow=@MLGN.Param3

myoldcol=@MLGN.Param4

A sheet tab has been selected. This is sent before the sheet has changed.

 

'NOTIFICATIONS BELOW THIS LINE ARE NEW TO VERSION 2.00

 

                        CASE %MLGN_ROWHEIGHTCHANGED

rowbeingresized=@MLGN.Param2

newrowheight=@MLGN.Param1

 

                        CASE %MLGN_MULTICELLCHANGE

myselectedcol=@MLGN.Param2  

myselectedrow=@MLGN.Param1  

myselectedrow2=@MLGN.Param3

myselectedcol2=@MLGN.Param4

 

                        CASE %MLGN_USERBUTTON

myselectedcol=@MLGN.Param2  

myselectedrow=@MLGN.Param1  

                               

                               Note: This is your chance to bring up a dialog box etc.

 

                        CASE %MLGN_COMBOBUTTON

myselectedcol=@MLGN.Param2  

myselectedrow=@MLGN.Param1 

 

                        CASE %MLGN_SPLITTERCHANGE

whichsplitter=@MLGN.Param1 '1 is vertical 2 is horizontal

splitterposition=@MLGN.Param3 

 

                        CASE %MLGN_SELECTEDCELLLOCKED

mypreviousrow=@MLGN.Param1

mypreviouscol=@MLGN.Param2 

myselectedrow=@MLGN.Param3

myselectedcol=@MLGN.Param4

 

'NOTIFICATIONS BELOW THIS LINE ARE NEW TO VERSION 3.00

 

                        CASE %MLGN_PRINTAREASET

myselectedtoprow=@MLGN.Param1

myselectedlftcol=@MLGN.Param2 

myselectedbtmrow=@MLGN.Param3

myselectedrgtcol=@MLGN.Param4 

 

                        CASE %MLGN_REPEATROWSSET

myselectedtoprow=@MLGN.Param1

myselectedlftcol=@MLGN.Param2 

myselectedbtmrow=@MLGN.Param3

myselectedrgtcol=@MLGN.Param4

 

                        CASE %MLGN_REPEATCOLUMNSSET

myselectedtoprow=@MLGN.Param1

myselectedlftcol=@MLGN.Param2 

myselectedbtmrow=@MLGN.Param3

myselectedrgtcol=@MLGN.Param4

 

                        CASE %MLGN_RCLICKINFOBARMENU

myitem=@MLGN.Param3  ' Menu Item

mycol=@MLGN.Param2   ' Column of Mouse

myrow=@MLGN.Param1   ' Row of Mouse

         END SELECT

       END IF

END SELECT

 

END FUNCTION