[RESOLVED] Control
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: [RESOLVED] Control

  1. #1
    Join Date
    Aug 2008
    Posts
    373

    [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..

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,271

    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

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    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.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Aug 2008
    Posts
    373

    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);
    
             }

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,271

    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
    Quote Originally Posted by Msm
    ... set time for One hour
    Victor Nijegorodov

  6. #6
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    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);
    
             }
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  7. #7
    Join Date
    Aug 2008
    Posts
    373

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center