Hello Otto,
I included the header-painting inside the delete-button-action
It is just the basics, to give You a idea, much more fine-tuning is possible.
There could be a test, if the database contains no deleted record < recall >,
change back to green and so on.
A solution could be, a index on deleted records.
In this case, using the delete-button for delete or recall, You only need to test the 1. Record :
A function could include something like that :
- Code: Select all Expand view
FUNCTION TEST_DEL()
local lDel := .F.
local nOldOrder := INDEXORD()
local nOldrecord := RECNO()
DBSELECTAREA(1)
Net_RLock( 1, 1 )
IF DELETED()
Net_Recall( 1, 1 )
ELSE
Net_Delete ( 1, 1 )
ENDIF
Net_ULock()
DBSETORDER( 2 ) // index on deleted
DBGOTOP()
IF deleted()
lDel = .T.
ENDIF
DBSETORDER( nOldORDER )
DBGOTO( nOldrecord )
RETURN( lDel )
I think You want the header marked, if the database has any deleded records included ?
- Code: Select all Expand view
....
....
// 1. Column
// -------------
oCol := oLbx1:AddCol()
oCol:AddResource( "Green" )
oCol:bStrData := { || (1)->Last}
oCol:cHeader := "Last"
oCol:cFooter := "Last"
oCol:nHeadBmpNo := 1
// 2. Column ( Indexed )
// --------------------------
oCol := oLbx1:AddCol()
oCol:AddResource( "Green" )
oCol:AddResource( "Red" )
oCol:bStrData := { || (1)->First}
oCol:cHeader := "First"
oCol:cFooter := "First"
oCol:bBmpData := {|| IIF( deleted(), 2, 1 ) }
oCol:nHeadBmpNo := 1
// 3. Column
// ------------
oCol := oLbx1:AddCol()
oCol:AddResource( "Green" )
oCol:bStrData := { || (1)->City}
oCol:cHeader := "City"
oCol:cFooter := "City"
oCol:nHeadBmpNo := 1
....
....
// Use Your delete-function or include < TEST_DEL() >
// REDEFINE BUTTONBMP oBtn7 ID 70 OF oDlg ;
// ACTION ( IIF( TEST_DEL() = .T., ;
// ( oLbx1:SwapCols( 1, 2 ), ; // Bring selected col 2 ( indexed ) to 1
// oLbx1:GoLeftMost(), ; // Go to 1. Col ( indexed )
// oLbx1:aCols[1]:nHeadBmpNo := 2 ), ; // Red BMP from Col-resource
// oLbx1:aCols[1]:nHeadBmpNo := 1 ), ; // Green BMP from Col-resource
// oLbx1:Refresh() ) ;
// BITMAP "Delete" PROMPT " &Delete" TEXTRIGHT
// oBtn7:cToolTip = { "Delete" + CRLF + ;
// "a Record","Record-Delete", 1, CLR_BLACK, 14089979 }
// If TEST_DEL() = .F., reset the swapt columns to the original positon with a Green BMP.
REDEFINE BUTTONBMP oBtn7 ID 70 OF oDlg ;
ACTION ( DB_SET(), ; // Delete and Recall-function
oLbx1:SwapCols( 1, 2 ), ; // Bring selected col 2 ( indexed ) to 1
oLbx1:GoLeftMost(), ; // Go to 1. Col ( indexed )
oLbx1:aCols[1]:nHeadBmpNo := 2, ; // Red BMP from Col-resource
oLbx1:Refresh() ) ;
BITMAP "Delete" PROMPT " &Delete" TEXTRIGHT
oBtn7:cToolTip = { "Delete" + CRLF + ;
"a Record","Record-Delete", 1, CLR_BLACK, 14089979 }
The basic-view
After deleting
Regards
Uwe