Click here to Skip to main content
15,891,204 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Scroll in CRichEditView Pin
LEE HO JUN21-Feb-01 14:01
LEE HO JUN21-Feb-01 14:01 
General%cpu usage per process on Win9x OS Pin
trilok_soni20-Feb-01 21:18
trilok_soni20-Feb-01 21:18 
GeneralWorking with IE Pin
Stefan Dahlin20-Feb-01 20:28
Stefan Dahlin20-Feb-01 20:28 
QuestionHow to get ip address & hostname? Pin
hahyojin20-Feb-01 20:08
hahyojin20-Feb-01 20:08 
AnswerRe: How to get ip address & hostname? Pin
Rene D20-Feb-01 20:16
Rene D20-Feb-01 20:16 
GeneralRe: How to get ip address & hostname? Pin
hahyojin20-Feb-01 20:38
hahyojin20-Feb-01 20:38 
GeneralRe: How to get ip address & hostname? Pin
Halid Niyaz25-Jan-02 2:41
Halid Niyaz25-Jan-02 2:41 
GeneralObject Orientated Nightmare Pin
Brendan Tregear20-Feb-01 14:03
Brendan Tregear20-Feb-01 14:03 
Recently I've been designing my document structure. I have to save a list of patients, each with a list of consultations, each with a list of images, each with a list of annotations, etc. My UML looks roughly like this:

CMyDoc
------
[list]CPatient
CString rootDir

CPatient
--------
[list]CVisit
CString firstName
CString lastName
...

CVisit
------
[list]CImageDoc
COleDateTime date

CImageDoc
---------
CWinBmop * bmp
[list]CAnnotaiton

etc. etc.

But this high level of nesting is making things very messy. For instance just to find at which index the currently selected index is, one of my functions is:

int CPatientView::GetVisitIndex(CString name, int parent)
{
CSOFIDoc * pDoc = (CSOFIDoc*) GetDocument();
CObArray * pPatientList = (CObArray*) pDoc->GetPatientList();
CPatient * pPatient = (CPatient*) pPatientList->GetAt(parent);
CObArray * pVisitList = (CObArray*) pPatient->GetVisitList();

for (int i=0; i < pVisitList->GetSize(); i++) {
CVisit * pVisit = (CVisit*) pVisitList->GetAt(i);
if (pVisit->GetPath() == name)
return i;
}
}

Now I'm no system architect, but i reckon that's just too messy and prone to errors Frown | :( and I'm not even at the ImageDoc level!. Anyone give me some broad ideas at how I can make things simpler and neater?

Thanks for any help Smile | :)
GeneralRe: Object Orientated Nightmare Pin
20-Feb-01 15:39
suss20-Feb-01 15:39 
GeneralRe: Object Orientated Nightmare Pin
l a u r e n20-Feb-01 23:13
l a u r e n20-Feb-01 23:13 
GeneralRe: Object Orientated Nightmare Pin
Erik Funkenbusch21-Feb-01 12:59
Erik Funkenbusch21-Feb-01 12:59 
GeneralRe: Object Orientated Nightmare Pin
Mr Morden21-Feb-01 19:32
Mr Morden21-Feb-01 19:32 
GeneralRe: Object Orientated Nightmare Pin
Mr Morden21-Feb-01 19:38
Mr Morden21-Feb-01 19:38 
GeneralCListBox Pin
Vickie20-Feb-01 7:52
Vickie20-Feb-01 7:52 
GeneralRe: CListBox Pin
20-Feb-01 8:12
suss20-Feb-01 8:12 
Generalextracting numbers from CString Pin
20-Feb-01 7:20
suss20-Feb-01 7:20 
GeneralRe: extracting numbers from CString Pin
l a u r e n20-Feb-01 23:08
l a u r e n20-Feb-01 23:08 
QuestionImplementing waitable timers with timeouts ? Pin
20-Feb-01 0:28
suss20-Feb-01 0:28 
AnswerRe: Implementing waitable timers with timeouts ? Pin
l a u r e n20-Feb-01 1:24
l a u r e n20-Feb-01 1:24 
AnswerRe: Implementing waitable timers with timeouts ? Pin
Erik Funkenbusch21-Feb-01 13:02
Erik Funkenbusch21-Feb-01 13:02 
GeneralProperty pages get PSN_KILLACTIVE when edit control changed Pin
Dave Midgley19-Feb-01 22:59
Dave Midgley19-Feb-01 22:59 
GeneralADO Recordset not showing changes just made... Pin
Paul Wolfensberger19-Feb-01 15:34
Paul Wolfensberger19-Feb-01 15:34 
GeneralRe: ADO Recordset not showing changes just made... Pin
l a u r e n19-Feb-01 20:27
l a u r e n19-Feb-01 20:27 
GeneralRe: ADO Recordset not showing changes just made... Pin
Paul Wolfensberger20-Feb-01 2:48
Paul Wolfensberger20-Feb-01 2:48 
GeneralRe: ADO Recordset not showing changes just made... Pin
John M. Drescher20-Feb-01 18:19
John M. Drescher20-Feb-01 18:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.