[futurebasic] Re [FB] Font Info

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1998 : Group Archive : Group : All Groups

From: SVANVOORST@...
Date: Sun, 27 Sep 1998 23:38:14 EDT
Brian asked:
<How can I make an EDIT FIELD that displays all the fonts in the system?>

If you have an "empty" (no items) menu titled "Font" in a menu resource, the
following code will display the system fonts in an edit field:

RESOURCES "app.rsrc"                              'Contains menu resource
COMPILE 0, _caseInsensitive                       'with "empty" menu titled
"Font".

LOCAL FN displayFonts
  teHndl&=TEHANDLE(1)
  fontHndl&=FN GETMHANDLE(20)
  FOR item% = 1 TO FN COUNTMITEMS(fontHndl&)
    CALL GETITEM(fontHndl&,item%,title$)
    length%=LEN(title$)
    CALL TEINSERT(@title$+1,length%,teHndl&)      'Inserts font name
    CALL TEKEY(13,teHndl&)                        'followed by carriage
return.
  NEXT
END FN

LOCAL FN buildWnd
  WINDOW#1,"Font Display.Demo",(30,40)-(400,600)
  EDIT FIELD#1,"",(40,30)-(230,470),_statframed,_centerJust'room for 40 fonts
  MENU 20,_resSubMenu,1,"FONT"                    'Font menuID=20             
END FN

FN buildWnd
FN displayFonts
DO
  HANDLEEVENTS
UNTIL FN STILLDOWN                                'mouse down to quit

Steve Van Voorst