-
January 5th, 2011, 01:49 AM
#1
[RESOLVED] Control
Hi all
I have stranger problem in dialog box Control disappear from dialog.There is no issue of memory and cpu uses,both are normal.I want to know what reason behind this situation?
Please help me..
-
January 5th, 2011, 02:13 AM
#2
Re: Control
And I have strange problem the left head light of my car sometimes disappears. There is no issue of accu battery and engine uses,both are normal.I want to know what reason behind this situation?
Please help me..
Victor Nijegorodov
-
January 5th, 2011, 02:15 AM
#3
Re: Control
Imagine you go to a doctor and say: "Doc, I'm sick. I want to know why." What answer do you think you'll get?
Please explain what control, when does it disappear, etc. etc. Someone is probably hiding the control.
-
January 5th, 2011, 02:29 AM
#4
Re: Control
Sorry
I have a dialog A and modless dialog B.Modless Dialog B call on button click of Dialog A.I use timer to show Watch in Modless dialog B.When i set time for One hour then this thing is happen.Conrtols are Button,Check Box,Static Box from Main Dialog A.
Code:
extern CStatic m_settime;
CdialogADlg* test;
void CdialogADlg::OnBnClickedCall()
{
m_dialogB= new CdialogB(test);
m_dialogB->Create(CdialogB::IDD,0);
m_dialogB->CenterWindow(test);
m_dialogB->ShowWindow(SW_SHOW);
SetTimer(1,1000,0);
}
//Timer
void CdialogADlg::OnTimer(UINT_PTR nIDEvent)
{
if(nIDEvent==1)
{
m_settime.SetWindowText("Time start.");
}
CDialog::OnTimer(nIDEvent);
}
-
January 5th, 2011, 03:58 AM
#5
Re: Control
Very bad design.
Very bad code.
Don't touch any control of the dialog B from outside the dialog B.
Move OnTime() message handler from dialog A to dialog B.
Move SetTimer from dialog A to OnInitDialog method of the dialog B.
Besides:
1. your CdialogADlg* test; is not used, so why do you show it?
2. I don't see any place where you
Originally Posted by Msm
... set time for One hour
Victor Nijegorodov
-
January 5th, 2011, 04:17 AM
#6
Re: Control
In addition to what Victor said, when you use timers, catch the value returned by the SetTimer, that is the actual timer ID, not necessarily the value you passed as argument to SetTimer. In OnTimer, check the value of nIDEvent against it.
Code:
m_timerID = SetTimer(1,1000,0); // m_timerID is a member of CSomeDialog
void CSomeDialog::OnTimer(UINT_PTR nIDEvent)
{
if(nIDEvent==m_timerID)
{
}
CDialog::OnTimer(nIDEvent);
}
-
January 7th, 2011, 01:52 AM
#7
Re: Control
Thanks to all problem solved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|