Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use of SendMessage
#2
Sorry Scott, didn't see your post till now 

try this didn't have time to fully test
 will need two functions a dialog and a file trigger function
Function Test_txt_sample_dialog
Code:
Copy      Help
str gf.getfile("C:\temp\test.txt")
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 158 "Test Dialog" "4"
;3 Edit 0x54231144 0x200 0 4 228 118 ""
;4 Button 0x54032000 0x0 52 137 48 14 "Reload"
;1 Button 0x54030001 0x4 116 137 48 14 "OK"
;2 Button 0x54030000 0x4 168 137 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str e3=gf
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#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 4 ;;Reload
,str rf.getfile("C:\temp\test.txt")
,if gf<> rf
,,rf.setwintext(id(3 hDlg))
,,SetFocus(GetDlgItem(hDlg, 3));
,,gf=rf
,case EN_SETFOCUS<<16|3
,,SendMessage(lParam WM_VSCROLL SB_BOTTOM 0);;scroll to bottom
,,int sp ep
,,SendMessage(lParam EM_GETSEL &sp &ep)
,,if sp=ep
,,,SendMessage(lParam EM_SETSEL 0 -1);; select  all
,,,SendMessage(lParam EM_SETSEL -1 -1);; deselect all and place caret at end
,,else
,,,SendMessage(lParam EM_SETSEL -1 -1);; deselect all and place caret at end
ret 1

Function Test_txt_FileTrigger
Trigger $f 0x48 "C:\temp" "test.txt"     Help - how to add the trigger to the macro
Code:
Copy      Help
;\
function event $name [$newname]
;event: 1 added, 2 removed, 4 renamed, 8 modified
;out F"{event} {name}"
int w=win("Test Dialog" "#32770")
if w
,str gf.getfile("C:\temp\test.txt")
,gf.setwintext(id(3 w))
,SendMessage(id(3 w) WM_VSCROLL SB_BOTTOM 0);;scroll to bottom


Messages In This Thread
Use of SendMessage - by ScottF - 04-27-2022, 12:15 PM
RE: Use of SendMessage - by Kevin - 05-03-2022, 01:55 PM
RE: Use of SendMessage - by ScottF - 05-03-2022, 08:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)