For the first part of our team assignment I did this three functions...
1.
void CDialog::draw(int fn = C_FULL_FRAME){
if(fn == C_FULL_FRAME){ //If fn is C_FULL_FRAME
CFrame::draw(); //it will call its parent draw. Then It will draw all the Fields in the Dialog.
} // it will call its parent draw. Then It will draw all the Fields in the Dialog.
if(fn != C_FULL_FRAME){ // If fn is not C_FULL_FRAME
for (int i = 0; i < _fnum; i++){
_fld[i]->draw; // then it will just draw all the Fields in the Dialog.
}
}
if(fn > 0){ // If fn is a non-zero positive value
_fld[(fn-1)%_fnum]->draw(); // then it will only draw Field number fn in the dialog.
}
}
2.
CLabel::CLabel(const CLabel& L):CField(L){
if(this!=&L){
width(L.width());
if(L._data){
_data = new char[strlen((char*)L._data+1)];
strcpy(_data,L._data);
}
else{
_data = (char*)0;
}
}
}
3.
void CLabel::set(const void* str){
if(width() > 0){ //if width() is greater than zero
strncpy((char*)_data, (char*)str, width());
((char*)_data)[width()] = 0;
}
if(width() == 0){
delete [] _data;
_data = new char[len+1];
strcpy((char*)_data, (char*)str);
}
}
==========
Probably they have several few mistakes which were changed in final team project.
1.
void CDialog::draw(int fn = C_FULL_FRAME){
if(fn == C_FULL_FRAME){ //If fn is C_FULL_FRAME
CFrame::draw(); //it will call its parent draw. Then It will draw all the Fields in the Dialog.
} // it will call its parent draw. Then It will draw all the Fields in the Dialog.
if(fn != C_FULL_FRAME){ // If fn is not C_FULL_FRAME
for (int i = 0; i < _fnum; i++){
_fld[i]->draw; // then it will just draw all the Fields in the Dialog.
}
}
if(fn > 0){ // If fn is a non-zero positive value
_fld[(fn-1)%_fnum]->draw(); // then it will only draw Field number fn in the dialog.
}
}
2.
CLabel::CLabel(const CLabel& L):CField(L){
if(this!=&L){
width(L.width());
if(L._data){
_data = new char[strlen((char*)L._data+1)];
strcpy(_data,L._data);
}
else{
_data = (char*)0;
}
}
}
3.
void CLabel::set(const void* str){
if(width() > 0){ //if width() is greater than zero
strncpy((char*)_data, (char*)str, width());
((char*)_data)[width()] = 0;
}
if(width() == 0){
delete [] _data;
_data = new char[len+1];
strcpy((char*)_data, (char*)str);
}
}
==========
Probably they have several few mistakes which were changed in final team project.
No comments:
Post a Comment