editbox: remove selection if element was deactivated

git-svn-id: svn://kolibrios.org@7904 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-09 20:59:51 +00:00
parent 6db54831c3
commit 80a6eb4355
3 changed files with 18 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -133,10 +133,11 @@ dword width,
{ {
dword ed_text; dword ed_text;
ESI = ed; ESI = ed;
ESI.edit_box.offset = ESI.edit_box.shift = ESI.edit_box.shift_old = 0; //ESI.edit_box.offset = ESI.edit_box.shift = ESI.edit_box.shift_old = 0; //no need because of 7904
ESI.edit_box.flags = _flags; ESI.edit_box.flags = _flags;
ed_text = ESI.edit_box.text; ed_text = ESI.edit_box.text;
ESI.edit_box.pos = ESI.edit_box.size = strlen(ed_text); //ESI.edit_box.pos = //no need because of 7904
ESI.edit_box.size = strlen(ed_text);
} }
struct scroll_bar struct scroll_bar

View File

@ -84,10 +84,12 @@ edit_box:
.draw_bg_cursor_text: .draw_bg_cursor_text:
call .check_offset call .check_offset
call .draw_bg call .draw_bg
test word ed_flags,ed_focus ; for unfocused controls =>
jz .draw_cursor_text ; do not draw selection(named shift)
call .draw_shift call .draw_shift
.draw_cursor_text: .draw_cursor_text:
call .draw_text call .draw_text
test word ed_flags,ed_focus test word ed_flags,ed_focus ; and dosn`t draw cursor
jz .editbox_exit jz .editbox_exit
call .draw_cursor call .draw_cursor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -167,12 +169,14 @@ edit_box_key:
; restore ascii code ; restore ascii code
rol eax,8 rol eax,8
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪  ;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨
;íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_no_process up,down,esc,enter,tab,numl,capsl,scrolll,pgup,pgdown use_key_no_process up,down,esc,enter,tab,numl,capsl,scrolll,pgup,pgdown
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  --- ;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;<3B>஢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥ ;<3B>஢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì
;⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
test word ed_flags,ed_figure_only ; ⮫쪮 æ¨äàë? test word ed_flags,ed_figure_only ; ⮫쪮 æ¨äàë?
jz @f jz @f
@ -719,16 +723,20 @@ edit_box_mouse.m_sh:
; ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ; ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá 
jmp edit_box_mouse.drc jmp edit_box_mouse.drc
edit_box_mouse._remove_selection:
and word ed_flags,ed_shift_cl
jmp edit_box.draw_bg_cursor_text
edit_box_mouse._blur: edit_box_mouse._blur:
test word ed_flags,ed_always_focus test word ed_flags,ed_always_focus
jne edit_box.editbox_exit jne edit_box_mouse._remove_selection
btr word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬ btr ed_flags, bsf ed_focus ;if focused then remove focus, otherwise exit
jnc edit_box.editbox_exit jnc edit_box_mouse._remove_selection
mov ebp,ed_color mov ebp,ed_color
call edit_box.clear_cursor call edit_box.clear_cursor
edit_box_mouse.drc: edit_box_mouse.drc:
call edit_box.draw_border call edit_box.draw_border
jmp edit_box.editbox_exit jmp edit_box_mouse._remove_selection
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨ ;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