Changes

Jump to: navigation, search

IO Edit TIP

2,243 bytes added, 11:51, 5 January 2010
no edit summary
In my group [http://zenit.senecac.on.ca/wiki/index.php/OOP344_Temporary Team Temporary], I am responsible for the IO_Edit class with some others and thoughtit thought it might be helpful to share part of what I have done to get it to work.
int IO_Edit::edit(void){
Information on vedit and frame will be added soon.
Ausley Johnson
 
As promised, here are some additional information:
 
Normal 0 false false false EN-US X-NONE X-NONE
 
RESOPNSE TO QUESTIONS BY FELLOW STUDENTS
 
Note: void(*_help)(messageStatus,IO_Form)
 
The above “_help” is a pointer to a function or logic that are passed the two arguments.
 
You use it like the following way:
 
(_Help)(ClearMessage, (*_owner));
 
Note: “*_owner” is a pointer to a form which controls all the fields and the fact that everything is done on a particular form, you have to be able to refer to it.
 
Note:”ClearMessage” is a value withing the enum list which is declared in iodef.
 
Note: The function logic has to be defined so that it processes the information passed to it. In this case, it gives a help message or clears the printed message at a particular location on the form. Help message might be date must be between a particular time.
 
Bool (*_Validate)((char*)_data.(*_owner));
 
Like help, this points to a logic that validates an entry. You also have to define the logic. What ever you want to validate that your form receives. The date etc.
 
You call it like above “_help” passing an address to the data entered and the form that is being used.
 
 
Question was: Do you initialize the pointer to the function logic? Yes
 
How:
 
bool (*Validate)(const char* , IO_Form&) = ((void(*)(MessageStatus, IO_Form&))(0))
 
Note: NO_FUNC is defined in iodef which initializes the “*Validate”
 
So you simply do within the class declaration
 
bool (*Validate)(const char* , IO_Form&) = NO_FUNC;
REMEMBER to include iodef.h.
 
Qusetion: How to use IO_Vedit display?
 
Ans: Since vedit inherits edit, you simply call the display of edit which is the working class. Vedit is simply for validation and for help messages. Therefore the arguments passed to vedit constructor must be passed onto edit and when you are requested to edit you do the following:
IO_Edit::edit();//The display code is within this function which makes editing possible.
 
Note: The pointer to data in iofield does not need dynamic memory allocation from within that class. It simply holds the address for location already allocated memory within ioedit. Therefor “IO_Field::_data = data.”
 
Ausley Johnson
1
edit

Navigation menu