Can you help with a solution? See code below. Why is the full
text selected initially even though a deselect command is sent
to the textbox?. If you copy a small part to the clipboard and
then paste to another program e.g. Word, then on returning to
this program, the full text is automatically being selected again.
Why? Can you help? Thanks in advance.
Regards,
Erik
------------------
text selected initially even though a deselect command is sent
to the textbox?. If you copy a small part to the clipboard and
then paste to another program e.g. Word, then on returning to
this program, the full text is automatically being selected again.
Why? Can you help? Thanks in advance.
Regards,
Erik
Code:
#COMPILE EXE #REGISTER NONE #DIM ALL #INCLUDE "win32api.inc" #INCLUDE "commctrl.inc" %FORM1_TEXTRESULTS = 100 %Form1_TEXTCOPY = 120 DECLARE SUB ShowDialog_Form1(BYVAL hParent&) DECLARE CALLBACK FUNCTION Form1_DLGPROC GLOBAL hForm1& FUNCTION PBMAIN LOCAL Count& LOCAL CC1 AS INIT_COMMON_CONTROLSEX CC1.dwSize=SIZEOF(CC1) CC1.dwICC=%ICC_WIN95_CLASSES InitCommonControlsEX CC1 ShowDialog_Form1 0 DO DIALOG DOEVENTS TO Count& LOOP UNTIL Count&=0 END FUNCTION SUB ShowDialog_Form1(BYVAL hParent&) LOCAL Style&, ExStyle& ,hCtl& LOCAL T$ T$= REPEAT$(10,"The problem is that after pasting from clipboard to e.g. word and returning to this program, the total text is selected in this window! Why? How can this be avoided? Thanks for your help in solving this problem! "+$CRLF) Style& = %WS_POPUP OR %DS_MODALFRAME OR %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU OR %DS_CENTER ExStyle& = 0 DIALOG NEW hParent&, "Clipboard test", 0, 0, 300, 200, Style&, ExStyle& TO hForm1& CONTROL ADD TEXTBOX, hForm1&, %FORM1_TEXTRESULTS, T$, 1,1,295, 175, _ %WS_CHILD OR %WS_VISIBLE OR %ES_MULTILINE OR %ES_WANTRETURN OR _ %ES_LEFT OR %WS_VSCROLL OR %ES_AUTOVSCROLL OR %WS_TABSTOP, _ %WS_EX_CLIENTEDGE CONTROL HANDLE hForm1&,%FORM1_TEXTRESULTS TO hCtl& SendMessage hCtl&,%EM_SETSEL,-1,0 CONTROL ADD "Button", hForm1&,%Form1_TEXTCOPY, "&Copy to clipboard ", 80, 184, 124, 12, _ %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP DIALOG SHOW MODELESS hForm1& , CALL Form1_DLGPROC END SUB CALLBACK FUNCTION Form1_DLGPROC LOCAL hEdit AS LONG CONTROL HANDLE hForm1&,%FORM1_TEXTRESULTS TO hEdit ' copy selected text to clipboard IF CBCTL=%Form1_TEXTCOPY THEN SendMessage hEdit, %WM_COPY, 0, 0 END FUNCTION
------------------
Comment