Real Software Forums
http://forums.realsoftware.com/

Trouble with FileTypes
http://forums.realsoftware.com/viewtopic.php?f=6&t=41082
Page 1 of 1

Author:  pbesong [ Thu Oct 20, 2011 7:50 am ]
Post subject:  Trouble with FileTypes

I'm porting my app to Windows and have run across a problem in testing. I have a method that creates a text file of everything that's in my listbox. I am using the following code

file=GetSaveFolderItem("TEXT",newFileName + "transcripts.txt")


which works just fine on the Mac, but on Windows 7 (and on only one computer that I know of yet) it is instead using my project file FileType and instead of getting a ".txt" extension, it's getting a ".mcp" extension. MCP is the first FileType I have listed in my FileTypes. In addition to that, it seems to be garbliing the text into something unreadable like this (binary possibly?):

67&óG2ˆbDTBF∆≤g&ˆ“GV◊vV'6óFR÷F˜vÊ∆ˆBFW7@–†–¢ñbñ˜R∆ˆˆ≤BFÜR6Ü'BBFÜRF˜ÜW&R


Should I be filtering in a more specific way? Does Windows not see TEXT as a viable filetype? And why would this only occur on one computer and not another? It worked fine when I tested it on my XP and Win 7 machines.

Author:  JiggyMan [ Thu Oct 20, 2011 7:59 pm ]
Post subject:  Re: Trouble with FileTypes

pbesong wrote:
...but on Windows 7 (and on only one computer that I know of yet) it is instead using my project file FileType and instead of getting a ".txt" extension

I could be wrong but I believe you actually have to pass it an instance of the FileType class. At least, that is what I see in the docs and what I have always done.

If your FileType class is named FileTypes1 and you have added a text type with an object name of Text:
file=GetSaveFolderItem(FileTypes1.Text, "transcripts.txt")

pbesong wrote:
In addition to that, it seems to be garbliing the text into something unreadable like this (binary possibly?)

Perhaps it is using binary because it is confused about the file type you intended to save as. That may clear up once you've clarified the file type as described above. If not, you may need to examine the method you are using to write the data to the text file.

RB docs: FileType

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/