Page 1 of 2
Problem with Tplan : Cargo Error
Posted: Mon Jul 01, 2019 10:23 am
by Silvio.Falconi
code error
Code: Select all
pplication
===========
Path and name: C:\Work\Errori\Fsdi_Plan\main.Exe (32 bits)
Size: 3,676,672 bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 19.05
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 6 secs
Error occurred at: 01-07-2019, 12:19:12
Error description: Error BASE/1005 No exported variable: CARGO
Args:
[ 1] = U
[ 2] = H {=>}
Stack Calls
===========
Called from: => _CARGO( 0 )
Called from: source\sample01.prg => SAMPLEPLAN:MOVERESERVATION( 537 )
Called from: source\sample01.prg => (b)SAMPLEPLAN_BUILDPLANNING( 355 )
Called from: Lib\Plan\tplan.prg => TPLANNING:LBUTTONUP( 702 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
Called from: Lib\Plan\tplan.prg => TPLANNING:HANDLEEVENT( 619 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1078 )
Called from: source\main.prg => TAPPLICATION:ACTIVATE( 166 )
Called from: source\main.prg => MAIN( 29 )
I need to insert Tplan into a Dialog
this Dialog id made with ::nStyle := nOR( WS_CHILD, 4 ) because it is create on WndMain
on thid Dialog I inser a Panel oPanelBook where I insert Tplan Obj as you can see on Picture
I have error when I wish move the bargraph or resize
I have problem on MoveReservation( oData, nRowId, oPlann ) and on
ResizeReservation( oData, nRowId, oPlann ) )
I have error on
oData:CARGO
I not change anything on SamplePlan class (sample01.prg)
only I change ::oWnd := opanelBook
the source od the prg where I call SAMPLEPLAN CLASS
Code: Select all
function Planning()
local nSplit := VAL(GetPvProfString("Browse", "StSplit","102", oApp():cIniUser))
Local oExBar //new
local cDir := oApp():cDbfPath
IF oApp():oDlg != NIL
IF oApp():nEdit > 0
RETURN NIL
ELSE
oApp():oDlg:End()
SysRefresh()
ENDIF
ENDIF
oApp():oDlg := TFsdi():New(oApp():oWndMain)
oApp():oDlg:cTitle := i18n('Booking Hotel')
oApp():oDlg:SetColor(0,RGB(143,172,230))
oApp():oWndMain:oClient := oApp():oDlg
//pannel left
oExBar := TPanel():New(0,0,oApp():oDlg:nBottom,nSplit, oApp():oDlg )
oExBar:SetColor(0,RGB(143,172,230))
//pannel Booking
oApp():oPanelBook := TPanel():New(0,oExBar:nwidth+5,200, oApp():oDlg:nRight, oApp():oDlg )
oApp():oPanelBook:SetColor(0,CLR_WHITE)
ACTIVATE DIALOG oApp():oDlg NOWAIT ;
ON PAINT( oApp():oSplit:AdjClient()) ;
ON INIT (BuildExplorerBar(oExBar,nSplit, oApp():oDlg,.t.," Prenotazioni") ,;
BuildSplitterV(oExBar) ,;
oApp():oBook:=SamplePlan():New(oApp():oPanelBook,oApp:cDbfPath),;
ResizeWndMain());
VALID ( WritePProString("Book","Split",Ltrim(Str(oApp():oSplit:nleft/2)),oApp():cIniFile) ,; //save the split on inifile
DbCloseAll(), oApp():oDlg := NIL, .t. )
RETURN NIL
I have all these problem when I use Tdatabase
If I use normal dbf I not have all these problem
IF there is not problem on Tdtabase , How it's possibile I not have problem if I use normale exclusive dbf ?
Re: Problem with Tplan : Cargo Error
Posted: Mon Jul 01, 2019 11:05 am
by Silvio.Falconi
Now I saw this
If I insert the dbfs on the root of exe it run ok and not make error ( cargo)
If I insert the dbf on a folder it make error ( cargo)
it's strange
Re: Problem with Tplan : Cargo Error
Posted: Mon Jul 01, 2019 3:18 pm
by nageswaragunupudi
what is your code for movereservation?
what is the code at line 495?
Re: Problem with Tplan : Cargo Error
Posted: Mon Jul 01, 2019 6:16 pm
by Silvio.Falconi
Code: Select all
METHOD MoveReservation( oData, nRowId, oPlann ) CLASS SamplePlan
local oItem := oData
local cDescribe, cTooltip, nStatus
::oReserva:Seek( oItem:Cargo['INDICE'] )
if oPlann:nDaysOffset != 0 .OR. oPlann:nRoomsOffset != 0
cDescribe = oItem:cDescribe
nStatus = oItem:Cargo['STATUS']
oPlann:DeleteData( oItem, .F. )
::oReserva:CHECK_IN += oPlann:nDaysOffset //determina cuantos dias nos movimos
::oReserva:CHECK_OUT += oPlann:nDaysOffset //determina cuantos dias nos movimos
::oReserva:ROOMS_ID = nRowId
::oReserva:Save()
::oReserva:Commit()
::oRooms:Seek( nRowId )
cTooltip = "Elemento : " + ::oRooms:NAME + CRLF
cTooltip += "Numero : " + ::oRooms:ID + CRLF
cTooltip += "Ospite : " + ::oReserva:GUEST + CRLF
cTooltip += "Arrivo : " + DToC( ::oReserva:CHECK_IN ) + CRLF
cTooltip += "Partenza : " + DToC( ::oReserva:CHECK_OUT )
oData = oPlann:AddData( ::oReserva:ROOMS_ID,;
::oReserva:CHECK_IN,;
::oReserva:CHECK_OUT,;
cDescribe, cToolTip )
oData:Cargo = {=>}
oData:Cargo['STATUS'] = nStatus
oData:Cargo['INDICE'] = ::oReserva:ROOMS_ID + DToS(::oReserva:CHECK_IN)
oPlann:oLastData = NIL
endif
RETURN nil
line 495 oData:Cargo = {=>}
this afternoon I add a new data to samplePlan class
DATA cDbfPath init cFilePath(GetModuleFileName( GetInstance() )) + "Data\" // just for testing
Now it seem run ok
only on myapplication I not have the folder of archives = "data\"
but it is (year) \data\ the user can select the year
So i cannot Know the right folder
Another error
As You can see on datepick I have a Italian date while on tPlan Object I have the name of days in
english language
Re: Problem with Tplan : Cargo Error
Posted: Mon Jul 01, 2019 6:31 pm
by nageswaragunupudi
Code: Select all
oData = oPlann:AddData( ::oReserva:ROOMS_ID,;
In this line, oPlann:AddData(..) is returning NIL and so, oData is NIL.
You need to check your Class SamplePlan.
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 8:08 am
by Silvio.Falconi
Nages,
the problem is not there .........
If I insert a new data on Class type
Code: Select all
DATA cDbfPath init cFilePath(GetModuleFileName( GetInstance() )) + "Data\" // just for testing
all run ok , there is not error of cargo , all procedures run perfectly
But it is not my really folder on My application
the problem on my application I use a DATA
oApp:cDbfPAth where I save the path od Dbf, sample "\2013\Data\"
when I use on BuildDbf method (of the class SamplePlan)
local cDir := oApp():cDbfPath
::oRooms := TDatabase():Open( nil, cDir+"ROOMS", "DBFCDX", .t. )
I have this error
I have all dbfs into .\2013\data and I cannot change the folder
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 8:29 am
by Silvio.Falconi
Now I insert on Method New
::cDbfPath := GetIni( oApp():cIniFile, "Config", "DbfPath")
and seem to Found the dbfs
when I compile the source on my application
Before it show the plan then why I try to move or resize a bar I have the cargo error
it's incredible !!!!
I got demoralized, it's the same source code I didn't change anything, I just compiled it in my application, I didn't do anything else
I feel like a failure, I have been playing with these sources for days and I can't find the solution
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 9:15 am
by Silvio.Falconi
THERE IS AN ERROR ON FIRST Please see BuildPlanning method
DEFINE PLANNING ::oPlann OF ::oWnd;
HEADER "Elementi/Giorni";
COLOR HEADER ( If( Dow( dDate ) == 1 .OR. Dow( dDate ) == 7, CLR_WHITE, ::oPlann:nClrText ) );
COLOR CELL ::ColorData( oData ) ;
START DAY Date() - 5;
END DAY Date() + 5;
ON RIGHT SELECT oSelf:BuildPop( nRow, nCol, Self, dCheckIn, dCheckOut );
ON CAPTURE oSelf:MoveReservation(oData, nRowId, Self);
ON RESIZE DATA oSelf:ResizeReservation(oData, nRowId, Self) NOHALFDAY
BUT THE VARIABLE oData is not defined perhaps it can be a a data of the class ?
these errors there are only with tdatabase
instead if I Use RESERVA-> and ROOMS-> run ok
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 11:48 am
by Silvio.Falconi
I understand that I have to give up, it means that I will use the tplan only in a large window as you can see in the figure even though I particularly don't like it
because the end user would have the window of the program open and at the same time open the tplan.
Obviously, using tdatabase in share, you may perhaps not create erroneous reading files
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 11:56 am
by nageswaragunupudi
I have all dbfs into .\2013\data and I cannot change the folder
Yes.
But not in "\2013\data\"
That is your mistake.
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 3:17 pm
by Silvio.Falconi
Nages,
on Method New I add these lines
local cInifile := TakeOffExt( GetModuleFileName( GetInstance() ) ) + ".ini"
::cDbfPath := GetIni( cIniFile, "Config", "DbfPath")
this is the Main.ini
Code: Select all
[Config]
YearPath=2013
PdfPath=.\2013\Pdf\
DbfPath=.\2013\Data\
ZipPath=.\2013\Zip\
DocPath=.\2013\Doc\
XLsPath=.\2013\Xls\
ImgPath=.\images\
TempImg=.\temp\
Now I trying a release on ::oWnd as yu can see on previous picture. It run ok
But I not like it , I not like an appkication where are many opened windows ....
But If I insert the samplePlan class into my Dialog ( oApp:oDlg) , into a Panel called oApp():oPanelBook I have the cargo errors
I not change any sources , the sources are the same, it is the sample class
only I changed ::oWnd:= oApp():oPanelBook and rem the command to creare the window ::oWnd
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 3:40 pm
by James Bott
Silivo,
What Nages was referring to was the error message in a previous message of yours (above), shows the path without the leading period. Maybe you set it in your code somewhere which overrode your INI file?
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 3:53 pm
by Silvio.Falconi
Rith it's possible.
Now I erased all and re-write a test
PPlan.prg
Code: Select all
function Planning()
local nSplit := VAL(GetPvProfString("Browse", "StSplit","102", oApp():cIniUser))
Local oExBar //new
local cDir := oApp():cDbfPath
IF oApp():oDlg != NIL
IF oApp():nEdit > 0
RETURN NIL
ELSE
oApp():oDlg:End()
SysRefresh()
ENDIF
ENDIF
oApp():oDlg := TFsdi():New(oApp():oWndMain)
oApp():oDlg:cTitle := i18n('Booking Hotel')
oApp():oDlg:SetColor(0,RGB(143,172,230))
oApp():oWndMain:oClient := oApp():oDlg
//pannel left
oExBar := TPanel():New(0,0,oApp():oDlg:nBottom,nSplit, oApp():oDlg )
oExBar:SetColor(0,RGB(143,172,230))
//pannel Booking
oApp():oPanelBook := TPanel():New(0,oExBar:nwidth+5,200, oApp():oDlg:nRight, oApp():oDlg )
oApp():oPanelBook:SetColor(0,CLR_WHITE)
ACTIVATE DIALOG oApp():oDlg NOWAIT ;
ON PAINT( oApp():oSplit:AdjClient()) ;
ON INIT (BuildExplorerBar(oExBar,nSplit, oApp():oDlg,.t.," Prenotazioni") ,;
BuildSplitterV(oExBar) ,;
oApp():oBook:=SamplePlan():New(),;
ResizeWndMain());
VALID ( WritePProString("Book","Split",Ltrim(Str(oApp():oSplit:nleft/2)),oApp():cIniFile) ,; //save the split on inifile
DbCloseAll(),oApp():oBook:= NIL, oApp():oDlg := NIL, .t. )
RETURN NIL
and I attached the samplePlan original changingn the ::ownd
and strange now run ok or seem run ok
I don't Know , this morning not run ok and made cargo error , this afternoon seem run ok... BOH!!!
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 4:04 pm
by James Bott
I was just looking at the TSPlan source (dated 6/26/19), you sent me, and I notice that you have oData defined as a class variable (::oData) and elsewhere you define it as a local (oData) and then pass it around to methods. The point of making something a class variable is that you don't need to pass it around, so everything should be ::oData. That may be the source of your CARGO error. If you have defined it as one type then are calling it as the other type (which may not have been defined yet) then you would get that error.
I would also suggest using a better name for oData--a name that reflects the real-world object that it represents.
Re: Problem with Tplan : Cargo Error
Posted: Tue Jul 02, 2019 4:40 pm
by Silvio.Falconi
James,
I not make Tplan class , Daniel Garcia Gill is the Author
NOw I compiled the test of the tplan with the rest of the program that I am carrying out and when I went to test it again it gives me an error on odata: CARGO, I really am staco and I can't take it anymore ... I ask you to help me please !!!!