CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Jul 2002
    Posts
    30

    dialog box function problem

    Hello people. I have the following very easy problem:
    After pressing a button a dialog box appears. I want this dialog box to automatically do a StepIt() (CprogressCtrl) and then to be released when the user presses the Ok button.
    Is there a function that is called after the dialog box is created so I can perform my task?
    Thank you in advanced!

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: dialog box function problem

    Not sure what you are looking for here. Is the progress control located in the dialog? What happens when the user presses okay? Does the dialog go away or does the progress control get incremented?

    Arjay

  3. #3
    Join Date
    Jul 2002
    Posts
    30

    Re: dialog box function problem

    Suppose a dialog box.When you press button "foo" a new dialog appears.
    This new dialog has a progress control and an OK button.
    I want this new dialog to automatically do something (stepit()) to the progress control and wait until ok is pressed.

    (foo button is pressed)

    newwindow bar;
    bar.DoModal(); -> i want here the new dialog to automatically StepIt() (the progress control) and wait until the ok button is pressed!
    Thanks!

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: dialog box function problem

    Quote Originally Posted by tasoss
    Suppose a dialog box.When you press button "foo" a new dialog appears.
    This new dialog has a progress control and an OK button.
    I want this new dialog to automatically do something (stepit()) to the progress control and wait until ok is pressed.

    (foo button is pressed)

    newwindow bar;
    bar.DoModal(); -> i want here the new dialog to automatically StepIt() (the progress control) and wait until the ok button is pressed!
    Thanks!
    This still doesn't make sense. Step it how many times? I believe the upper limit is 64K, which would occur before the user could get their mouse anywhere near the okay button. Please, tell us exactly what you want to do. Holding back information doesn't help you, and it wastes everybody else's time.

  5. #5
    Join Date
    Jul 2002
    Posts
    30

    Re: dialog box function problem

    Maybe my english are very bad...
    I'm trying to learn the progress control.I may have a for loop and stepit 10 times.Why does it matter?
    I don't want to waste your time really but i made it as simple as it could be.
    When the new dialog box appears it has a progress control and an OK button.
    You could implement a button like "test progress" which would call stepit so i can see how progress control works!!!!
    Instead of that i want this action to be performed automatically after
    newwindow bar;
    bar.DoModal();
    that.

    Really,sorry for bothering i hope someone will understand my question it's so simple really.
    ps:i'm searching,maybe, for a function ,like OnInitDialog(), which is called after the dialog is created and the controls are placed in the dialog!

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: dialog box function problem

    My point was that in a tight loop, the steps would go by so quickly you couldn't possibly do what you're asking. If you just want to play and learn, your best bet would be to set up a button, that when pressed, calls StepIt() once, so you can watch it.

  7. #7
    Join Date
    Apr 2000
    Location
    Boston
    Posts
    124

    Re: dialog box function problem

    OnInitDialog is the right place to step the control before the dialog is displayed.
    Code:
    BOOL newwindow::OnInitDialog() 
    {
    	CDialog::OnInitDialog();
    	
    	m_ProgressCtrl.StepIt();
    	
    	return TRUE;  // return TRUE unless you set the focus to a control
    	              // EXCEPTION: OCX Property Pages should return FALSE
    }
    I agree with GCDEF that you will learn more about the progress control using buttons.

  8. #8
    Join Date
    Jul 2002
    Posts
    30

    Re: dialog box function problem

    OnInitDialog is the right place to step the control before the dialog is displayed.

    Ok suppose you want to step it AFTER the dialog is displayed(using a ::Sleep) so you can see what is going on?
    (or suppose, you generally want to do something AFTER the dialog is displayed)
    Thanks again!!!

  9. #9
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: dialog box function problem

    Quote Originally Posted by tasoss
    OnInitDialog is the right place to step the control before the dialog is displayed.

    Ok suppose you want to step it AFTER the dialog is displayed(using a ::Sleep) so you can see what is going on?
    (or suppose, you generally want to do something AFTER the dialog is displayed)
    Thanks again!!!
    You're not listening.

  10. #10
    Join Date
    Apr 2000
    Location
    Boston
    Posts
    124

    Re: dialog box function problem

    Quote Originally Posted by tasoss
    Ok suppose you want to step it AFTER the dialog is displayed(using a ::Sleep) so you can see what is going on?
    (or suppose, you generally want to do something AFTER the dialog is displayed)
    Here is where a button in your newwindow class will help. Add the button and handle the BN_CLICK message to step the control. If you really want it to step the control without toucking it, look at the OnTimer function.

  11. #11
    Join Date
    Jul 2002
    Posts
    30

    Re: dialog box function problem

    Ok,thank you all!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured