Solved

Cview class calling Function in Dlg.

Posted on 2000-04-20
3
294 Views
Last Modified: 2013-11-20
in my CScrollView i need to display back the old values to the dialog box. so if the g_bTestFeed is checked, it will call a function in the dialog class. however, problem aries as the m_WithLoad is pointed to null as i step through the program.

void CHpisView::PreviewCancel()
{
    CCancelBtn dlg;
    if (pTempCancel->g_bTestFeed)
        dlg.OnTestFeed();
//if the above 2 lines are commented no problem aries
    if (dlg.DoModal() == IDOK)
    {........}
}

-----------

void CCancelBtn::OnTestFeed()
{
bTestFlag = !bTestFlag;
m_WithLoad.EnableWindow(bTestFlag); //m_WithLoad pointed to NULL
}

i discovered that if the function is not called, no problem aries, m_WithLoad is not pointed to null . so what should be the correct method or function to be included to solve this problem.
0
Comment
Question by:nasty101
3 Comments
 
LVL 5

Expert Comment

by:proskig
Comment Utility
What is m_WithLoad? How do you initialize it?
0
 
LVL 30

Accepted Solution

by:
Zoppo earned 30 total points
Comment Utility
Hi nasty101,

you cannot use control attached members of a dialog like this before the dialog is create (which is done by DoModal()), because the control which is represantated by m_WithLoad simply isn't created yet. You'll have to implement a flag as member of the dialog, set this to TRUE of FALSE in PreviewCancel() before DoModal() and call the m_WithLoad.EnableWindow() with this flag in CCancelBtn::OnInitDialog().

hope that helps,

ZOPPO
0
 

Author Comment

by:nasty101
Comment Utility
thx. your solution is greatly appreciated.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 67
maxBlock challenge 30 99
fizzArray  challenge 1 47
scoreUp challenge 14 48
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now