Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Edit box replacement in real time
#6
I think you are trying to say it is having trouble with double-byte characters. 
Try this
Code:
Copy      Help
str Text r Words
Words=
;┆name┆ = ""
;┆age┆ = ""

ICsv xt._create
xt.Separator="="
ICsv xw._create
xw.Separator="="
xw.FromString(Words)

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 392 192 "Dialog" "4"
;4 Edit 0x54030080 0x200 280 8 104 12 ""
;5 Edit 0x54030080 0x204 280 28 104 13 ""
;3 Edit 0x54231044 0x200 8 8 264 176 ""
;1 Button 0x54030001 0x4 280 171 48 14 "OK"
;2 Button 0x54030000 0x4 336 171 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "4 5 3"
str e4 e5 e3
e3=
;My name is ┆name┆, my age is ┆age┆,  thank you!

if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc v;; must have v attribute
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,str- e3t e3t1
,_s.getwintext(id(3 hDlg))
,Text=F" original = ''{_s}''"
,SendMessage id(4 hDlg) EM_SETCUEBANNER TRUE @"┆name┆"
,SendMessage id(5 hDlg) EM_SETCUEBANNER TRUE @"┆age┆"
,xt.FromString(Text)    
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case EN_KILLFOCUS<<16|3
,e3t.getwintext(lParam)
,e3t1=xt.Cell(0 1)
,if e3t<>e3t1
,,DT_GetControls(hDlg)
,,if(empty(e4) and empty(e5))
,,,Text=F" original = ''{e3t}''"
,,,xt.FromString(Text)
,case [EN_CHANGE<<16|4,EN_CHANGE<<16|5]
,DT_GetControls(hDlg)
,_s=xt.Cell(0 1)
,Words=
,F
,;┆name┆ = "{e4}"
,;┆age┆ = "{e5}"

,xw.FromString(Words)
,for int'i 0 xw.RowCount
,,r=xw.Cell(i 1)
,,if(r.len)
,,,_s.findreplace(xw.Cell(i 0) r 2)
,,else
,,,r= xw.Cell(i 0)
,DT_SetControl(hDlg 3 _s)

ret 1


Messages In This Thread
Edit box replacement in real time - by Davider - 08-06-2022, 12:30 AM
RE: Edit box replacement in real time - by Kevin - 08-06-2022, 02:13 AM
RE: Edit box replacement in real time - by Kevin - 08-06-2022, 02:31 PM
RE: Edit box replacement in real time - by Kevin - 08-07-2022, 12:24 PM

Forum Jump:


Users browsing this thread: 5 Guest(s)