I wish move the element from a cell to another
I move an item ( 4A) with the mouse on position 11, the procedure moves the item and save the new position in save_dragbegin function (), then I take the same element (4A) or another and try to move to position 24 and the procedure makes this error ...
- Code: Select all Expand view
Application
===========
Path and name: C:\Work\Errori\pezzi\ORADOC.Exe (32 bits)
Size: 2,622,976 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
FiveWin Version: FWHX 15.01
Windows version: 5.1, Build 2600 Service Pack 3
Time from start: 0 hours 0 mins 17 secs
Error occurred at: 03/04/15, 11:10:09
Error description: Error DBFNTX/1020 Data type error
Stack Calls
===========
Called from: => DBGOTO( 0 )
Called from: New.prg => SAVE_DRAGBEGIN( 223 )
Called from: New.prg => (b)MOSTRA_ORARIO_DOCENTE( 195 )
Called from: .\source\classes\CONTROL.PRG => TXBROWSE:DRAGBEGIN( 1302 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:MOUSEMOVE( 742 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:MOUSEMOVE( 3803 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1733 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 12607 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
I made
I have the array type aDatiDisp[10,6,4,9]
I save on this array
10= hours from 1 to 10
6= number of days from monday to saturday
4= type of show
9= number of fields of Orario.dbf
if (!Empty(orario->gg_ora))
Do while ! orario->(eof())
n_giorno:=Val(Left(orario->gg_ora, 1))
n_ora=iif(Val(right(orario->gg_ora, 1)) == 0, 10, Val(right(orario->gg_ora, 1)))
aDatiDisp[n_ora][n_giorno][1][1]:= ORARIO->prof
aDatiDisp[n_ora][n_giorno][1][2]:= ORARIO->classe
aDatiDisp[n_ora][n_giorno][1][3]:= ORARIO->aula
aDatiDisp[n_ora][n_giorno][1][4]:= ORARIO->materia
aDatiDisp[n_ora][n_giorno][1][5]:= ORARIO->flag
aDatiDisp[n_ora][n_giorno][1][6]:= ORARIO->gruppo
aDatiDisp[n_ora][n_giorno][1][7]:= ORARIO->oreseq
aDatiDisp[n_ora][n_giorno][1][8]:= ORARIO->gg_ora
aDatiDisp[n_ora][n_giorno][1][9]:= ORARIO->(RecNo())
orario->(dbskip())
enddo
ENDIF
aData := { {aOrario[1], aDatiDisp[1][1][1][2], aDatiDisp[1][2][1][2], aDatiDisp[1][3][1][2], aDatiDisp[1][4][1][2], aDatiDisp[1][5][1][2], aDatiDisp[1][6][1][2]},;
{aOrario[2], aDatiDisp[2][1][1][2], aDatiDisp[2][2][1][2], aDatiDisp[2][3][1][2], aDatiDisp[2][4][1][2], aDatiDisp[2][5][1][2], aDatiDisp[2][6][1][2]},;
{aOrario[3], aDatiDisp[3][1][1][2], aDatiDisp[3][2][1][2], aDatiDisp[3][3][1][2], aDatiDisp[3][4][1][2], aDatiDisp[3][5][1][2], aDatiDisp[3][6][1][2]},;
{aOrario[4], aDatiDisp[4][1][1][2], aDatiDisp[4][2][1][2], aDatiDisp[4][3][1][2], aDatiDisp[4][4][1][2], aDatiDisp[4][5][1][2], aDatiDisp[4][6][1][2]},;
{aOrario[5], aDatiDisp[5][1][1][2], aDatiDisp[5][2][1][2], aDatiDisp[5][3][1][2], aDatiDisp[5][4][1][2], aDatiDisp[5][5][1][2], aDatiDisp[5][6][1][2]},;
{aOrario[6], aDatiDisp[6][1][1][2], aDatiDisp[6][2][1][2], aDatiDisp[6][3][1][2], aDatiDisp[6][4][1][2], aDatiDisp[6][5][1][2], aDatiDisp[6][6][1][2]},;
{aOrario[7], aDatiDisp[7][1][1][2], aDatiDisp[7][2][1][2], aDatiDisp[7][3][1][2], aDatiDisp[7][4][1][2], aDatiDisp[7][5][1][2], aDatiDisp[7][6][1][2]},;
{aOrario[8], aDatiDisp[8][1][1][2], aDatiDisp[8][2][1][2], aDatiDisp[8][3][1][2], aDatiDisp[8][4][1][2], aDatiDisp[8][5][1][2], aDatiDisp[8][6][1][2]},;
{aOrario[9], aDatiDisp[9][1][1][2], aDatiDisp[9][2][1][2], aDatiDisp[9][3][1][2], aDatiDisp[9][4][1][2], aDatiDisp[9][5][1][2], aDatiDisp[9][6][1][2]},;
{aOrario[10], aDatiDisp[10][1][1][2],aDatiDisp[10][2][1][2],aDatiDisp[10][3][1][2],aDatiDisp[10][4][1][2],aDatiDisp[10][5][1][2],aDatiDisp[10][6][1][2]};
}
WITH OBJECT oBrw
:nRowHeight := 33
:nheaderHeight := 40
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nMarqueeStyle :=MARQSTYLE_HIGHLWIN7
:lHScroll := .f.
:lVScroll := .f.
DragCursor := oDragCur
:bDragBegin := { |r,c,f,o| save_dragbegin(oBrw,aDatiDisp,aData,@nRecord),;
SetDropInfo( o:SelectedCol():Value ,;
o:SelectedCol():Value:= "") }
:bDropOver := { |u,r,c,f| oBrw:SetPos( r, c, .t. ), save_dropover(nRecord,oBrw,aDatiDisp),;
oBrw:SelectedCol():VarPut( u ) }
:CreateFromCode()
END
//---------------------------------------------------------------------------------------//
Function save_dragbegin(oBrw,aDatiDisp,aData,nRecord)
Local n_giorno := oBrw:nColSel-1
Local n_Ora:= oBrw:nRowSel
Local nGG_ORA:= ltrim(str(n_giorno,1)+str(n_Ora,1))
nRecord := aDatiDisp[n_ora][n_giorno][1][9]
SELECT ORARIO
ORARIO->(dbgoto(nrecord))
replace ORARIO->note with "da"+nGG_Ora
orario->(dbcommit())
return nRecord
//---------------------------------------------------------------------------------------//
Function save_dropover(nRecord,oBrw,aDatiDisp)
Local n_giorno := oBrw:nColSel-1
Local n_Ora:= oBrw:nRowSel
Local nGG_ORA:= ltrim(str(n_giorno,1)+str(n_Ora,1))
SELECT ORARIO
ORARIO->(dbgoto(nrecord))
ctesto:= alltrim(ORARIO->note)
replace ORARIO->gg_ora with nGG_Ora
replace ORARIO->note with ctesto+"a"+nGG_Ora
orario->(dbcommit())
return nRecord
//---------------------------------------------------------------------------------------//