Solved

CPropertyPage refresh THEN do a dialog.domodal()

Posted on 2000-03-19
6
548 Views
Last Modified: 2013-11-20
I have two property pages in a ps, Tab1 and Tab2. I want a dialog to do a .domodal() when tab1 is set active. Logically I put the domodal in the OnSetActive function of Tab1. The problem is when I switch from tab2 to tab1, the .domodal is called and the dialog displays, but the background still shows tab2. I must have tab1 completely refreshed before the dialog does its .domodal. I've tried placing it in several places to no avail. Please help, thanks.
0
Comment
Question by:Dredwick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2634632
Post yourself a user defiend (registered?) message in the OnSetActive.

In the handler for that message, pop up the dialog (DoModal etc).

That way, all the events that need to be processed to made tab1 active and visible will be done before the dialog pops up and gets in the way.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2634646
That was an answer
0
 
LVL 8

Expert Comment

by:VinExpert
ID: 2634649
Hi,

Or, At the end of that function, set the timer using
SetTimer(1, 100, NULL);

Then map the WM_TIMER message to that page, and do the DoModal() there as

....::OnTimer(...)
{
KillTimer(1);
......DoModal();
.....
.....
}

Try it out.

VinExpert
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Dredwick
ID: 2638557
I've tried the Timer method, and I really thought the PostMessage routine would work, but alas...it didn't. Both run into the same problem. When the routine that is called by the Post returns, it generates an access violation. I've got some theories on this...

I actually came up with the solution on my own. I had to derive a UI Thread class from CWinThread and to an AfxBeginThread(RUNTIME_CLASS(CUIThread));

and that popped up a test message box, and closed without any fuss, which crashed the previous two methods. The other two methods DID work under debug mode, but that is obvious why..

Thanks anyways for the help and suggestions!
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2638566
Why is it 'obvious'?
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 50 total points
ID: 2638597
Sounds like you didn't do the suggested method correctly.

I'd like to see your code please.

Creating a thread is not good .. because the dialog won't be modal .. and threads can be problem.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 97
How to convert MFC::CString to UTF8 wchar_t* 10 446
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 133
Problem to open Excel file 15 258
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…
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…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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