editbox: remove selection if element was deactivated

git-svn-id: svn://kolibrios.org@7904 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;<3B><><EFBFBD><EFBFBD><EFBFBD><20><> <20><><EFBFBD><E0A0A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20>.<2E>. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E3A6A5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E5AEA4> <20><><20><> <20><><EFBFBD><E0A0A1><EFBFBD> ;<3B><><EFBFBD><EFBFBD><EFBFBD><20><> <20><><EFBFBD><E0A0A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20>.<2E>. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E3A6A5><EFBFBD>
;<3B><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E5AEA4> <20><><20><> <20><><EFBFBD><E0A0A1><EFBFBD>
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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
;--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --- ;--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;<3B><EFBFBD><20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD> <20><><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><EFBFBD> <20><EFBFBD><EBA2AE><EFBFBD><EFBFBD> ⮫쪮 <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><E3A6AD> <20><><EFBFBD><EFBFBD><EFBFBD> ;<3B><EFBFBD><20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD> <20><><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><EFBFBD> <20><EFBFBD><EBA2AE><EFBFBD><EFBFBD>
;⮫쪮 <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><E3A6AD> <20><><EFBFBD><EFBFBD><EFBFBD>
;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
test word ed_flags,ed_figure_only ; ⮫쪮 <20><><EFBFBD><EFBFBD><EFBFBD>? test word ed_flags,ed_figure_only ; ⮫쪮 <20><><EFBFBD><EFBFBD><EFBFBD>?
jz @f jz @f
@@ -719,16 +723,20 @@ edit_box_mouse.m_sh:
; <20><><EFBFBD><EFBFBD><E6A5A4><EFBFBD> <20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><><E4AEAA><EFBFBD> ; <20><><EFBFBD><EFBFBD><E6A5A4><EFBFBD> <20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><><E4AEAA><EFBFBD>
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 ; <20><20><> <20><><E4AEAA><EFBFBD>, <20><><EFBFBD><E5AEA4> 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;<3B><><20>㭪樨 <20><><EFBFBD> ;<3B><><20>㭪樨 <20><><EFBFBD>