Xbasic

RTF.SET_STYLE Function

Syntax

P Set_Style(C Style)

Arguments

Style

The name of one the 8 styles.

Description

The .SET_STYLE() method applies the selected style to the paragraph at the cursor location.

Example 

dim crtf.text as C
dim num as N = 1
dim name as C
dim first_left_indent as N
dim left_indent as N
dim right_indent as N
crtf.object = rtf.create(" ")
crtf.object.insert("RTF Text to stretch over one line." + crlf()+ "So you can see what full justify does", 1)
crtf.text = crtf.object.rtf_text
ui_dlg_box("Xdialog Sample", <<%dlg%
{xmargin=2}
{region}{rtf=60,10crtf}{endregion};
{lf};
{region};
Number |[.5num];
Name |[.25name];
First Indent |[.10first_left_indent];
Left Indent |[.10left_indent];
Right Indent |[.10right_indent];
{lf};
|;
|;
|;
{endregion}
%dlg%,<<%code%
if a_dlg_button="Set_Style" then
    crtf.object.style[num].name = name
    crtf.object.style[num].first_left_indent = first_left_indent
    crtf.object.style[num].left_indent = left_indent
    crtf.object.style[num].right_indent = right_indent
    a_dlg_button = ""
end if
if a_dlg_button="Apply_Style" then
    crtf.object.set_style(crtf.object.style[num].name)
    crtf.object.repaint()
    a_dlg_button = ""
end if
if a_dlg_button="Get_Style" then
    crtf.object.Get_style(num)
    name = crtf.object.style[num].name
    first_left_indent = crtf.object.style[num].first_left_indent
    left_indent = crtf.object.style[num].left_indent
    right_indent = crtf.object.style[num].right_indent
    a_dlg_button = ""
end if
if a_dlg_button = "Left" then
crtf.object.left_justify()
    a_dlg_button = ""
end if
if a_dlg_button = "Right" then
crtf.object.right_justify()
    a_dlg_button = ""
end if
if a_dlg_button = "Toggle_Codes" then
crtf.object.show_codes()
    a_dlg_button = ""
end if
%code%)

Limitations

Desktop applications only.

See Also