As far as I recall / understand, to set a custom icon on a file, we have to use BinaryStream (*).
Am I right ?
BinaryStream vs TextInputStream / TextOutputStream.
Files created with TextOutputStream are always of type text.
BTW: I forgot to check the Windows status for that. Ideas ?
This is OK for me, but unless I use BinaryStream to save a file (even a text file), I never was able to set a custom icon to it. I get the OS X text icon with my custom extension, but this is IMHO not a custom icon.
Just because you use textoutputstream to save a file does not mean it must have an extension of .txt. Define a fileType of Schwarz with the extension .emile, assign a custom icon to that file type, and set the name of your document created with textoutputstream to “MyFile.emile”
Part one of the sentence:
Yes, of course, but the question is to set it my (or yours) custom icon on that (non .txt file extension, .emile for example).
I will check (on Windows 8.1)
Part II of the sentence:
Yes, you are right too. I will create a simple project to demonstrate that.
I am waiting foer a download to end and so I created a simple project with a file type and a PushButton with the code below:
Sub Action()
Dim t As TextOutputStream
Dim f As FolderItem
f = GetSaveFolderItem("", "CreateExample.emile")
If f <> Nil Then
t = TextOutputStream.Create(f)
t.WriteLine("TextField1.Text")
t.Close
End If
End Sub
The code comes from the docs (textoutputstream) with two changes:
I replaced txt with emile.
I do not add a TextField, so I changed the WriteLine.ype with a custom icon and .emile as the file extension.
While running in the IDE: the created file have the set extension, but no special (not a TEXT icon, nor my custom icon) was set on my file.
Since I do not created the application, the test is not really valid, but it does a difference between OS X and Windows. I tried to refresh the folder contents
Nota: the file extension (.emile) appears, unlike all the other files on that folder.
I checked at home with the created application and it did not worked.
I shut down the Windows 8.1 machine, boot it again and get the same result. I run the application opnce more, create another file and get the same file without my custom icon.
I will share the (simple) project tomorrow. (I forget it at home).
Setting a file icon in Windows is a registry function. Or with declares (that in turn update the registry). You usually do that be declaring what the default program is that opens the file. That program’s icon is used for the file.
Note: if the extension is shown it means that Windows doesn’t recognize the extension (you haven’t declared it in the registry).
Now, I will read your answers and react - eventually - later (below).
PS: since yesterday early in the morning, I do not have for sometimes an OS X machine. So this example was created on Windows 8 (with all sorts of difficulties).
What is the learning curve time for a computer newbie using Windows 8 vs OS X ?
[quote=146949:@Tim Hare]Setting a file icon in Windows is a registry function. Or with declares (that in turn update the registry). You usually do that be declaring what the default program is that opens the file. That program’s icon is used for the file.
Note: if the extension is shown it means that Windows doesn’t recognize the extension (you haven’t declared it in the registry).[/quote]
Thank you Tim for your answer.
Part 1: a $1,000 software does not provide that natively ? Incredible. And nothing in the documentation ! I can’t believe that
Part 2: That is what I understand: the project file stands in the same folder (so three items inside that folder and two file extensions visibles).
I do not choose anything (read: I do not change Windows 8.1 settings that are “do not show the file extensions”).
Thank you too for the link. BUT, as I wrote earlier, this HAVE to be in the docs, somewhere (if not already: I cannot search for something I do not know, before now).
Talking about documentation: I searched the Xojo release notes for version 2014r2.1, but I do not found them (WINDOWS). THey do not seems to be in the Windows release (unlike in OS X dmg).
Yes, I will install Feedback and get it from there or from the docs web site.
As far as I remember that’s what installers are for. They register your app, extension, and document icon with the system by modifying the registry accordingly.