Page 1 of 1

cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 1:01 pm
by Marc Vanzegbroeck
Hi,

I have a program where the user can select an excel-file where he can import data from into the program.
He can set this in the settings of the program. He can browse the PC, and select the file. I'm using cGetile() for this.
Now I want also a setting where he can set an excel-file to export to. I want also the posibility that he can browse, and enter a name, just like a saveas in excel.
If I use cGetfile, I can enter a name, and press 'OPEN'. But this is confusing, because it is not an open, but a saveas.

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 1:14 pm
by cnavarro
Try with

Code: Select all  Expand view

      cFile := cGetFile32( , FWString("Save as"), 0, ;
                          hb_CurDrive() + ":\" + CurDir(), .T., .T. )


Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 1:39 pm
by Marc Vanzegbroeck
Thank you.

Is's working fine :D

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 1:47 pm
by karinha
Master, esto no funciona.

Code: Select all  Expand view

#include "FiveWin.ch"

static oWnd

//----------------------------------------------------------------//

FUNCTION Main()

   local oBar

   DEFINE WINDOW oWnd TITLE "SALVAR COMO"  // save as

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION SALVAR_COMO()

   SET MESSAGE OF oWnd TO "SALVAR COMO" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION SALVAR_COMO()

   LOCAL cFile

   cFile := cGetFile32( , FWString("Save as"), 0, ;
                          hb_CurDrive() + ":\" + CurDir(), .T., .T. )


RETURN NIL

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 1:51 pm
by Marc Vanzegbroeck
karinha wrote:Master, esto no funciona.

Code: Select all  Expand view

#include "FiveWin.ch"

static oWnd

//----------------------------------------------------------------//

FUNCTION Main()

   local oBar

   DEFINE WINDOW oWnd TITLE "SALVAR COMO"  // save as

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION SALVAR_COMO()

   SET MESSAGE OF oWnd TO "SALVAR COMO" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION SALVAR_COMO()

   LOCAL cFile

   cFile := cGetFile32( , FWString("Save as"), 0, ;
                          hb_CurDrive() + ":\" + CurDir(), .T., .T. )


RETURN NIL

What error do you get?
I use
cGetFile32( '*.xlsx| *.xlsx', "Save as", 0, 'c:\temp' , .T., .T. )

and it's working fine.

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 2:49 pm
by FranciscoA
Marc.
Excuse me, do you means to change the button text from 'open' to 'save as'?, because I tried and not works.
Maybe fivewin version? I use 1204.
Regards

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 2:51 pm
by FranciscoA
Marc Vanzegbroeck wrote:If I use cGetfile, I can enter a name, and press 'OPEN'. But this is confusing, because it is not an open, but a saveas.

Marc.
Excuse me, do you means to change the button text from 'open' to 'save as'?, because I tried and not works.
Maybe fivewin version? I use 1204.
Regards

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 2:52 pm
by karinha
FranciscoA wrote:Marc.
Excuse me, do you means to change the button text from 'open' to 'save as'?, because I tried and not works.
Maybe fivewin version? I use 1204.
Regards



+ 1

Regards.

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 2:55 pm
by cnavarro
FranciscoA wrote:Marc.
Excuse me, do you means to change the button text from 'open' to 'save as'?, because I tried and not works.
Maybe fivewin version? I use 1204.
Regards


http://wiki.fivetechsoft.com/doku.php?i ... cgetfile32

Yes, this change button "open" with "save"
This run ok with my version of Fwh
Code: Select all  Expand view

      cFile := cGetFile32( "Project (*.prj) |*.prj|", "Save as", ;
                     0, hb_CurDrive() + ":" + cPathPrj + CurDir(), .T., .T. )
 

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 3:16 pm
by FranciscoA
I do as follow and not works. The original button text is 'Guardar' and still same.
cFile := cGetFile32("Respaldos | *.Sql |","Abrir",0, cDirBackUp,.T.,.T.)
Regards.

Re: cGetfile for saveas?

PostPosted: Fri Oct 19, 2018 3:43 pm
by FranciscoA
Thanks, Cristobal. I had not seen the link.
This is the right way:

Code: Select all  Expand view
cFile := cGetFile32( "Respaldos | *.Sql |", "Seleccione respaldo" ,0, cDirBackUp,.F.,,)   // .f. = Abrir
cFile := cGetFile32( "Respaldos | *.Sql |", "Seleccione respaldo" ,0, cDirBackUp,.T.,,)   //.t. = Guardar
Regards.

Re: cGetfile for saveas?

PostPosted: Wed Feb 20, 2019 7:49 am
by betoncu
Is it possible to pass a default file name and hence to let the user to accept the given name or change it if he wish.

Re: cGetfile for saveas?

PostPosted: Wed Feb 20, 2019 8:02 am
by betoncu
Solved, we can use cInitialFile as shown below

cGetFile( <cFileMask>, <cTitle>, [<nDefaultMask>], [<cInitialDirectory>], [<lSave>], [<lLongNames>], [<nFlags>], [<cInitialFile>] ) –> cFileName