prev | index | next

MX-FontList
6
6
632 bytes
1043 bytes
2002-04-29 22:52:54
2002-04-29 22:52:54
Oldes (oliva.david@seznam.cz)


How to change fonts in the TextFields

(mx-fontlist.rswf)
background 153.165.139
fnt_Courier: Font [name "Courier New" bold]
txt_info: EditText 'info 320x40 [
    ReadOnly Color 0.0.0 Font [fnt_Courier 12]
]
txt_test: EditText 'x 320x140 [
    text "FlashMX^/from^/REBOL"
    ReadOnly Color #006400 Font [fnt_Courier 40]
    WordWrap Layout [layout: 'center Leading: -2]
]
place txt_info
t: place txt_test at 5x50
DoAction [
    constantPool [fonts msg changeFont myTextFormat i length]
    fonts: TextField.getFontList()
    msg: "You have installed " add fonts.length add " fonts."
    myTextFormat: make TextFormat
    myTextFormat.align: "center"
    i: 0
    changeFont: func[][
        info: msg . "^/Now you see font n." . i . ": " . fonts/:i
        myTextFormat.font: fonts/:i
        i++ if i > fonts.length [i: 0]
        t.setTextFormat(myTextFormat)
    ]
    changeFont()
    i: setInterval(changeFont 500)
]
showFrame
end