Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sets the color for specific text within the RichEdit control
#20
Code:
Copy      Help
out
str template=
;For ┋Counter Variable┋ = ┋Lower Limit┋ To ┋Upper Limit┋
;,┋Counter Variable┋ ABC ┋Upper Limit┋
;Next
ARRAY(str) a
if(!findrx(template "┋(.+?)┋" 0 4 a)) end
ARRAY(str) c.create(a.len+1)
c[0]="5"
str dd
dd.formata("BEGIN DIALOG[]0 '''' 0x90C80AC8 0x0 0 0 137 %i ''Manual Text Input''[]" a.len*30)
int i idEdit(5) 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"
;END DIALOG
dd.formata(_s)

if(!ShowDialog(dd &sub.DlgProc &c[0])) end
str result
sub.RR(template c result)
mes result

#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case else
,int loword=wParam&0xFFFF
,int hiword=wParam>>16
,sel hiword
,,case EN_CHANGE
,,DT_GetControls(hDlg)
,,for i 1 c.len-1
,,,if(empty(c[i]))
,,,,DT_SetControl(hDlg loword a[0 i-1])
,,,,break
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
RE: Sets the color for specific text within the RichEdit control - by Kevin - 02-12-2023, 02:59 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)