Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#COMPILE EXE '#Win 11.00#
#DIM ALL
#INCLUDE "Win32Api.inc"
GLOBAL hDlg AS DWORD
%Edit = 401
'______________________________________________________________________________
CALLBACK FUNCTION pbMainProc
STATIC CaretSize AS POINTAPI
LOCAL EditRec AS RECT
STATIC hEdit AS DWORD
SELECT CASE CBMSG
CASE %WM_INITDIALOG
hEdit = GetDlgItem(hDlg, %Edit)
GetClientRect(hEdit, EditRec)
CaretSize.x = 20
CaretSize.y = EditRec.nBottom
PostMessage(hDlg, %WM_COMMAND, MAKDWD(%Edit, %EN_SETFOCUS), hEdit)
PostMessage(hEdit, %EM_SETSEL, -1, 0) 'Push caret to the right
CASE %WM_COMMAND
SELECT CASE CBCTL 'LO(WORD, CBWPARAM)
CASE %Edit
IF CBCTLMSG = %EN_KILLFOCUS OR CBCTLMSG = %EN_SETFOCUS THEN
CreateCaret(hEdit, BYVAL %Null, CaretSize.x, CaretSize.y)
ShowCaret(hEdit)
END IF
END SELECT
END SELECT
END FUNCTION
'______________________________________________________________________________
FUNCTION PBMAIN()
DIALOG DEFAULT FONT "Tahoma", 72, 1
DIALOG NEW PIXELS, 0, "TextAdd", 100, 100, 400, 150, %WS_OVERLAPPEDWINDOW TO hDlg
CONTROL ADD TEXTBOX, hDlg, %Edit, "Test", 10, 10, 380, 120
DIALOG SHOW MODAL hDlg CALL pbMainProc
END FUNCTION
'______________________________________________________________________________
http://www.garybeene.com/sw/gbsnippets.htm