Date: 02-16-2022
Return to Index
created by gbSnippets
Sub GridDeleteRow
Local i,iRow,iCol As Long
i = SendMessage(hGrid, %MLG_GetRowColTot, 0, 0)
If Lo(Word,i) = 1 Then
MsgBoxX "Cannot delete last row!", %MB_Ok + %MB_IconExclamation + %MB_TaskModal, "Delete Row"
Exit Sub
End If
i = SendMessage(hGrid, %MLG_GetSelected, 0, 0)
iCol = Hi(Word,i) : iRow = Lo(Word,i)
GridCopyRow
SendMessage hGrid, %MLG_DeleteRows, iRow, iRow
SendMessage hGrid, %MLG_Refresh, 0, 0
GridIsDirty = 1
End Sub
Sub GridCopyRow
Local i,iRow,iCol As Long, temp$
i = SendMessage(hGrid, %MLG_GetSelected, 0, 0)
iCol = Hi(Word,i) : iRow = Lo(Word,i)
For iCol = 1 To UBound(ManualOrders,1)
temp$ += ":::" + MLG_Get(hGrid,iRow,iCol)
Next i
temp$ = Trim$(temp$,":::")
Clipboard Reset
Clipboard Set Text temp$
End Sub
Sub GridPasteRow
Local i,iRow,iCol As Long, temp$
i = SendMessage(hGrid, %MLG_GetSelected, 0, 0)
iCol = Hi(Word,i) : iRow = Lo(Word,i)
Clipboard Get Text To temp$
For i = 1 To UBound(ManualOrders,1)
MLG_Put hGrid, iRow, i, Parse$(temp$,":::",i), 1,0
Next i
End Sub
Sub GridInsertRow
Local i,iRow,iCol As Long
i = SendMessage(hGrid, %MLG_GetSelected, 0, 0)
iCol = Hi(Word,i) : iRow = Lo(Word,i)
SendMessage hGrid, %MLG_InsertRowBefore, 1, iRow
SendMessage hGrid, %MLG_Refresh, 0, 0
GridIsDirty = 1
End Sub
http://www.garybeene.com/sw/gbsnippets.htm