Mercurial > dwindows
comparison win/dw.c @ 2235:bd642d04d7c6
Win: Turn on horizontal scrollbar when word wrap is off in rich edit MLE.
Also work around rich edit EM_SCROLLCARET bug by showing the selection first.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 04 Jan 2021 14:29:24 +0000 |
parents | 4d2619f31ebd |
children | e7060d262939 |
comparison
equal
deleted
inserted
replaced
2234:b569023edb6f | 2235:bd642d04d7c6 |
---|---|
9365 * handle: Handle to the MLE. | 9365 * handle: Handle to the MLE. |
9366 * state: TRUE if it wraps, FALSE if it doesn't. | 9366 * state: TRUE if it wraps, FALSE if it doesn't. |
9367 */ | 9367 */ |
9368 void API dw_mle_set_word_wrap(HWND handle, int state) | 9368 void API dw_mle_set_word_wrap(HWND handle, int state) |
9369 { | 9369 { |
9370 /* If ES_AUTOHSCROLL is not set and there is no | |
9371 * horizontal scrollbar it word wraps. | |
9372 */ | |
9373 if(state) | |
9374 dw_window_set_style(handle, 0, ES_AUTOHSCROLL); | |
9375 else | |
9376 dw_window_set_style(handle, ES_AUTOHSCROLL, ES_AUTOHSCROLL); | |
9377 /* If it is a rich edit control use the rich edit message */ | 9370 /* If it is a rich edit control use the rich edit message */ |
9378 if(hrichedit || hmsftedit) | 9371 if(hrichedit || hmsftedit) |
9372 { | |
9373 SendMessage(handle, EM_SHOWSCROLLBAR, (WPARAM)SB_HORZ, (LPARAM)(state ? FALSE : TRUE)); | |
9379 SendMessage(handle, EM_SETTARGETDEVICE, 0, state ? 0 : 1); | 9374 SendMessage(handle, EM_SETTARGETDEVICE, 0, state ? 0 : 1); |
9375 } | |
9380 } | 9376 } |
9381 | 9377 |
9382 /* | 9378 /* |
9383 * Sets the word auto complete state of an MLE box. | 9379 * Sets the word auto complete state of an MLE box. |
9384 * Parameters: | 9380 * Parameters: |
9395 * handle: Handle to the MLE to be positioned. | 9391 * handle: Handle to the MLE to be positioned. |
9396 * point: Point to position cursor. | 9392 * point: Point to position cursor. |
9397 */ | 9393 */ |
9398 void API dw_mle_set_cursor(HWND handle, int point) | 9394 void API dw_mle_set_cursor(HWND handle, int point) |
9399 { | 9395 { |
9400 SendMessage(handle, EM_SETSEL, 0, MAKELPARAM(point,point)); | 9396 SendMessage(handle, EM_SETSEL, (WPARAM)point, (LPARAM)point); |
9397 if(hrichedit || hmsftedit) | |
9398 SendMessage(handle, EM_HIDESELECTION, 0, 0); | |
9401 SendMessage(handle, EM_SCROLLCARET, 0, 0); | 9399 SendMessage(handle, EM_SCROLLCARET, 0, 0); |
9402 } | 9400 } |
9403 | 9401 |
9404 /* | 9402 /* |
9405 * Finds text in an MLE box. | 9403 * Finds text in an MLE box. |
9438 } | 9436 } |
9439 | 9437 |
9440 if(retval) | 9438 if(retval) |
9441 { | 9439 { |
9442 SendMessage(handle, EM_SETSEL, (WPARAM)retval - textlen, (LPARAM)retval); | 9440 SendMessage(handle, EM_SETSEL, (WPARAM)retval - textlen, (LPARAM)retval); |
9441 if(hrichedit || hmsftedit) | |
9442 SendMessage(handle, EM_HIDESELECTION, 0, 0); | |
9443 SendMessage(handle, EM_SCROLLCARET, 0, 0); | 9443 SendMessage(handle, EM_SCROLLCARET, 0, 0); |
9444 } | 9444 } |
9445 | 9445 |
9446 free(tmpbuf); | 9446 free(tmpbuf); |
9447 | 9447 |