FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour cGetfile for saveas?
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
cGetfile for saveas?
Posted: Fri Oct 19, 2018 01:01 PM

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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 01:14 PM
Try with

Code (fw): Select all Collapse
      cFile := cGetFile32( , FWString("Save as"), 0, ;
                          hb_CurDrive() + ":\" + CurDir(), .T., .T. )
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 01:39 PM

Thank you.

Is's working fine :D

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 01:47 PM
Master, esto no funciona.

Code (fw): Select all Collapse
#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 - Phone: +55(11)95150-7341
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 01:51 PM
karinha wrote:Master, esto no funciona.

Code (fw): Select all Collapse
#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
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 02:49 PM

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.



Fwxh-MySql-TMySql
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 02:51 PM
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.



Fwxh-MySql-TMySql
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 02:52 PM
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 - Phone: +55(11)95150-7341
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 02:55 PM
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 (fw): Select all Collapse
      cFile := cGetFile32( "Project (*.prj) |*.prj|", "Save as", ;
                     0, hb_CurDrive() + ":" + cPathPrj + CurDir(), .T., .T. )
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 03:16 PM

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.



Fwxh-MySql-TMySql
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: cGetfile for saveas?
Posted: Fri Oct 19, 2018 03:43 PM
Thanks, Cristobal. I had not seen the link.
This is the right way:

Code (fw): Select all Collapse
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.



Fwxh-MySql-TMySql
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: cGetfile for saveas?
Posted: Wed Feb 20, 2019 07:49 AM

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
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: cGetfile for saveas?
Posted: Wed Feb 20, 2019 08:02 AM

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

Continue the discussion