by Arindam » Fri Jan 26, 2007 7:19 am
Once again thanks Detlef.
In my last post I wrote you that I had tried as Antonio says :
" Is oBacktWnd:End() returning a logical value ? It should".
The Result is same.
Finaly I change my code as follows :
// Include files details
#include "FiveWin.ch"
#include "Fileio.ch"
#include "Inkey.ch"
#include "Font.ch"
#include "Color.ch"
Static oBacktWnd, lPath, TPath, lType, lDrive, oDLG, oFont
//----------------------------------------------------------------------------//
Function Main()
// Set as required
SET _3DLOOK ON
Set Century On
Set Date Brit
Set Date format "dd/mm/yyyy"
DEFINE FONT oFont NAME "COURIER" SIZE 6, 9
DEFINE ICON oIco File ("D:\Blazepro\Image\Favorite.ico")
DEFINE WINDOW oBacktWnd From 25, 185.5 To 45, 205.5 ;
TITLE "BackRest" ICON oIco ;
NO MAXIMIZE
SET FONT of oBacktWnd to oFont
ACTIVATE WINDOW oBacktWnd ;
On INIT BackRest() ;
VALID CloseFunc( oDlg )
RELEASE FONT oFont
Return Nil
//----------------------------------------------------------------------------//
Static Function BackRest()
Local oLbx, nItem := 0, oMeter, nMeter
Local n, nSelected := 0, aSel := {}
//Set Default
SET DELETED OFF
// Replace variable.
lpath := (CurDrive() + ":\" + "Blazepro\Data\")
tpath := Space(25)
lType := Space(1)
lpath := AllTrim(lpath)
DEFINE DIALOG oDlg RESOURCE "BACKREST" of oBacktWnd TITLE "BACKUP / RESTORE FUNCTION" Color "W/W"
REDEFINE SAY oSay ID 1 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 2 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 3 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 4 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 5 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 6 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 7 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 8 OF oDlg Color "N/W" Font oFont
REDEFINE SAY oSay ID 9 OF oDlg Color "N/W" Font oFont
REDEFINE GET oGet Var lType ID 10 OF oDlg ;
Valid reqdata(ltype) .And. (ltype ="D" .Or. ltype ="M") ; // Daily or Monthly backup
Picture "@!" Color "B+/W"
REDEFINE GET oGet Var tPath ID 11 OF oDlg ;
Valid reqdata(tPath) ;
Picture "@!" Color "B+/W"
REDEFINE LISTBOX oLbx VAR nItem ;
ID 0 OF oDlg ;
ITEMS aDataFiles() ;
BITMAPS { "CHECKON", "CHECKOFF" } ;
ON DRAWITEM ( IIF(aScan(oLbx:GetSelItems(),nItem) >0, 1, 2) );
ON CHANGE (nSelected := oLbx:GetSelCount(), oDlg:AevalWhen());
COLOR "N/W"
REDEFINE button ID 13 OF oDLG ;
ACTION (aeval(oLbx:aItems,{|o,n| oLbx:SetSel(n,.t.) }), oLbx:Change())
REDEFINE button ID 14 OF oDLG ;
ACTION (aeval(oLbx:aItems,{|o,n| oLbx:SetSel(n,.f.) }), oLbx:Change());
WHEN nSelected > 0
REDEFINE button ID 15 OF oDLG ;
ACTION BackUp(oLbx, lpath, tpath, lType), oLbx:Change();
WHEN nSelected > 0
REDEFINE button ID 16 OF oDLG //;
//ACTION Restore(oLbx,lpath, tpath), oLbx:Change();
//WHEN nSelected > 0
REDEFINE button ID 12 of oDLG CANCEL;
ACTION oDlg:END()
ACTIVATE DIALOG oDlg ;
VALID (oBacktWnd:End(), .T.)
oDlg:aControls[ 10 ]:Setfocus(.T.)
Return Nil
//----------------------------------------------------------------------------//
Static Function BackUp(oLbx, SourcePath, TargetPath, BackupType)
/* My Backup Code
Where :
SourcePath == ("D:\Blazepro\Data\")
TargetPath == ("D:\Blazepro\Backup\")
BackupType == "D"
*/
Return Nil
//----------------------------------------------------------------------------//
STATIC FUNCTION aDataFiles()
RETURN { ;
("D:\BlazePro\Data\Complain.Dbf") , ;
("D:\BlazePro\Data\Mechanic.Dbf") , ;
("D:\BlazePro\Data\Customer.Dbf") , ;
("D:\BlazePro\Data\Custcat.Dbf") , ;
("D:\BlazePro\Data\Custarea.Dbf") , ;
("D:\BlazePro\Data\Proprice.Dbf") , ;
("D:\BlazePro\Data\Payment.Dbf") , ;
("D:\BlazePro\Data\Change.Dbf") ;
}
//----------------------------------------------------------------------------//
Static Function CloseFunc( oDlg )
If ValType(oDlg) = "O"
oDlg:End()
Endif
Return .T.
//----------------------------------------------------------------------------//
Function ReqData( Param )
If Empty( Param )
MsgStop("Currentt field can not be BLANK.",;
"WARNING")
Return .F.
Endif
Return .T.
The error report details :
Application
===========
Path and name: D:\XHB\bin\backupTest.exe (32 bits)
Size: 1,525,248 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 26/01/2007, 12:35:02
Error description: Error BASE/1004 Class: 'NIL' has no exported method: GETMENUITEM
Args:
[ 1] = N 2090312480
Stack Calls
===========
Called from: => GETMENUITEM(0)
Called from: WINDOW.PRG => TDIALOG:MEASUREITEM(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: DIALOG.PRG => TDIALOG:HANDLEEVENT(0)
Called from: => DIALOGBOX(0)
Called from: DIALOG.PRG => TDIALOG:ACTIVATE(0)
Called from: => BACKREST(97)
Called from: MainBackup.prg => (b)MAIN(30)
Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: MainBackup.prg => MAIN(30)
System
======
CPU type: Intel(R) Pentium(R) 4 CPU 2.26GHz 2283 Mhz
Hardware memory: 376 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
Compiler version: xHarbour build 0.99.61 Intl. (SimpLex)
With Regards
Arindam