cGetfile for saveas?

cGetfile for saveas?

Postby Marc Vanzegbroeck » Fri Oct 19, 2018 1: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: cGetfile for saveas?

Postby cnavarro » Fri Oct 19, 2018 1:14 pm

Try with

Code: Select all  Expand view  RUN

      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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: cGetfile for saveas?

Postby Marc Vanzegbroeck » Fri Oct 19, 2018 1:39 pm

Thank you.

Is's working fine :D
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: cGetfile for saveas?

Postby karinha » Fri Oct 19, 2018 1:47 pm

Master, esto no funciona.

Code: Select all  Expand view  RUN

#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
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: cGetfile for saveas?

Postby Marc Vanzegbroeck » Fri Oct 19, 2018 1:51 pm

karinha wrote:Master, esto no funciona.

Code: Select all  Expand view  RUN

#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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: cGetfile for saveas?

Postby FranciscoA » Fri Oct 19, 2018 2: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
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Postby FranciscoA » Fri Oct 19, 2018 2: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
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Postby karinha » Fri Oct 19, 2018 2: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
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: cGetfile for saveas?

Postby cnavarro » Fri Oct 19, 2018 2: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: Select all  Expand view  RUN

      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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: cGetfile for saveas?

Postby FranciscoA » Fri Oct 19, 2018 3: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
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Postby FranciscoA » Fri Oct 19, 2018 3:43 pm

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

Code: Select all  Expand view  RUN
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
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: cGetfile for saveas?

Postby betoncu » Wed Feb 20, 2019 7: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
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: cGetfile for saveas?

Postby betoncu » Wed Feb 20, 2019 8: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
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 38 guests