Solved

Cview class calling Function in Dlg.

Posted on 2000-04-20
3
301 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
ID: 2733860
What is m_WithLoad? How do you initialize it?
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 30 total points
ID: 2733932
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
ID: 2742598
thx. your solution is greatly appreciated.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 65
deburging in oracle form 12 87
How to know only "File created" with EventLog 3 32
string initialization in java 11 109
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

947 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

20 Experts available now in Live!

Get 1:1 Help Now