Changeset: 539 fdbozzo - 30/11/2014 18:55:29:

- Agregado botón Cancel en el form de progreso
This commit is contained in:
fdbozzo
2014-11-30 21:03:36 +01:00
parent b9a1aa494e
commit cffb65c310
5 changed files with 64 additions and 14 deletions

View File

@@ -60,6 +60,7 @@ Else
oVFP9.DoCmd( "PUBLIC oFoxBin2prg" )
oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" )
oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" )
oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress" )
For i = 0 To WScript.Arguments.Count-1
scanDirs( WScript.Arguments(i) )
@@ -83,6 +84,8 @@ Else
cFlagNoTimestamps = "'1'"
End If
oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress + ' (Press Esc to Cancel)'" )
For i = 1 To nFile_Count
oVFP9.DoCmd( "oFoxBin2Prg.AvanceDelProceso(oFoxBin2Prg.c_loc_processing_file + ' " & aFiles(i) & "...', " & i & ", " & nFile_Count & ", 0)" )
cFlagRecompile = "'" & FileSystemObject.GetParentFolderName( aFiles(i) ) & "'"

View File

@@ -60,6 +60,7 @@ Else
oVFP9.DoCmd( "PUBLIC oFoxBin2prg" )
oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" )
oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" )
oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress" )
For i = 0 To WScript.Arguments.Count-1
scanDirs( WScript.Arguments(i) )
@@ -89,6 +90,8 @@ Else
cFlagNoTimestamps = "'1'"
End If
oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress + ' (Press Esc to Cancel)'" )
For i = 1 To nFile_Count
oVFP9.DoCmd( "oFoxBin2Prg.AvanceDelProceso(oFoxBin2Prg.c_loc_processing_file + ' " & aFiles(i) & "...', " & i & ", " & nFile_Count & ", 0)" )
cFlagRecompile = "'" & FileSystemObject.GetParentFolderName( aFiles(i) ) & "'"

View File

@@ -62,6 +62,7 @@ Else
oVFP9.DoCmd( "PUBLIC oFoxBin2prg" )
oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" )
oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" )
oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress" )
cFlagGenerateLog = "'0'"
cFlagDontShowErrMsg = "'0'"
@@ -83,6 +84,8 @@ Else
cFlagRecompile = "'" & FileSystemObject.GetParentFolderName( WScript.Arguments(0) ) & "'"
oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress + ' (Press Esc to Cancel)'" )
If nDebug = 0 Or nDebug = 2 Then
cCMD = "oFoxBin2prg.ejecutar( '" & WScript.Arguments(0) & "' )"
Else
@@ -98,7 +101,14 @@ Else
End If
If GetBit(nDebug, 4) Then
If oVFP9.Eval("oFoxBin2prg.l_Error") Then
'If oVFP9.Eval("oFoxBin2prg.l_Error") Then
If nExitCode = 1799 Then
MsgBox "Conversion Cancelled by User!", 48, WScript.ScriptName
cErrFile = oVFP9.Eval("FORCEPATH('FoxBin2Prg.LOG',GETENV('TEMP') )")
oVFP9.DoCmd("STRTOFILE( oFoxBin2prg.c_ErrorLog, '" & cErrFile & "' )")
WSHShell.run cErrFile
ElseIf nExitCode > 0 Then
MsgBox "End of Process! (with errors)", 48, WScript.ScriptName
cErrFile = oVFP9.Eval("FORCEPATH('FoxBin2Prg.LOG',GETENV('TEMP') )")
oVFP9.DoCmd("STRTOFILE( oFoxBin2prg.c_ErrorLog, '" & cErrFile & "' )")

Binary file not shown.

View File

