Box lib editbox

From KolibriOS wiki
Revision as of 18:19, 13 July 2016 by Nisargshah95 (talk | contribs) (translate box lib editbox wiki to english (some translations are incomplete))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

Text field is used when entering text/numeric information.

Functions

  • edit_box_key - this function should be called when you enter the information from the keyboard
  • edit_box_mouse - this function should be called when you enter the information from the mouse
  • edit_box_draw - this function should be called when redrawing.
  • edit_box_set_text - it copies the text from the cursor in the text box. If the text in the index is longer than allowed in edit_box element, it is written not all. After calling this function, you need to redraw the window function edit_box_draw, otherwise the changes are not immediately visible. Example of use:
push dword buf
push dword edit1
call dword [edit_box_set_text]
.........
buf db '111-222-333', 0

where edit1 - edit_box structure element; buf - buffer, which contains the text of the installed.

  • version_ed - version element

editbox structure

editbox structure size is set within box_lib.mac file in ed_struc_size parameter.

struc  edit_box width,left,top,color,shift_color,focus_border_color,\
       blur_border_color,text_color,max,text,mouse_variable,flags,size,pos
{
.width dd width
.left  dd left
.top   dd top
.color dd color
.shift_color dd shift_color
.focus_border_color dd focus_border_color
.blur_border_color  dd blur_border_color
.text_color dd text_color
.max  dd max
.text dd text
.mouse_variable dd mouse_variable
.flags  dd flags+0
.size   dd size+0
.pos    dd pos+0
.offset dd 0
.cl_curs_x dd 0
.cl_curs_y dd 0
.shift     dd 0
.shift_old dd 0
}
  • width - width of the element
  • left - the left margin
  • top - the top margin
  • color - background color
  • shift_color - color selection by holding [Shift] or mouse
  • focus_border_color - frame color when the field is in focus
  • blur_border_color - frame color when the field is not in focus
  • text_color
  • max - the maximum size of the text (должно быть +2 резервных символа)
  • size - the current length of the text

Flags

ed_figure_only= 1000000000000000b   ;some characters
ed_always_focus= 100000000000000b
ed_focus=                     10b   ;application focus
ed_pass=                       1b   ;password field
ed_shift_on=                1000b   ;если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая shift
ed_shift_on_off=1111111111110111b
ed_shift=                    100b   ;включается при нажатии на shift т.е. если нажимаю
ed_shift_off=   1111111111111011b
ed_shift_bac=              10000b   ;бит для очистки выделеного shift т.е. при установке говорит что есть выделение
ed_shift_bac_cl=1111111111101111b   ;очистка при удалении выделения
ed_shift_cl=    1111111111100011b
ed_shift_mcl=   1111111111111011b
ed_left_fl=               100000b
ed_right_fl=    1111111111011111b
ed_offset_fl=            1000000b
ed_offset_cl=   1111111110111111b
ed_insert=              10000000b
ed_insert_cl=   1111111101111111b
ed_mouse_on =          100000000b
ed_mous_adn_b=         100011000b
ed_mouse_on_off=1111111011111111b