Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of FILEDIALOG for 'Save As' - C6.1 (ABC)

Status
Not open for further replies.

TinLegs

Programmer
Jan 14, 2003
100
NZ
I Have a *.TPS file I export to a set named *.CSV file in the programs folder using a process. Both these files are defined in the DCT. Rather than have this static option I wish to allow the user to be able to save the CSV file to a location and file name of their choice, I guess I need to use FILEDIALOG. Does anyone know of an example app or can help me to implement the correct use of FILEDIALOG for this purpose? Thanks.
 
Hi TinLegs,

I wrote something for you, which I hope gives you a better understanding of FileDialog.
!--------------------------------------------------------!
PROGRAM
MAP
!!From Builtins.clw!! FILEDIALOG(<STRING>,*?,<STRING>,SIGNED=0),PROC,BOOL,NAME('Cla$FileDialog')
END
INCLUDE('EQUATES.CLW')

lcl:FilePath STRING(FILE:MaxFilePath)
lcl:CurrentPath LIKE(lcl:FilePath)
lcl:Check:Save BYTE
lcl:Check:KeepDir BYTE
lcl:Check:NoError BYTE
lcl:Check:Multi BYTE
lcl:Check:LongName BYTE
lcl:Check:Directory BYTE
lcl:Flag SIGNED

window WINDOW('Test Clarion FileDialog'),AT(,,299,114),SYSTEM,GRAY,AUTO
PANEL,AT(2,87,296,24),USE(?Panel1),BEVEL(-1,-1)
STRING('The Current Folder:'),AT(4,91),USE(?String3),FONT(,,COLOR:BTNSHADOW,,CHARSET:ANSI)
ENTRY(@s128),AT(4,5,292,10),USE(lcl:FilePath)
BUTTON('File Dialog'),AT(237,19,59,13),USE(?CallDialog),LEFT,ICON(ICON:pick)
BOX,AT(4,19,196,66),USE(?Box1),ROUND,COLOR(COLOR:Black),FILL(COLOR:BTNSHADOW)
STRING(@s80),AT(4,100,292,10),USE(lcl:CurrentPath)
CHECK('Save (vs. Open)'),AT(30,23),USE(lcl:Check:Save),TRN
CHECK('Save && Restore Current Directory Path'),AT(30,33),USE(lcl:Check:KeepDir),TRN
STRING('Flags'),AT(6,25,30,57),USE(?unnamed),TRN,FONT('Arial',14,COLOR:BTNHIGHLIGHT,FONT:bold,CHARSET:ANSI), |
ANGLE(2700)
CHECK('Ignore Errors'),AT(30,43),USE(lcl:Check:NoError),TRN
CHECK('Allow Multiple Selections'),AT(30,53),USE(lcl:Check:Multi),TRN
CHECK('Use Long Filenames (32-bit only)'),AT(30,63),USE(lcl:Check:LongName),TRN
CHECK('Directory Select'),AT(30,72),USE(lcl:Check:Directory),TRN
BUTTON('Close'),AT(237,72,59,13),USE(?Close),LEFT,ICON('Exit.ico'),STD(STD:CLOSE)
END

CODE
OPEN(Window)
ACCEPT
CASE ACCEPTED()
OF ?CallDialog
DO Set_lcl:Flag
FILEDIALOG(,lcl:FilePath,'All Files|*.*|Clarion Source|*.CLW',lcl:Flag)
IF ERRORCODE() THEN MESSAGE('Error [' & ERROR() & ']','debug') END
END
lcl:CurrentPath = LONGPATH()
END
RETURN
!----------------------------------
Set_lcl:Flag ROUTINE
lcl:Flag = lcl:Check:Save * FILE:Save + |
lcl:Check:KeepDir * FILE:KeepDir + |
lcl:Check:NoError * FILE:NoError + |
lcl:Check:Multi * FILE:Multi + |
lcl:Check:LongName * FILE:LongName + |
lcl:Check:Directory * FILE:Directory



-- Mark Goldberg
 
Thank you MarkGoldberg
Your code has been very informative. Being new to Filedialog what I did not understand was that it appears to only provide an easy method for users to choose a file name and location, I was not aware that it did not actually save the file, so with a little code after the Filedialog call my problem has been solved and I have gained a little more knowledge.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top