Changes

Jump to: navigation, search

Console Framework Classes 20103 - OOP344

2,105 bytes added, 09:48, 16 November 2010
m
FWValEdit
==FWValEdit==
ValEdit is a LineEdit that uses two remote functions (using pointer to functions) to provide help and validation service in addition to what LineEdit does.
 
===Class Definition===
<big><syntaxhighlight lang="cpp">
};
</syntaxhighlight></big>
 
 
===Attributes===
<big><pre>
void (*_help)(MessageStatus, FWDialog&);
bool (*_validate)(const char*, FWDialog&);
</pre></big>
Pointers to keep the address of possible help and validation function.<br />
''Note that if these two are NULL, then ValEdit works exactly like LineEdit''
===Methods===
<big><pre>
FWValEdit(char* Str, int Row, int Col, int Width,
int Maxdatalen, int* Insertmode,
bool (*Validate)(const char* , FWDialog&) = NO_VALDFUNC,
void (*Help)(MessageStatus, FWDialog&) = NO_HELPFUNC,
bool Bordered = false,
const char* Border=FW_BORDER_CHARS);
FWValEdit(int Row, int Col, int Width,
int Maxdatalen, int* Insertmode,
bool (*Validate)(const char* , FWDialog&) = NO_VALDFUNC,
void (*Help)(MessageStatus, FWDialog&) = NO_HELPFUNC,
bool Bordered = false,
const char* Border=FW_BORDER_CHARS);
</pre></big>
They Pass the arguments to corresponding parents constructor.<br />
Then they Set '''_validate''' and '''_help''' attributes to their corresponding values in argument list.
<big><pre>
int edit();
</pre></big>
If the container() is NULL then this function works exactly like LineEdit::edit().
If the container() is not NULL,
#If _help function exist it calls is passing MessageStatus::SetMessage and container()'s reference as arguments.
#Calls LineEdit's edit()
#If validation function exists and the terminating key of LineEdit's edit() is a navigation key(see below)
#:It will call the validation function on the Field's _data, if the data is valid, it goes to next step, otherwise it will repeat calling LineEdit's edit()
#After validation is done, if _help function exists, it will recall the help function using MessageStatus::ClearMessage and contianer()'s reference as arguments.
#It will return the terminating key
 
''Navigation keys are Up key, Down key, Tab key or Enter key.''<br />
''MessageStatus is enumerated in confw.h'''
===Validated Line editor Tester===
[[Validated LineEdit Tester - OOP344 20103 | FWValEditTester.cpp]]

Navigation menu