Hi all,

REALbasic 2006 Release 4
Mac OS X 10.4.8
This is a X-Platform related report.
File Type Sets Editor


[The Format PopupMenu does not appears when I use OpenDialog under Mac OS X and 
I use:
Dlg.Filter = FTText.All

BUT, in this case, I am able to open unwanted text files like RTF. If I select 
it, I get the rtf data, AND THIS IS A BUG since I do not have integrated a rtf 
parser! So, use the code below to avoid that.]


I am working with styled text and wanted to get a platform independant Open / 
Save dialog ('cause I do not wanted to implement my own RTF [nor html] 
read/write operations).

At the moment to set the .Filter property (for OpenDialog / SaveAsDialog), I 
used FTText.All and get in the dialog the "original Windows" popup menu to 
choose a type.

The popup menu propose what I have in the File Type (Display Name) so:

Format:     Document de texte   [*]
            macos/txt
            windows/rtf
            linux/txt

The FileTypes have been defined in that order and since it is not possible to 
change the apparition order...

[*] In French, probably "Text document" in English (us or uk English OS 
versions).


Of course, I cannot let that as is: the PopupMenu display one correct (true) 
information: the running platform one!


So I found this code nice to work-around one BUG [**]:


  #If TargetLinux Then
    // What can be the Linux text style format ? [none, Linux currently does 
not support styles]
    OpenDlg.Filter = FTText.LinuxTXT
    
  #ElseIf TargetMacOS Then
    // (OLD) TextEdit style format (in ResourceFork)
    OpenDlg.Filter = FTText.MacOSTXT
    
  #ElseIf TargetWin32
    // Windows RTF format (Rich Text File)

    OpenDlg.Filter = FTText.WindowsRTF
  #EndIf

Change the OpenDlg reference (above) to SaveDlg (or whatever you choose) for 
the Save Operations.

On Open, using the code above display as available to open only the TEXT files 
(one that have "txt" as extension) and hides gracefully "rtf" files on Mac OS.

Test have to be done on Linux (suse 10.1) and Windows (XP SPII). Read [***] far 
below for the Linux and Windows reports.

[**] In this case, the bug can be considered as mine, cause I am the developer 
in charge and I have to know what I am doing.
In fact, this is IMHO a documentation lack. Why, there is an entry that talks 
about the Format PopupMenu ?
Simply because there is not the code I share above.
[Yes, it is easy to send the fault on other people hands :) ]

HTH,

Emile


PS: RS people, please use the code above in the documentation, in the 
documentation.


[***] Other Platforms:

1. Linux report:

Without surprise, this works as expected (for once; the project test the styles 
on all platforms, so...)
[Save] What is funny is that if I click in the "Parcourir pour d'autres 
dossiers" (Display other folders ?) disclosure button, I will see a PopupMenu, 
but there is only one entry: "linux/txt" ! and this is good.
[Open] I have that PopupMenu (and the whole window, not the small with a 
disclosure button) and only the linux/txt entry. GOOD!


2. Windows report:

No surprise too here: the "Format" PopupMenu is there, only one entry the one I 
placed there: windows/rtf.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to