Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Edit control modifies the current line of text
#3
you had several mistakes.
use this instead.

Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54231044 0x200 8 8 208 102 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str e3
e3="AAAAAAAAAAAAAAAAAAAAAAAAAA[]BBBBBBBBBBBBBBBBBBBBBBBBBB[]CCCCCCCCCCCCCCCCCCCCCCCCCC"

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


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAccelerators hDlg "401 Aa"
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 401
,int cid=id(3 hDlg)
,sub.SetCurLine(cid "_____")
ret 1

#sub SetCurLine
function h str's
POINT p; xm(p h 1) ;;get mouse position into p.x and p.y
int lh=MakeInt(p.x p.y)
int cursorPos = SendMessage(h EM_CHARFROMPOS 0 lh)
int cpos line
cpos = cursorPos&0xFFFF
line = cursorPos>>16
int lineStart = SendMessage(h EM_LINEINDEX line 0)
SendMessage(h EM_SETSEL lineStart cpos)

_s.getsel
_s+ s
SendMessageW h EM_REPLACESEL 1 @_s


Messages In This Thread
RE: Edit control modifies the current line of text - by Kevin - 02-27-2023, 02:32 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)