[futurebasic] FB and Unicode

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2007 : Group Archive : Group : All Groups

From: "Bob Bryce" <rrbryce@...>
Date: Sat, 16 Jun 2007 15:19:39 +0000
Hi;

I'm still working on the problem of how to handle unicode text
while converting an old program from FB II to Intel MacBook.

Re: Brian Steven's response;

On Jun 14, 2007, at 6:43 PM, Bob Bryce wrote:

>Can FB pass these characters, or be programmed to handle
>unicode characters,
>OR am I stuck with 256 ASCI characters??

Apple provides unicode support and there are several ways to
implement it (depending on needs) in FB. One of the simplest ways is
to create an edit field using the appearance button statement with a
button type of  _kControlEditUnicodeTextProc.  There are also calls
to MLTE that are more complicated.  If you need more advanced stuff
just post again. Advantages of  _kControlEditUnicodeTextProc edit
fields are:  1) looks good in OS X,   2) no size limitation like FB
edit fields (they are tied to Apple's deprecated TextEdit manager
which is limited to 32k)  3) can handle all unicode characters.
There should be examples on the FB CD too. Watch out for line breaks
and other characters added by Mail in the posted code.   Brian S.
=================================
I tried to run Brian's code but get the following errors;

Error: Functions must be defined before using...
in file Temp Project at line 36 in BuildUntitled1Wnd
�def SetWindowBackground�( _kThemeActiveDialogBackgroundBrush, _zTrue )

Error: Un-Defined Constant {KCONTROLEDITUNICODETEXTPROC} ???
in file Temp Project at line 40 in BuildUntitled1Wnd
��appearance button 1, _activeBtn,,,,, @r, _kControlEditUnicodeTextProc

Actually my program opens a file to read and searches the text for things
like \mt, \s, \p etc. and replaces these tags with appropraite RTF format
codes writing to an output file. So I don't need to put
any Unicode text in an edit field; just to change tags like \mt (Main Title) 
to
an rtf format string and pass the Unicde Syllabic text thru to the output 
file.

My original program in FB II on my old Mac opened Source file and file to
write to as follows;

LOCAL FN pgetFile
  'DIM SourceFile$, temp$, destinationFile$, volRefNum%
  SourceFile$=FILES$(_fOpen,"TEXT",,InputvRefNum%)
  LONG IF LEN (SourceFile$) > 0
    DEF OPEN = "TEXT"
    charPos=INSTR(1,SourceFile$,".")
    Chop$=LEFT$(SourceFile$,(charPos-1))
    temp$=Chop$ + ".maf"
    destinationFile$=FILES$(_fSave,"Name Destination File 
as:",temp$,volRefNum%)
    LONG IF LEN(destinationFile$) > 0
      OPEN "O", #2, destinationFile$,, VolRefNum%'volRefNum%
    XELSE
      EXIT FN
    END IF
    SingleFile = _ztrue
  END IF
  FN parseFile(SourceFile$, InputvRefNum%)

END FN

The parseFile FN searches thru the text for \mt, \s, \p etc.
So to convert my program to Intel Mac and to be able to handle
Unicode Syllabic text in the SourceFile or Input file I need to be able
to read unicode test and to pass the unicode text to the destination File
along with the RTF format strings added by my program.

Hope this is clearer than my original general question.

Brain, willl your code help with that or am I looking for something else?

Bob Bryce