User Interface Extension Library Usage Example 1.

This example shows how UI Interface Extension Library can be used to build font selection dialog with live preview.

demo1.gif (6942 bytes)

The main specific work in this sample script is concentrated in two subroutines - CollectFonts which retrieves the list of installed fonts and sets it to Font list in the dialog:

SUB CollectFonts
    n&=EnumSystemFonts(FontFlag)
    REDIM Fonts(n)
    FOR i&=1 TO n
        GetFontName i-1,Fonts(i)
    NEXT i
    MainDialog.Fonts.SETARRAY Fonts
END SUB

The second, BuildPreview, creates a preview of the selected font:

SUB BuildPreview
cx&=220
cy&=50
BeginImage cx,cy,RGB(255,255,255)
    ImageGetTextSize Sample$,x&,y&,Font$,Size,400+300*Bold,Italic,Underline,StrikeOut 
    ImageTextOut Sample$,(cx-x)\2,(cy-y)\2,Font,Size,400+300*Bold,Italic,Underline,StrikeOut,Color
EndImage ImageFile$
MainDialog.Preview.SetImage ImageFile$
END SUB

Note. The above subroutines are slightly simplified and differ from those in the sample script.

[ <Previous page | Next Page> ]


[ Learning CorelSCRIPT | Oberon Home Page ]

Copyright 2000 by Alex Vakulenko. All rights reserved.
This page was last revised on 01/13/00.