@@ -592,6 +592,7 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM
n_FB2PRG_Version = 1.19
*-- Localized properties
c_loc_processing_file = C_PROCESSING_LOC
c_loc_process_progress = C_PROCESS_PROGRESS_LOC
*--
c_Language = 'ES'
c_FB2PRG_EXE_Version = 0
@@ -710,7 +711,6 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM
FINALLY
ON ESCAPE
THIS.o_Frm_Avance = NULL
THIS.o_FSO = NULL
THIS.o_FNC = NULL
ENDTRY
@@ -722,10 +722,19 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM
PROCEDURE AvanceDelProceso
LPARAMETERS tcTexto, tnValor, tnTotal, tnTipo
*-- Si o_Frm_Avance se habilit<69> de forma externa, l_ShowProgress podr<64>a ser .F. para controlarlo desde fuera.
IF VARTYPE(THIS.o_Frm_Avance) = "O" THEN
THIS.o_Frm_Avance.AvanceDelProceso( tcTexto, tnValor, tnTotal, tnTipo )
ENDIF
TRY
*-- Si o_Frm_Avance se habilit<69> de forma externa, l_ShowProgress podr<64>a ser .F. para controlarlo desde fuera.
IF VARTYPE(THIS.o_Frm_Avance) = "O" THEN
*-- Cuando esta rutina se invoca desde el script, este m<>todo es el #1 y no puede cancelarse todav<61>a
IF THIS.o_Frm_Avance.l_Cancelled AND PROGRAM(-1) > 1 THEN
ERROR 1799
ENDIF
THIS.o_Frm_Avance.AvanceDelProceso( tcTexto, tnValor, tnTotal, tnTipo )
ENDIF
CATCH
THROW
ENDTRY
ENDPROC
@@ -2670,19 +2679,20 @@ ENDDEFINE
*******************************************************************************************************************
DEFINE CLASS frm_avance AS FORM
Height = 100
Height = 110
Width = 628
ShowWindow = 2
DoCreate = .T.
AutoCenter = .T.
BorderStyle = 2
CAPTION = C_PROCESS_PROGRESS_LOC + ' (Press Esc to Cancel)'
CAPTION = 'FoxBin2Prg - ' + C_PROCESS_PROGRESS_LOC + ' (Press Esc to Cancel)'
ControlBox = .F.
BackColor = RGB(255,255,255)
nmax_value = 100
nmax_value2 = 100
nvalue = 0
nvalue2 = 0
l_Cancelled = .F.
Name = "frm_avance"
_memberdata = [<VFPData>] ;
+ [<memberdata name="avancedelproceso" display="AvanceDelProceso"/>] ;
@@ -2694,11 +2704,12 @@ DEFINE CLASS frm_avance AS FORM
+ [<memberdata name="nvalue_assign" display="nValue_assign"/>] ;
+ [<memberdata name="nmax_value" display="nMax_Value"/>] ;
+ [<memberdata name="nmax_value2" display="nMax_Value2"/>] ;
+ [<memberdata name="l_cancelled" display="l_Cancelled"/>] ;
+ [</VFPData>]
ADD OBJECT shp_base AS shape WITH ;
Top = 32, ;
Top = 28, ;
Left = 12, ;
Height = 13, ;
Width = 604, ;
@@ -2707,7 +2718,7 @@ DEFINE CLASS frm_avance AS FORM
ADD OBJECT shp_avance AS shape WITH ;
Top = 32, ;
Top = 28, ;
Left = 12, ;
Height = 13, ;
Width = 36, ;
@@ -2722,13 +2733,13 @@ DEFINE CLASS frm_avance AS FORM
Caption = ".", ;
Height = 17, ;
Left = 12, ;
Top = 12, ;
Top = 8, ;
Width = 604, ;
Name = "lbl_Tarea"
ADD OBJECT shp_base2 AS shape WITH ;
Top = 68, ;
Top = 64, ;
Left = 12, ;
Height = 13, ;
Width = 604, ;
@@ -2737,7 +2748,7 @@ DEFINE CLASS frm_avance AS FORM
ADD OBJECT shp_avance2 AS shape WITH ;
Top = 68, ;
Top = 64, ;
Left = 12, ;
Height = 13, ;
Width = 36, ;
@@ -2752,15 +2763,33 @@ DEFINE CLASS frm_avance AS FORM
Caption = ".", ;
Height = 17, ;
Left = 12, ;
Top = 48, ;
Top = 44, ;
Width = 604, ;
Name = "lbl_Tarea2"
ADD OBJECT cmdcancel AS commandbutton WITH ;
Top = 84, ;
Left = 252, ;
Height = 21, ;
Width = 100, ;
Caption = "Cancel", ;
Enabled = .F., ;
Name = "cmdCancel"
PROCEDURE AvanceDelProceso
LPARAMETERS tcTexto, tnValor, tnTotal, tnTipo
WITH THIS AS frm_avance OF foxbin2prg.prg
*-- Habilita el bot<6F>n de cancelar una vez que se comienzan a pasar valores
IF NOT EMPTY(tnValor) THEN
IF NOT .cmdCancel.Enabled THEN
.cmdCancel.Enabled = .T.
ENDIF
DOEVENTS
ENDIF
DO CASE
CASE tnTipo = 0
IF NOT EMPTY(tcTexto) THEN
@@ -2825,6 +2854,11 @@ DEFINE CLASS frm_avance AS FORM
ENDPROC
PROCEDURE cmdcancel.Click
THISFORM.l_Cancelled = .T.
ENDPROC
ENDDEFINE