Changes

Jump to: navigation, search

Console UI Core Classes - OOP344 20111

2,131 bytes added, 23:15, 24 March 2011
CLineEdit
==CLineEdit==
'''ClineEdit''' encapsulates the bio_edit function of bio library.
<big><syntaxhighlight lang="cpp">
#pragma once
</syntaxhighlight></big>
LineEdit, sets the Field's _data to the value of str. If LineEdit is instantiated with this constructor then it will edit an external string provided by the caller function of LineEdit. LineEdit in this case is not creating any dynamic memory, therefore _dyn is set to false (therefore the destructor will not attempt to deallocate the memory pointed by _data).<br />
The location (row and col) and Bordered are directly passed to the parent (FWField) and str is passed as data to the parent constructor. Unlike Label, LineEdit could have border or not so depending on this (Bordered being true or false) the Height is set to 3 or 1 respectfully. <br />
(hint: use '''? :''' operator to pass the proper Height value to FWField's constructor)
<big><syntaxhighlight lang="cpp">
const char* Border=C_BORDER_CHARS);
</syntaxhighlight></big>
Works exactly like the previous constructor with one difference; since no external data is passed to be edited here, this constructor must allocate enough dynamic memory to accommodate editing of '''Maxdatalen''' characters. Then make it an empty string and set Fields's _data to point to it. Make sure _dyn is set to true in this case, so the destructor knows that it has to deallocate the memory at the end.
<big><syntaxhighlight lang="cpp">
~CLineEdit();
</syntaxhighlight></big>
If '''_dyn''' is true, it will deallocate the character array pointed by Fields's '''_data'''
<big><syntaxhighlight lang="cpp">
void draw(int Refresh = C_FULL_FRAME);
</syntaxhighlight></big>
It will first call Frame's draw passing '''Refresh'''as an argument to it.<br />Then it will make a direct call to bio_display to show the data kept in Field's '''_data'''.<br />The values used for the arguments of bio_display are:*str: address of string pointed by _data + the value of _offset*row: absRow() (''add one if border is visible'')*col: absCol() (''add one if border is visible'')*len: width() (''reduce by two is border is visible''')
<big><syntaxhighlight lang="cpp">
int edit();
</syntaxhighlight></big>
Makes a direct call to, and returns '''bio_edit()'''.For the coordinates and width arguments follow the same rules as the draw function.For the rest of the arguments of bio_edit, use the attributes of '''CLineEdit'''.
<big><syntaxhighlight lang="cpp">
bool editable()const;
</syntaxhighlight></big>
Always return true;
<big><syntaxhighlight lang="cpp">
void set(const void* Str);
</syntaxhighlight></big>
Copies the characters pointed by '''Str''' into the memory pointed by Field's '''_data''' up to '''_maxdatalen''' characters.
==CButton==

Navigation menu