I'd say it is very close to GENIUS level!!!
Regards,
Jules

'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Example of synchronising textboxes via parent's WM_CTLCOLOREDIT '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ #COMPILE EXE #INCLUDE "WIN32API.INC" %ID_TEXT = 21 %ID_TEXT2 = 22 DECLARE CALLBACK FUNCTION DlgProc() AS LONG '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Create dialog and controls, etc '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ FUNCTION PBMAIN () AS LONG LOCAL hDlg AS LONG, I AS LONG, txt AS STRING FOR I = 1 TO 50 txt = txt & "Line" & STR$(I) & $CRLF NEXT DIALOG NEW 0, "Synchronized textbox scroll",,, 188, 155, %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg CONTROL ADD TEXTBOX, hDlg, %ID_TEXT, txt, 4, 4, 180, 60, _ %WS_CHILD OR %ES_MULTILINE OR %WS_VSCROLL, _ %WS_EX_CLIENTEDGE CALL DlgProc CONTROL ADD TEXTBOX, hDlg, %ID_TEXT2, txt, 4, 74, 180, 60, _ %WS_CHILD OR %ES_MULTILINE OR %WS_VSCROLL, _ %WS_EX_CLIENTEDGE CALL DlgProc CONTROL ADD BUTTON, hDlg, %IDOK, "E&xit", 135, 138, 50, 14 CONTROL SET FOCUS hDlg, %ID_TEXT DIALOG SHOW MODAL hDlg CALL DlgProc END FUNCTION '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Main callback ' NOTE, this sample only synchronizes scroll. Easy to add code to synchronize ' text contents, plus caret pos or selection via EM_GETSEL/EM_SETSEL, etc. '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ CALLBACK FUNCTION DlgProc() AS LONG STATIC NoUpdate AS LONG 'to avoid un-neccessay updating SELECT CASE CBMSG CASE %WM_CTLCOLOREDIT 'note: returning brush or setting textcolor, etc. must be done here, before NoUpdate flag IF NoUpdate THEN EXIT FUNCTION NoUpdate = %TRUE LOCAL hEdit AS LONG, hEdit2 AS LONG, fLine AS LONG, fLine2 AS LONG hEdit = GetDlgItem(CBHNDL, %ID_TEXT) hEdit2 = GetDlgItem(CBHNDL, %ID_TEXT2) IF CBLPARAM = hEdit THEN 'trap visual changes in first textbox fLine = SendMessage(hEdit, %EM_GETFIRSTVISIBLELINE, 0, 0) '<- get first visible line in 1 fLine2 = SendMessage(hEdit2, %EM_GETFIRSTVISIBLELINE, 0, 0) '<- get first visible line in 2 IF fLine <> fLine2 THEN SendMessage hEdit2, %EM_LINESCROLL, 0, fLine - fLine2 '<- amount to scroll textbox 2 END IF ELSEIF CBLPARAM = hEdit2 THEN 'trap visual changes in second textbox fLine = SendMessage(hEdit, %EM_GETFIRSTVISIBLELINE, 0, 0) '<- get first visible line in 1 fLine2 = SendMessage(hEdit2, %EM_GETFIRSTVISIBLELINE, 0, 0) '<- get first visible line in 2 IF fLine <> fLine2 THEN SendMessage hEdit, %EM_LINESCROLL, 0, fLine2 - fLine '<- amount to scroll textbox 1 END IF END IF NoUpdate = %FALSE CASE %WM_COMMAND IF CBCTL = %IDOK THEN DIALOG END CBHNDL END SELECT END FUNCTION
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: