.Reference: Notifications

Category: Controls - MLG

Date: 02-16-2022

Return to Index


 
 %MLGN_RETURN
 %MLGN_DELETE
 %MLGN_PASTE
 %MLGN_TAB
 %MLGN_CHARPRESSED
 %MLGN_ESCAPEPRESSED
 %MLGN_ROWDIRTY
 %MLGN_CELLDIRTY
 %MLGN_ROWALTERED
 %MLGN_CELLALTERED
 %MLGN_DATEPROBLEM
 %MLGN_CHECKCHANGED
 %MLGN_COMBOCHANGED
 %MLGN_COLWIDTHCHANGED
 %MLGN_SELCHANGE
 %MLGN_ROWCHANGE
 %MLGN_ROWSELCHANGE
 %MLGN_COLSELCHANGE
 %MLGN_ROWCOLALLBLOCKSEL
 %MLGN_REDIMFAILED
 %MLGN_WANTNEWREC
 %MLGN_MADENEWREC
 %MLGN_RIGHTCLICK
 %MLGN_RCLICKMENU
 %MLGN_SHEETRCLICK
 %MLGN_RCLICKTABMENU
 %MLGN_SHEETSELECT
 %MLGN_SHEETSELECTCHANGING  (new in version 1.14)
 %MLGN_SHEETNAMECHANGE
 %MLGN_SHEETPOSCHANGE
 %MLGN_SHEETCOLORCHANGE
 %MLGN_SHEETADDED
 %MLGN_SHEETDELETED
 %MLGN_COLSIZEDOUBLECLICK
 %MLGN_THEMECHANGED
 %MLGN_COLDOUBLECLICK
 %MLGN_ROWDOUBLECLICK
 %MLGN_SETFOCUS
 %MLGN_KILLFOCUS
 %MLGN_ROWINSERT
 %MLGN_COLINSERT
 %MLGN_ROWDELETE
 %MLGN_COLDELETE
 %MLGN_SHEETSELECTCHANGING
 %MLGN_ROWHEIGHTCHANGED
 %MLGN_MULTICELLCHANGE
 %MLGN_USERBUTTON
 %MLGN_COMBOBUTTON
 %MLGN_SPLITTERCHANGE
 %MLGN_SELECTEDCELLLOCKED
 %MLGN_PRINTAREASET
 %MLGN_REPEATROWSSET
 %MLGN_REPEATCOLUMNSSET
 %MLGN_RCLICKINFOBARMENU
 
'Compilable Example:  (Jose Includes)
#Compile Exe
#Dim All
#Include "Win32API.inc"
#Include "mlg.inc"
 
Enum Equates Singular
   IDC_Grid = 500
End Enum
 
Global hDlg, hGrid As Dword
 
