add easy method for setting system plain | fixed | bold fonts to textedit.
This commit is contained in:
@@ -624,8 +624,7 @@ TEXTCONTROL SET TextControl$, IsPassword
|
|||||||
IsPassword = true Hide typing
|
IsPassword = true Hide typing
|
||||||
TEXTCONTROL SET TextControl$, Option$, Value$
|
TEXTCONTROL SET TextControl$, Option$, Value$
|
||||||
Option$="align" Value$= "left" / "right" / "center"
|
Option$="align" Value$= "left" / "right" / "center"
|
||||||
*** note *** Haiku has issues align right. There are open tickets.
|
Option$="exclude", Value$=characters to disallow.
|
||||||
Option$="exclude", Value$=characters to disallow.
|
|
||||||
Option$="include", Value$=characters to allow.
|
Option$="include", Value$=characters to allow.
|
||||||
Option$="length", Value$=str$(number) of characters allowed.
|
Option$="length", Value$=str$(number) of characters allowed.
|
||||||
Sets the font used to the system fixed font.
|
Sets the font used to the system fixed font.
|
||||||
@@ -698,6 +697,8 @@ TEXTEDIT SET TextEdit$, Option$, Value$
|
|||||||
Add a word Value$ to the auto-completion list.
|
Add a word Value$ to the auto-completion list.
|
||||||
Option$ = "font"
|
Option$ = "font"
|
||||||
Set the font to Value$ (similar to DRAW SET); default is "system-plain"
|
Set the font to Value$ (similar to DRAW SET); default is "system-plain"
|
||||||
|
Option$="align" value$= "left | center | right" Sets the alignment for text in the textedit view.
|
||||||
|
Option$ = "plain | bold |fixed" valu$=str$(point_size) Sets the font face to system plain | bold | fixed font and sets the size to point_size
|
||||||
TEXTEDIT COLOR TextEdit$, Option$, Command$
|
TEXTEDIT COLOR TextEdit$, Option$, Command$
|
||||||
Option$ = "color1, color2, color3, color4, char-color", Command$
|
Option$ = "color1, color2, color3, color4, char-color", Command$
|
||||||
Add the command Command$ to the list of words that are checked for syntax highlighting
|
Add the command Command$ to the list of words that are checked for syntax highlighting
|
||||||
|
|||||||
@@ -2871,6 +2871,7 @@ void YabInterface::TextControl(const char* id, const char* option, const char* v
|
|||||||
ErrorGen("Bad length");
|
ErrorGen("Bad length");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tmpOption.IFindFirst("exclude")!=B_ERROR)
|
if(tmpOption.IFindFirst("exclude")!=B_ERROR)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -3677,6 +3678,11 @@ void YabInterface::TextSet(const char* title, const char* option, const char* va
|
|||||||
myText = cast_as(myView->FindView(title),YabText);
|
myText = cast_as(myView->FindView(title),YabText);
|
||||||
if(myText)
|
if(myText)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(tmp.IFindFirst("align")!=B_ERROR)
|
if(tmp.IFindFirst("align")!=B_ERROR)
|
||||||
{
|
{
|
||||||
if(tmp2.IFindFirst("left")!=B_ERROR)
|
if(tmp2.IFindFirst("left")!=B_ERROR)
|
||||||
@@ -3685,7 +3691,52 @@ void YabInterface::TextSet(const char* title, const char* option, const char* va
|
|||||||
myText->SetAlignment(B_ALIGN_CENTER);
|
myText->SetAlignment(B_ALIGN_CENTER);
|
||||||
else if(tmp2.IFindFirst("right")!=B_ERROR)
|
else if(tmp2.IFindFirst("right")!=B_ERROR)
|
||||||
myText->SetAlignment(B_ALIGN_RIGHT);
|
myText->SetAlignment(B_ALIGN_RIGHT);
|
||||||
}
|
}
|
||||||
|
else if(tmp.IFindFirst("fixed")!=B_ERROR)
|
||||||
|
{
|
||||||
|
const char* str_int = tmp2.String();
|
||||||
|
int i = atoi(str_int);
|
||||||
|
if (i>6)
|
||||||
|
{
|
||||||
|
BFont myFont=(be_fixed_font);
|
||||||
|
int myFontSize = i;
|
||||||
|
myFont.SetSize(myFontSize);
|
||||||
|
int TL = myText->TextLength();
|
||||||
|
const rgb_color Textcolor = {0,0,0,255};
|
||||||
|
myText->SetFontAndColor(0,TL,&myFont,B_FONT_ALL,&Textcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(tmp.IFindFirst("plain")!=B_ERROR)
|
||||||
|
{
|
||||||
|
const char* str_int = tmp2.String();
|
||||||
|
int i = atoi(str_int);
|
||||||
|
if (i>6)
|
||||||
|
{
|
||||||
|
BFont myFont=(be_plain_font);
|
||||||
|
int myFontSize = i;
|
||||||
|
myFont.SetSize(myFontSize);
|
||||||
|
int TL = myText->TextLength();
|
||||||
|
const rgb_color Textcolor = {0,0,0,255};
|
||||||
|
myText->SetFontAndColor(0,TL,&myFont,B_FONT_ALL,&Textcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(tmp.IFindFirst("bold")!=B_ERROR)
|
||||||
|
{
|
||||||
|
const char* str_int = tmp2.String();
|
||||||
|
int i = atoi(str_int);
|
||||||
|
if (i>6)
|
||||||
|
{
|
||||||
|
BFont myFont=(be_bold_font);
|
||||||
|
int myFontSize = i;
|
||||||
|
myFont.SetSize(myFontSize);
|
||||||
|
int TL = myText->TextLength();
|
||||||
|
const rgb_color Textcolor = {0,0,0,255};
|
||||||
|
myText->SetFontAndColor(0,TL,&myFont,B_FONT_ALL,&Textcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else if(tmp.IFindFirst("autocomplete")!=B_ERROR)
|
else if(tmp.IFindFirst("autocomplete")!=B_ERROR)
|
||||||
myText->AddWord(new BString(value));
|
myText->AddWord(new BString(value));
|
||||||
else if(tmp.IFindFirst("font")!=B_ERROR)
|
else if(tmp.IFindFirst("font")!=B_ERROR)
|
||||||
@@ -3805,10 +3856,9 @@ void YabInterface::TextSet(const char* title, const char* option, int value)
|
|||||||
else if(tmp.IFindFirst("tabwidth")!=B_ERROR)
|
else if(tmp.IFindFirst("tabwidth")!=B_ERROR)
|
||||||
myText->SetTabWidth(value);
|
myText->SetTabWidth(value);
|
||||||
else if(tmp.IFindFirst("cursor")!=B_ERROR)
|
else if(tmp.IFindFirst("cursor")!=B_ERROR)
|
||||||
myText->Select(value, value);
|
myText->Select(value, value);
|
||||||
else if(tmp.IFindFirst("textwidth")!=B_ERROR)
|
else if(tmp.IFindFirst("textwidth")!=B_ERROR)
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// BRect txtframe = myText->TextRect();
|
// BRect txtframe = myText->TextRect();
|
||||||
// txtframe.right = txtframe.left + value;
|
// txtframe.right = txtframe.left + value;
|
||||||
|
|||||||
@@ -8306,7 +8306,6 @@ Set the text control's text to Text$.
|
|||||||
|
|
||||||
TEXTCONTROL SET TextControl$, Option$, Value$
|
TEXTCONTROL SET TextControl$, Option$, Value$
|
||||||
Option$="align" Value$= "left" / "right" / "center"
|
Option$="align" Value$= "left" / "right" / "center"
|
||||||
*** note *** Haiku has issues align right. There are open tickets.
|
|
||||||
Option$="exclude", Value$=characters to disallow.
|
Option$="exclude", Value$=characters to disallow.
|
||||||
Option$="include", Value$=characters to allow.
|
Option$="include", Value$=characters to allow.
|
||||||
Option$="length", Value$=str$(number) of characters allowed.
|
Option$="length", Value$=str$(number) of characters allowed.
|
||||||
@@ -8515,6 +8514,9 @@ Given three parameters, the following options are valid for the textedit named T
|
|||||||
Option$ = "font" -- set the font to Value$ (see draw set for details), default is "system-plain"
|
Option$ = "font" -- set the font to Value$ (see draw set for details), default is "system-plain"
|
||||||
Option$ = "autocomplete" -- add the word Value$ to the auto-completion list
|
Option$ = "autocomplete" -- add the word Value$ to the auto-completion list
|
||||||
Option$ = "align" and value$ = "left|center|right" -- set the alignment for text in the textedit view.
|
Option$ = "align" and value$ = "left|center|right" -- set the alignment for text in the textedit view.
|
||||||
|
Option$ = "plain" value$ = str$(point) sets the font to system plain font of point size (number from 7 and up
|
||||||
|
Option$ = "fixed" value$ = str$(point) sets the font to system fixed font of point size (number from 7 and up
|
||||||
|
Option$ = "bold" value$ = str$(point) sets the font to system bold font of point size (number from 7 and up
|
||||||
|
|
||||||
Related: textedit, textedit add, textedit clear, textedit color, textedit get, textedit get$
|
Related: textedit, textedit add, textedit clear, textedit color, textedit get, textedit get$
|
||||||
&TextURL
|
&TextURL
|
||||||
|
|||||||
@@ -579,86 +579,86 @@ textcontrol get$
|
|||||||
textcontrol set
|
textcontrol set
|
||||||
261477
|
261477
|
||||||
textedit
|
textedit
|
||||||
262603
|
262535
|
||||||
textedit add
|
textedit add
|
||||||
263266
|
263198
|
||||||
textedit clear
|
textedit clear
|
||||||
263591
|
263523
|
||||||
textedit color
|
textedit color
|
||||||
263933
|
263865
|
||||||
textedit get
|
textedit get
|
||||||
264914
|
264846
|
||||||
textedit get$
|
textedit get$
|
||||||
266606
|
266538
|
||||||
textedit set
|
textedit set
|
||||||
267045
|
266977
|
||||||
&
|
&
|
||||||
270252
|
270515
|
||||||
texturl
|
texturl
|
||||||
270260
|
270523
|
||||||
texturl color
|
texturl color
|
||||||
270868
|
271131
|
||||||
tooltip
|
tooltip
|
||||||
271248
|
271511
|
||||||
tooltip color
|
tooltip color
|
||||||
272928
|
273191
|
||||||
&
|
&
|
||||||
274211
|
274474
|
||||||
treebox
|
treebox
|
||||||
274219
|
274482
|
||||||
treebox add
|
treebox add
|
||||||
274582
|
274845
|
||||||
treebox clear
|
treebox clear
|
||||||
275107
|
|
||||||
treebox collapse
|
|
||||||
275370
|
275370
|
||||||
|
treebox collapse
|
||||||
|
275633
|
||||||
treebox count
|
treebox count
|
||||||
275668
|
275931
|
||||||
treebox expand
|
treebox expand
|
||||||
275976
|
276239
|
||||||
treebox get$
|
treebox get$
|
||||||
276259
|
276522
|
||||||
treebox remove
|
treebox remove
|
||||||
276586
|
276849
|
||||||
treebox select
|
treebox select
|
||||||
277071
|
277334
|
||||||
treebox sort
|
treebox sort
|
||||||
277374
|
277637
|
||||||
&
|
&
|
||||||
277668
|
277931
|
||||||
localize
|
localize
|
||||||
277677
|
277940
|
||||||
translate$()
|
translate$()
|
||||||
280909
|
281172
|
||||||
&Sound
|
&Sound
|
||||||
281662
|
281925
|
||||||
&
|
&
|
||||||
281664
|
281927
|
||||||
beep
|
beep
|
||||||
281669
|
281932
|
||||||
bell
|
bell
|
||||||
281903
|
282166
|
||||||
sound play
|
sound play
|
||||||
282266
|
282529
|
||||||
sound stop
|
sound stop
|
||||||
283191
|
283454
|
||||||
sound wait
|
sound wait
|
||||||
283565
|
283828
|
||||||
&Window
|
&Window
|
||||||
283970
|
284233
|
||||||
&
|
&
|
||||||
283972
|
284235
|
||||||
alert
|
alert
|
||||||
283978
|
284241
|
||||||
filepanel
|
filepanel
|
||||||
285756
|
286019
|
||||||
window open
|
window open
|
||||||
289046
|
289309
|
||||||
window close
|
window close
|
||||||
291761
|
292024
|
||||||
window count
|
window count
|
||||||
292253
|
292516
|
||||||
window get
|
window get
|
||||||
292880
|
293143
|
||||||
window set
|
window set
|
||||||
294714
|
294977
|
||||||
|
|||||||
Reference in New Issue
Block a user