Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sets the color for specific text within the RichEdit control
#1
Hi,

I want to achieve the effect in the picture below


[Image: hight.gif]

I have done the auto-replace function using QM code, However, no color is automatically added for specific text, the effect in the picture below

[Image: abc2.gif]

Is it complicated to implement auto-shading in QM? This may require more programming skills

Thanks in advance for any advice and help
david

Macro Highlight_text
Code:
Copy      Help
out
str template=
;For ┋Counter Variable┋ = ┋Lower Limit┋ To ┋Upper Limit┋
;,$P[I]
;Next

ARRAY(str) a
if(!findrx(template "┋(.+?)┋" 0 4 a)) end
ARRAY(str) c.create(a.len+1)
c[0]="4"
str dd
dd.formata("BEGIN DIALOG[]0 '''' 0x90C80AC8 0x0 0 0 490 %i ''Manual Text Input''[]" a.len*30+40)
int i idEdit(4) y(8)
for i 0 a.len
,dd.formata("%i Edit 0x54030080 0x200 8 %i 121 13[]" idEdit y)
,c[i+1]=a[0 i]
,if(i)
,,c[0].formata(" %i" idEdit)
,y+20
,idEdit+1
y+10
_s=
;1 Button 0x54030001 0x4 20 108 48 14 "OK"
;2 Button 0x54030000 0x4 80 108 48 14 "Cancel"
;3 RichEdit20A 0x54233044 0x0 136 8 346 114 ""
;END DIALOG

c.insert(i+1)
c[0].formata(" %i" 3)
dd.formata(_s)

;out dd

if(!ShowDialog(dd &sub.DlgProc &c[0])) end

mes c[c.len-1]

#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,_s=template
,_s.setwintext(id(3 hDlg))
,__Font-- f.Create("Microsoft YaHei Mono" 9 0) ;;font
,f.SetDialogFont(hDlg "3")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case [EN_CHANGE<<16|4,EN_CHANGE<<16|5,EN_CHANGE<<16|6,EN_CHANGE<<16|7,EN_CHANGE<<16|8,EN_CHANGE<<16|9]
,DT_GetControls(hDlg)
,sub.RR(template c _s)
,DT_SetControl(hDlg 3 _s)
ret 1

#sub RR
function str'template ARRAY(str)'c str&r
int i
ARRAY(POINT) b
findrx(template "┋(.+?)┋" 0 4 b)
int j
for i 0 b.len
,POINT& p=b[0 i]
,r.geta(template j p.x-j)
,r+c[i+1]
,j=p.y
r.geta(template j)


Messages In This Thread
Sets the color for specific text within the RichEdit control - by Davider - 09-02-2022, 10:21 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)