Changes

Jump to: navigation, search

Console Framework Classes 20103 - OOP344

701 bytes added, 20:26, 15 November 2010
Methods
</pre></big>
When creating a Button, allocate enough memory to hold the contents of the '''Str''' and set Field's _data to point to it. Then copy the content of '''Str''' into the newly allocated memory.<br />
Pass all the arguments directly to Field's constructor. <br />For Field size (width and hight) do the following:<br />
For width: Set width to the length of '''Str''' + 2 (adding 2 for surrounding brackets) or if the Button is bordered set width to the length of '''Str''' + 4 (adding 2 for surrounding brackets and 2 for the borders).
For height: Set the height to 1 or if the Button is bordered, set the height to 3.
<big><pre>
~FWButton();
void draw(int Refresh = FW_NO_REFRESH) const;
</pre></big>
*First calls Border's draw()use iol_display to display the Button's text (pointed by Field's _data)*If not bordered*:display the text at absRow() and absCol()*If bordered*:display the text at absRow()+1 and absCol()+2
<big><pre>
int edit();
</pre></big>
First draw() the Button, then surround it by squared brackets, place the cursor under the first character of Button's text and wait for user entry.<br />When user hits a key, if the key is ENTER_KEY or SPACE, return FW_BUTTON_HIT (defined in confw.h) otherwise return the entered key.<br />Make sure the surrounding characters are replace with spaces before exiting the edit() method.
<big><pre>
bool editable()const;

Navigation menu