Xbasic

RTF.GET_FONT_COLOR Function

Syntax

Font_Color as C = Get_Font_Color(N Pos)

Arguments

Pos

Numeric

Description

The .GET_FONT_COLOR() method returns the font color of the selected text.

Example 

dim crtf.object as P
dim crtf.text as C
dim current_font as C = "Tahoma,8"
dim font_color as C = "Black"
dim point as C
dim temp as C
crtf.object = rtf.create(" ")
crtf.object.insert("RTF Text to stretch over one line, so you can see what full justify does", 1)
crtf.text = crtf.object.rtf_text
ui_dlg_box("Xdialog Sample", <<%dlg%
{ymargin=1}{xmargin=4}
|{rtf=30,10crtf};
{lf};
Font |[%P=ui_get_font("",current_font)%.30current_font];
Color |[%P=ui_select_color2(font_color)%.30font_color];
{lf};
|;
|;
|;
|;
%dlg%,<<%code%
if a_dlg_button="Get_Font" then
    a_dlg_button = ""
    current_font = crtf.object.get_font()
    font = word(current_font, 1, ",")
end if
if a_dlg_button="Set_Font" then
    a_dlg_button = ""
    crtf.object.set_font(current_font)
end if
if a_dlg_button="Get_Font_Color" then
    a_dlg_button = ""
    font_color = crtf.object.get_font_color()
end if
if a_dlg_button="Set_Font_Color" then
    a_dlg_button = ""
    crtf.object.set_font(current_font, font_color)
end if
crtf.text = crtf.object.rtf_text
%code%)

Limitations

Desktop applications only.

See Also