Click here to Skip to main content
15,920,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: troubles on using scroll bar in frame Pin
Christian Graus31-Jul-05 15:58
protectorChristian Graus31-Jul-05 15:58 
GeneralRe: troubles on using scroll bar in frame Pin
firebolt7731-Jul-05 16:16
firebolt7731-Jul-05 16:16 
GeneralRe: troubles on using scroll bar in frame Pin
Christian Graus31-Jul-05 16:20
protectorChristian Graus31-Jul-05 16:20 
GeneralRe: troubles on using scroll bar in frame Pin
firebolt7731-Jul-05 16:38
firebolt7731-Jul-05 16:38 
Generala very looooong integer Pin
knapak28-Jul-05 15:34
knapak28-Jul-05 15:34 
GeneralRe: a very looooong integer Pin
Christian Graus28-Jul-05 15:40
protectorChristian Graus28-Jul-05 15:40 
GeneralRe: a very looooong integer Pin
Bob Stanneveld28-Jul-05 19:14
Bob Stanneveld28-Jul-05 19:14 
GeneralProblem with Multiple Views (SDI APplication). Pin
Faheem8228-Jul-05 11:47
Faheem8228-Jul-05 11:47 
Hello all.

As an assignment, I'm trying to design front end for a database prepared in Ms Access using Visual C++. I'm using ODBC.

I'm designing an SDI Application with Multiple Views. The parent view is "Employee" and the child view is details about "core Staff members", if an employee is a Core staff member, clicking the button for "Core Staff" takes you to another view, with details regarding the employee. This child view has a button which takes you back to the parent view, say "Employee View".

Now, the problem is that when I click the "Core Staff" button, I get the new view if the current employee is a core staff member, but the problem is that the new view is "un-clickable" I cant click anything, If I try clicking something the window freezes on me. I can however navigate through the fields using the tab key, or the short cut keys. However, when I select the "EMployee View" button and press enter, I get the message for Invalid View ID, which is supposed to be displayed if the "View doesnt exist".

Here's the code for the "SelectView" function in the CMainFrame class.

[code]
void CMainFrame::SelectView(UINT ViewID)
{
CView* pOldActiveView = GetActiveView();

CView* pNewActiveView = (CView*)GetDlgItem(ViewID);

if(pNewActiveView == NULL)
{
switch(ViewID)
{
case CORE_VIEW:
pNewActiveView = (CView*)new CCoreView;
break;
default:
AfxMessageBox("Invalid View ID");
return;
}

CCreateContext context;
context.m_pCurrentDoc = pOldActiveView->GetDocument();

pNewActiveView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault,this,ViewID,&context);


pNewActiveView->OnInitialUpdate();
}

if(ViewID == CORE_VIEW && ! ((CCoreView*)pNewActiveView)->IsCore())
{
AfxMessageBox("Current Employee is not a Core Staff Member");
return;
}


SetActiveView(pNewActiveView);
pOldActiveView->ShowWindow(SW_HIDE);
pNewActiveView->ShowWindow(SW_SHOW);
pOldActiveView->SetDlgCtrlID(m_CurrentViewID);
pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
m_CurrentViewID = ViewID;

RecalcLayout();
}

[/code]

The code for the Button on the "Employee View" is:

[code]

((CMainFrame*)GetParentFrame())->SelectView(CORE_VIEW);

[/code]

Similarly, the code for the button on the "Core VIew" is:

[code]

((CMainFrame*)GetParentFrame())->SelectView(EMPLOYEE_VIEW);

[/code]


I'm following "Ivor Horton's" "Beginning Visual C++6". Since, the "Parent View" alread exists, GetDlgItem() should return the address of the view, otherwise return Null.

I dont know whats wrong here.

Can anyone please help?

Thanks
and here are the screenies.

EMPLOYEE VIEW

[img]http://img196.imageshack.us/img196/282/employee9ps.jpg[/img]

CORE VIEW

[img]http://img211.imageshack.us/img211/7392/core5nq.jpg[/img]

Thanks again.
QuestionWhat port is GetPeerName returning? Pin
lihin0028-Jul-05 9:21
lihin0028-Jul-05 9:21 
AnswerRe: What port is GetPeerName returning? Pin
Alexander M.,28-Jul-05 9:29
Alexander M.,28-Jul-05 9:29 
GeneralRe: What port is GetPeerName returning? Pin
lihin0028-Jul-05 9:36
lihin0028-Jul-05 9:36 
Questionsndvol32? Pin
billiam90428-Jul-05 8:57
billiam90428-Jul-05 8:57 
AnswerRe: sndvol32? Pin
Alexander M.,28-Jul-05 9:06
Alexander M.,28-Jul-05 9:06 
GeneralRe: sndvol32? Pin
billiam90428-Jul-05 9:10
billiam90428-Jul-05 9:10 
GeneralRe: sndvol32? Pin
Alexander M.,28-Jul-05 9:14
Alexander M.,28-Jul-05 9:14 
Generaltimeout for while loop Pin
trigger9128-Jul-05 8:53
susstrigger9128-Jul-05 8:53 
GeneralRe: timeout for while loop Pin
Alexander M.,28-Jul-05 8:57
Alexander M.,28-Jul-05 8:57 
GeneralRe: timeout for while loop Pin
trigger9128-Jul-05 9:33
susstrigger9128-Jul-05 9:33 
GeneralRe: timeout for while loop Pin
Alexander M.,29-Jul-05 4:26
Alexander M.,29-Jul-05 4:26 
GeneralRe: timeout for while loop Pin
Peter Weyzen28-Jul-05 9:46
Peter Weyzen28-Jul-05 9:46 
GeneralRe: timeout for while loop Pin
Alexander M.,29-Jul-05 4:25
Alexander M.,29-Jul-05 4:25 
GeneralRe: timeout for while loop Pin
David Crow29-Jul-05 6:03
David Crow29-Jul-05 6:03 
GeneralRe: timeout for while loop Pin
nm_11429-Jul-05 14:16
nm_11429-Jul-05 14:16 
Generalread from comport problem Pin
quarry_0628-Jul-05 8:42
quarry_0628-Jul-05 8:42 
GeneralRe: read from comport problem Pin
Bob Stanneveld28-Jul-05 19:19
Bob Stanneveld28-Jul-05 19: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.