cGetfile for saveas?

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

cGetfile for saveas?

Post 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.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: cGetfile for saveas?

Post by cnavarro »

Try with

Code: Select all

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

C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: cGetfile for saveas?

Post by Marc Vanzegbroeck »

Thank you.

Is's working fine :D
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: cGetfile for saveas?

Post by karinha »

Master, esto no funciona.

Code: Select all

#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
João Santos - São Paulo - Brasil
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: cGetfile for saveas?

Post by Marc Vanzegbroeck »

karinha wrote:Master, esto no funciona.

Code: Select all

#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.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Post 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
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Post 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
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: cGetfile for saveas?

Post 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.
João Santos - São Paulo - Brasil
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: cGetfile for saveas?

Post 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

      cFile := cGetFile32( "Project (*.prj) |*.prj|", "Save as", ;
                     0, hb_CurDrive() + ":" + cPathPrj + CurDir(), .T., .T. )
 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Post 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.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Post by FranciscoA »

Thanks, Cristobal. I had not seen the link.
This is the right way:

Code: Select all

cFile := cGetFile32( "Respaldos | *.Sql |", "Seleccione respaldo" ,0, cDirBackUp,.F.,,)   // .f. = Abrir
cFile := cGetFile32( "Respaldos | *.Sql |", "Seleccione respaldo" ,0, cDirBackUp,.T.,,)   //.t. = Guardar
Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
betoncu
Posts: 120
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: cGetfile for saveas?

Post 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.
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
User avatar
betoncu
Posts: 120
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: cGetfile for saveas?

Post by betoncu »

Solved, we can use cInitialFile as shown below

cGetFile( <cFileMask>, <cTitle>, [<nDefaultMask>], [<cInitialDirectory>], [<lSave>], [<lLongNames>], [<nFlags>], [<cInitialFile>] ) –> cFileName
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Post Reply