Function PBMain() As Long
   Dialog New Pixels, 0, "MLG Example",300,300,600,350, %WS_OverlappedWindow To hDlg
 
   MLG_Init
   Control Add "MyLittleGrid", hDlg, %IDC_Grid, "r10/c4", 10,10,580,330, %MLG_STYLE
   Control Handle hDlg, %IDC_Grid To hGrid
 
   Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
   Local w,h As Long
   Select Case Cb.Msg
      Case %WM_InitDialog
      Case %WM_Command
      Case %WM_Size
         Dialog Get Client hDlg To w,h
         Control Set Size hDlg, %IDC_Grid, w-20, h-20
         Control ReDraw hDlg, %IDC_Grid
      Case %WM_NOTIFY
         Select Case CB.NmID
            Case %IDC_Grid
               Mlgn = CB.lParam
               Select Case CB.Nmcode      
                  Case %MLGN_RETURN
                     [email protected] 'current row
                     [email protected] '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
                     [email protected] 'current row
                     [email protected] 'current col
                     'The delete key has been pressed.
                  Case %MLGN_PASTE
                     [email protected] 'current row
                     [email protected] '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
                     [email protected] 'current row
                     [email protected] '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
                     [email protected]   'edit box handle
                     [email protected]  'character
                     [email protected]   'current column
                     [email protected]   '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
                     [email protected] 'current row
                     [email protected] 'current col
                     'The escape key has been pressed.
                  Case %MLGN_ROWDIRTY
                     [email protected]        'previous row
                     [email protected]        '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
                     [email protected] 'previous row
                     [email protected] '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
                     [email protected] 'current row
                     [email protected] '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
                     [email protected] 'current row
                     [email protected] 'current col
                     'The cell has just become dirty and may be in need of updating at some point and 
                     '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
                     [email protected] 'previous row where the problem occured
                     [email protected] '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
                     [email protected]  'before toggle - if contains "0" then unselected else is selected
                     [email protected]   'column of check change
                     [email protected]   '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
                     [email protected] 'current row
                     [email protected] 'current col
                     'If a cell formatted as a combobox, the listbox had been dropped down or dismissed.
                  Case %MLGN_COLWIDTHCHANGED
                     [email protected] ' column of mouse
                     [email protected]      ' new width
                     'If the user manually changes a column width with the mouse.
                  Case %MLGN_SELCHANGE
                     [email protected] 'previous row
                     [email protected] 'previous col
                     [email protected] 'visible rows (includes partial rows)
                     [email protected] '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
                     [email protected] 'current row
                     oldrow=@MLGN.'previous row
                     'The row selection has changed.  May need to load a record into the application
                  Case %MLGN_ROWSELCHANGE
                     [email protected] 'start row
                     [email protected]   'end row
                     'If the block selection has been enabled with the "b" switch, the user has changed a row selection.
                  Case %MLGN_COLSELCHANGE
                     [email protected] 'start col
                     [email protected]   'end col
                     'If the block selection has been enabled with the "b" switch, the user has changed a col selection.
                  Case %MLGN_ROWCOLALLBLOCKSEL
                     [email protected] 'total rows
                     [email protected] 'total cols
                     'If the block selection has been enabled with the "b" switch, the user has selected the whole grid.
                  Case %MLGN_REDIMFAILED
                     [email protected] 'What calling function or messages when the problem occurred
                     [email protected] '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
                     [email protected]
                     '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
                     [email protected]
                     '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
                     [email protected] 'Current row
                     [email protected] 'Current col
                     [email protected]        '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
                     [email protected]  ' menu item
                     [email protected]   ' column of mouse
                     [email protected]   ' row of mouse
                     [email protected]                '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.
                  Case %MLGN_SHEETRCLICK
                     [email protected] '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
                     [email protected]   ' which tab was clicked
                     [email protected]  ' 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
                     [email protected]   'which tab is being deselected
                     [email protected]   'which tab is being selected
                     [email protected]
                     [email protected]
                     'A sheet tab has been selected. This is sent after the sheet has changed.
                  Case %MLGN_SHEETSELECTCHANGING  (new in version 1.14)
                     [email protected]   'which tab is being deselected
                     [email protected]   'which tab is being selected
                     [email protected]
                     [email protected]
                     'A sheet tab has been selected. This is sent before the sheet has changed.
                  Case %MLGN_SHEETNAMECHANGE
                     [email protected]  ' which menu item
                     'The sheet tab mytab was just renamed.
                  Case %MLGN_SHEETPOSCHANGE
                     [email protected]   ' which tab was clicked
                     [email protected]  ' which menu item
                     'Swap tab sheet array slot numbers.  One of the sheets may be the actively selected workbook sheet.
                  Case %MLGN_SHEETCOLORCHANGE
                     [email protected]   ' the color
                     [email protected]       ' which tab is being recolored
                     'A tab has just been assigned a new RGB color
                  Case %MLGN_SHEETADDED
                     [email protected]  ' which tab is being selected
                     'A new sheet has just been added and mynewsheet is the sheet array slot number assigned..
                  Case %MLGN_SHEETDELETED
                     [email protected]  ' 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
                     [email protected]  ' the is columns resize bare being cclicked
                     [email protected]                ' the is shift key is down
                     [email protected]                ' 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
                     [email protected]
                     [email protected]
                     'Theme has change.  This notification  is simply passing on the WM_THEMECHANGED message 
                     'received by the application.  Reset header and background colors if desired.
                  Case %MLGN_COLDOUBLECLICK
                     [email protected]  ' the is column double clicked
                     [email protected]                ' the is shift key is down
                     [email protected]                ' 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
                     [email protected]  ' the is row double clicked
                     [email protected]                ' the is shift key is down
                     [email protected]                ' 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
                  Case %MLGN_SETFOCUS
                     [email protected]  ' 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
                     [email protected]  ' 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.
                  Case %MLGN_ROWINSERT
                     [email protected]  ' Msg %MLG_INSERTAFTER or %MLGINSERTBEFORE
                     rowsToAdd = @MLGN.Param2
                     pivotrow = @MLGN.Param3
                  Case %MLGN_COLINSERT
                     [email protected]  ' Msg %MLG_INSERTAFTER or %MLGINSERTBEFORE
                     rowsToAdd = @MLGN.Param2
                     pivotrow = @MLGN.Param3
                  Case %MLGN_ROWDELETE
                     [email protected]  ' Message
                     startrow = @MLGN.Param2
                     rowsdeleted = @MLGN.Param3
                  Case %MLGN_COLDELETE
                     [email protected]  ' Message
                     startcol = @MLGN.Param2
                     colsdeleted = @MLGN.Param3
                  Case %MLGN_SHEETSELECTCHANGING
                     [email protected]   'which tab is being deselected
                     [email protected]   'which tab is being selected
                     [email protected]
                     [email protected]
                     'A sheet tab has been selected. This is sent before the sheet has changed.
                  Case %MLGN_ROWHEIGHTCHANGED
                     [email protected]
                     [email protected]
                  Case %MLGN_MULTICELLCHANGE
                     [email protected]
                     [email protected]
                     [email protected]
                     [email protected]
                  Case %MLGN_USERBUTTON
                     [email protected]
                     [email protected]
                     'Note: This is your chance to bring up a dialog box etc.
                  Case %MLGN_COMBOBUTTON
                     [email protected]
                     [email protected]
                  Case %MLGN_SPLITTERCHANGE
                     [email protected] '1 is vertical 2 is horizontal
                     [email protected]
                  Case %MLGN_SELECTEDCELLLOCKED
                     [email protected]
                     [email protected]
                     [email protected]
                     [email protected]
                     'NOTIFICATIONS BELOW THIS LINE ARE NEW TO VERSION 3.00
                  Case %MLGN_PRINTAREASET
                     [email protected]
                     [email protected]
                     [email protected]
                     [email protected]
                  Case %MLGN_REPEATROWSSET
                     [email protected]
                     [email protected]
                     [email protected]
                     [email protected]
                  Case %MLGN_REPEATCOLUMNSSET
                     [email protected]
                     [email protected]
                     [email protected]
                     [email protected]
                  Case %MLGN_RCLICKINFOBARMENU
                     [email protected]  ' Menu Item
                     [email protected]   ' Column of Mouse
                     [email protected]   ' Row of Mouse
               End Select
         End Select
   End Select
End Function
   


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm