Saving styled EditFields, cross-platform 
Author Message
 Saving styled EditFields, cross-platform

I'm investigating RealBasic for a cross-platform project, in part
because it has pretty strong cross-platform text capabilities.

But I want the user to be able to style text, and I'd like this to be
saved. And the files should be openable on either Mac or Windows.

Matt Neuberg's book claims that textStyleData gives you
platform-specific data, and that seems to be the case. (This actually
contradicts the docmentation, which says it's a 'styl' scrap.)

I've searched the newsgroup back about 6 months, and I saw a message
from Joe Strout saying that somethinng like this was planned but
probably wouldn't be in 4.0.

So... is there a way (or workaround) to saving styled text in a file?
(And I should say, more than one in the same file.)

--

http://www.*-*-*.com/
    "I say we should listen to the customers and give them what they want."
    "What they want is better products for free." --Scott Adams



Wed, 04 Aug 2004 06:46:01 GMT  
 Saving styled EditFields, cross-platform
On 15/2/02 10:46 pm, in article

Quote:

> I'm investigating RealBasic for a cross-platform project, in part
> because it has pretty strong cross-platform text capabilities.

> But I want the user to be able to style text, and I'd like this to be
> saved. And the files should be openable on either Mac or Windows.

> Matt Neuberg's book claims that textStyleData gives you
> platform-specific data, and that seems to be the case. (This actually
> contradicts the docmentation, which says it's a 'styl' scrap.)

> I've searched the newsgroup back about 6 months, and I saw a message
> from Joe Strout saying that somethinng like this was planned but
> probably wouldn't be in 4.0.

> So... is there a way (or workaround) to saving styled text in a file?
> (And I should say, more than one in the same file.)

I'd suggest writing it in XML format.

E.g.

--------
[text]
Put your text data in here
[/text]
[style]
Put your style information in here
[/style]
--------

Then write it out to the file. When you bring it back in simply read in the
data into 2 separate strings (t as the text data and s as the style data)
then to read it into an editfield:

Dim s, t as string
T = // read text data into here
S = // read style information into here
EditField1.settextandstyle t, s // combine them and write into editfield

To get the dataq from the field to start with:

Dim s, t as string
T = Editfield1.text
S = Editfield1.textstyledata

Does this help at all?

Regards.
--------
Chris Willis - Macinware
http://www.macinware.f2s.com



Wed, 04 Aug 2004 06:58:59 GMT  
 Saving styled EditFields, cross-platform

Quote:

> > So... is there a way (or workaround) to saving styled text in a file?
> > (And I should say, more than one in the same file.)

> I'd suggest writing it in XML format.

> E.g.

> --------
> [text]
> Put your text data in here
> [/text]
> [style]
> Put your style information in here
> [/style]
> --------
> To get the dataq from the field to start with:

> Dim s, t as string
> T = Editfield1.text
> S = Editfield1.textstyledata

> Does this help at all?

No. The point is that textStyleData is apparently different on Mac and
Windows. The XML file above could not be read on a platform it wasn't
written on.

What I'm trying to find is a way to get cross-platform style runs. It
appears that REALbasic doesn't do this for me.

--

http://www.pensee.com/dunham/
    "I say we should listen to the customers and give them what they want."
    "What they want is better products for free." --Scott Adams



Wed, 04 Aug 2004 07:26:36 GMT  
 Saving styled EditFields, cross-platform

Quote:

> What I'm trying to find is a way to get cross-platform style runs.

RTF might be a good option, especially since many other apps can read
RTF, which would make your files a little more portable.  There's a RB
class called RTFParser at:

<http://www.belle-nuit.com/realbasic/>

I've only looked at it for parsing RTF into styled text -- and only
briefly, as my computer went into the shop shortly after I got it and I
haven't had time to play with it since.  So I'm not sure if it goes the
other way and turns styled text into RTF.  Seems like it ought to, but
if not, it'll at least make the job easier to have it half-done!  :-)



Wed, 04 Aug 2004 09:24:22 GMT  
 Saving styled EditFields, cross-platform

Quote:

> No. The point is that textStyleData is apparently different on Mac and
> Windows. The XML file above could not be read on a platform it wasn't
> written on.

> What I'm trying to find is a way to get cross-platform style runs. It
> appears that REALbasic doesn't do this for me.

That's correct. My chief cross-platform project has been dead for over a
year because of this. It is an ex-parrot. It has gone to meet its Maker.

I'm curious, David: Did you look into Runtime Revolution? What do they do
about this problem? m.

--

      *** REALbasic: The Definitive Guide! 2nd edition! ***
http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt



Wed, 04 Aug 2004 09:34:43 GMT  
 Saving styled EditFields, cross-platform
In article

Quote:

> > What I'm trying to find is a way to get cross-platform style runs. It
> > appears that REALbasic doesn't do this for me.

> That's correct. My chief cross-platform project has been dead for over a
> year because of this. It is an ex-parrot. It has gone to meet its Maker.

Too bad.

Quote:
> I'm curious, David: Did you look into Runtime Revolution? What do they do
> about this problem? m.

I didn't look very thoroughly -- REALbasic looks a lot better as a
development system. Then again, when I last looked, they didn't do OS X
(and just firing up the app, it's not even clear they did styled text).

--

http://www.pensee.com/dunham/
    "I say we should listen to the customers and give them what they want."
    "What they want is better products for free." --Scott Adams



Wed, 04 Aug 2004 14:04:27 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Cross-platform styled text?

2. Cross platform, or platform independent fortran 90 compilers?

3. Styled Text in EditFields

4. editfield and styled tex : the limits

5. Editfield with styles

6. Multiple EditFields - Open/Save

7. I want to save the content of an EditField into a File

8. Cross Platform Shared Vars and IBM's APL2

9. Running an app in a cross-platform way

10. Cross-Platform CD Publishing - best CD-R drive/sw

11. Cross Platform File Paths

12. Multi-User Database application (max 5 users) Cross platform Mac OS9 - OSX - Windows

 

 
Powered by phpBB® Forum Software