How to disable setcolor in a texteditor string?
I casually found that moai.DoMethod(id$, "SetColor", start, end, 0) does it but I'm not sure it is the right way. I'm not sure that all the escape characters are removed and I get a plain text.
Can someone give some light on this matter?
thanks
Texteditor.SetColor
Re: Texteditor.SetColor
Sorry I selected the wrong thread lt needed to be under rapagui
May the administrator move this post? Thanks
May the administrator move this post? Thanks
Re: Texteditor.SetColor
you dont need at all coloring?
maybe seting Texteditor.Styled to false which disables it?
maybe seting Texteditor.Styled to false which disables it?
Christos
Re: Texteditor.SetColor
I think that styled would apply to the whole document of the texteditor, while instead I need to reset the color in just few specific words of the document leaving the rest untouched (with colors)
- airsoftsoftwair
- Posts: 5959
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Texteditor.SetColor
Hmm, if you only need to reset the color in a few specific words why not use Texteditor.SetColor?
Re: Texteditor.SetColor
Yes I did that as described in my first message but I'm not sure I found the correct way
- airsoftsoftwair
- Posts: 5959
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Texteditor.SetColor
I think it's the only way. Maybe in the future a method for resetting style information for a part of the text can be added.
Re: Texteditor.SetColor
I approached the problem in a more pragmatic way with the following function
It works but I have a problem with the Cut command. It seems not work. In fact I get the line repeated with the color and without the color.
The mark command seems working because the debug print shows coherent figures.
Atm I'm stuck with this problem that is another problem respect the first one.
Code: Select all
Function p_te_uncolor(id$,l_n,txt$)
Local line_pos=moai.DoMethod(id$, "GetPosition", "0", ToString(l_n-1))
Local line_len=moai.DoMethod(id$, "GetLineLength", ToString(l_n-1))
Local t$ = moai.DoMethod(id$, "GetText", line_pos, line_pos+line_len)
Local pz=FindStr(t$,txt$)
If pz>=0
ntxt$=MidStr(t$,pz-10,StrLen(txt$)+20); my text including evenctual color escape chr
If StartsWith(ntxt$,Chr(27).."P[")
t$=UnmidStr(t$, pz+StrLen(txt$), 10)
t$=UnmidStr(t$, pz-10, 10)
moai.Set(id$,"CursorPos",line_pos)
moai.DoMethod(id$, "Mark", line_pos, line_pos+line_len)
DebugPrint(line_pos, line_pos+line_len, moai.DoMethod(id$, "GetSelection"))
moai.DoMethod(id$, "Cut")
moai.Set(id$,"CursorPos",line_pos)
moai.DoMethod(id$, "Insert", t$, "Cursor")
EndIf
EndIf
EndFunction
The mark command seems working because the debug print shows coherent figures.
Atm I'm stuck with this problem that is another problem respect the first one.
Re: Texteditor.SetColor
found the problem!.
The texteditor was readonly but at this point why only cut is effected by the readonly and not set color?
The texteditor was readonly but at this point why only cut is effected by the readonly and not set color?