DIRECTORY() + cGetFile - BUG????

DIRECTORY() + cGetFile - BUG????

Postby MGA » Mon Mar 31, 2008 3:13 pm

Antonio tenho um timer que verifica os arquivos TXT do diretorio, acontece que se chamar a cGETFILE, a função DIRECTORY passa a não achar mais os arquivos enquanto não fechar a cGETFILE:

EX:


#include "fivewin.ch"

function main()

local oWnd1,oti,obtn

DEFINE WINDOW oWnd1 TITLE "oWnd1" ;
FROM 5, 5 TO 24, 64


define timer oti of ownd1 interval 2000 action(teste())

@ 10,10 button obtn size 100,50 of oWnd1 pixel ACTION(LA())

ACTIVATE WINDOW oWnd1 on init(oti:activate()) maximized

return nil


******
function teste()

local adir

aDir := directory('*.txt')

if len(adir)=0
? "PROBLEMA"
endif

return(.t.)


FUNCTION LA()

LOCAL CFILE

cFile:=cGetFile("Bitmaps|*.bmp","" )

RETURN(.T.)
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Postby karinha » Mon Mar 31, 2008 4:14 pm

#include "fivewin.ch"
#Include "Directry.ch"
Code: Select all  Expand view
function main()

   local oWnd1,oti,obtn

   DEFINE WINDOW oWnd1 TITLE "oWnd1" ;
      FROM 5, 5 TO 24, 64

   define timer oti of ownd1 interval 2000 action(teste())

   @ 10,10 button obtn size 100,50 of oWnd1 pixel ACTION(LA())

   ACTIVATE WINDOW oWnd1 on init(oti:activate()) maximized

return nil


******
function teste()

   local adir

   aDir := directory('*.txt')

   if len(adir)=0
       ? "PROBLEMA"
   endif

return(.t.)


FUNCTION LA()

    LOCAL CFILE

    //cFile:=cGetFile("Bitmaps|*.bmp","" )

    cFile := SubStr( cGetFile( "*.BMP", "Selecione o Arquivo Bitmap (.BMP)" ), 3 )

    IF Empty( cFile )
        ? "No BitMaps in Local"
        Return Nil
    ELSE
        ? cFile
    ENDIF

RETURN(.T.)
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7343
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Postby MGA » Mon Mar 31, 2008 4:56 pm

Meu amigo Karinha, acho que você não entendeu o problema, o timer avalia sempre se existe arquivos TXT no diretorio, porem ao chamar cGETFILE a função directory passa a não enchergar mais os TXT em quanto a cGETFILE não for fechada.

Neste exemplo eu apenas chamo a cGETFILE para testar a DIRECTORY.
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Postby karinha » Mon Mar 31, 2008 5:32 pm

NAO FAÇA DESTE JEITO, CRIE UMA FUNCAO PARA CONTROLAR O TIMER.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7343
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Postby MGA » Mon Mar 31, 2008 5:50 pm

Desculpe não entendi o que vc quis dizer!
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Postby karinha » Mon Mar 31, 2008 6:31 pm

#include "fivewin.ch"
#Include "Directry.ch"
Code: Select all  Expand view
static oti

function main()

   local oWnd,obtn

   DEFINE WINDOW oWnd TITLE "WINDOW" ;
      FROM 5, 5 TO 24, 64

    @ 10,10 button obtn size 100,50 of oWnd pixel ACTION(LA())

   ACTIVATE WINDOW oWnd on init(ACIONA_TIMER(oWnd)) maximized

return nil




STATIC FUNCTION ACIONA_TIMER(OWND)
    DEFINE TIMER oTi INTERVAL 1000 OF oWnd  ACTION teste()
    ACTIVATE TIMER oTi
return(nil)

******
STATIC FUNCTION TESTE()

local adir

   aDir := directory('*.txt')

   if len(adir)=0

       oTi:End()

       //-> Ou oTi:DeAtivate()

       ? "nao encontrei nenhum arquivo.txt"

   endif

return(.t.)


******
FUNCTION LA()

   LOCAL CFILE

    cFile:=cGetFile("Bitmaps|*.bmp","" )

RETURN(.T.)

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7343
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 36 guests