Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select text when the edit box is focus
#9
kevin,
I tested the win7 win10 win11 system version. I must add the following code to always select the text
Is there a better solution? thank you.

Code:
Copy      Help
,case EN_SETFOCUS<<16|3
,'E
,0.5
,PostMessage(lParam EM_SETSEL 0 -1)

Macro Macro20
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CC0AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 16 16 96 12 ""
;4 Edit 0x54030080 0x200 16 40 96 12 ""
;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 4"
str e3 e4
e3=
;hello world hello world hello world hello world
e4=e3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3sh 4sh"
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case EN_SETFOCUS<<16|3
,'E
,0.5
,PostMessage(lParam EM_SETSEL 0 -1)
,
,case EN_SETFOCUS<<16|4
,'E
,0.5
,PostMessage(lParam EM_SETSEL 0 -1)
,
ret 1


Messages In This Thread
RE: Select text when the edit box is focus - by Davider - 03-14-2023, 10:35 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)