Automatic dialog box refreshing 
Author Message
 Automatic dialog box refreshing

The best place is at the end of the OnInitDialog handler. You can add this
handler using the MFC Wizard.

Good luck !


Quote:
> I'm not very used to MFC and this problem drived me crazy
> during the whole week-end... please you MFC gurus, help
> me !

> My app is a dialog box which calls another dialog box
> ("myDialog") with the following command :

> myDialog.DoModal();

> Once "myDialog" is displayed I want it to display some
> strings that are in an array (let say 10 elements), but
> one string every second. My problem is I don't know when
> to start my refresh loop.
> How do I know that the dialog box is ready ? Can't find
> the appropriate WM message.
> I thought I could respond to some WM_IDLE, but I can't
> find such messages for a DialogBox.
> I tried WM_PAINT, but as I supposed, display occurs only
> when the whole array is parsed and therefore, only the
> last string is displayed after 10 seconds.
> I also tried to start refreshing after the user clicked on
> some button, it worked fine because I had the callback
> On_ButtonCLick in which I could put my refresh loop.
> But I want the refreshing to start as soon as the dialog
> is shown. What callback or WM message should I respond to ?

> Thanks for your help,
> Guillaume.



Fri, 06 May 2005 12:14:14 GMT  
 Automatic dialog box refreshing
Thanks for your answer, but I tried your solution and it
didn't work. I got the same result: Only the last string
is displayed. This behavior accords with the MFC wizard
that indicates "Sent to a ialog box before thealog box is
displayed". So I think this callback is not appropriate.

Did I done wrong ?
Is there another solution ?

Guillaume.

Quote:
>-----Original Message-----
>The best place is at the end of the OnInitDialog

handler. You can add this
Quote:
>handler using the MFC Wizard.

>Good luck !



>> I'm not very used to MFC and this problem drived me
crazy
>> during the whole week-end... please you MFC gurus, help
>> me !

>> My app is a dialog box which calls another dialog box
>> ("myDialog") with the following command :

>> myDialog.DoModal();

>> Once "myDialog" is displayed I want it to display some
>> strings that are in an array (let say 10 elements), but
>> one string every second. My problem is I don't know
when
>> to start my refresh loop.
>> How do I know that the dialog box is ready ? Can't find
>> the appropriate WM message.
>> I thought I could respond to some WM_IDLE, but I can't
>> find such messages for a DialogBox.
>> I tried WM_PAINT, but as I supposed, display occurs
only
>> when the whole array is parsed and therefore, only the
>> last string is displayed after 10 seconds.
>> I also tried to start refreshing after the user
clicked on
>> some button, it worked fine because I had the callback
>> On_ButtonCLick in which I could put my refresh loop.
>> But I want the refreshing to start as soon as the
dialog
>> is shown. What callback or WM message should I respond
to ?

>> Thanks for your help,
>> Guillaume.

>.



Fri, 06 May 2005 21:18:38 GMT  
 Automatic dialog box refreshing
Simplest thing I can think of, if I understood you correctly, is to
provide your own OnShow event handler (in your myDialog class). Check
that bShow is true (dialog is being displayed).

Create a timer in your dialog at this point (SetTimer(...)) (possibly
with an initial delay to give the dialog time to display). To handle
the timer you need write an OnTimer event handler (for your myDialog
class) and check for your timer's ID and then keep updating your
display when the timer fires. Don't forget to call KillTimer(ID) when
the last element has been displayed.

Hope this helps.

--Martin

Quote:

> Thanks for your answer, but I tried your solution and it
> didn't work. I got the same result: Only the last string
> is displayed. This behavior accords with the MFC wizard
> that indicates "Sent to a ialog box before thealog box is
> displayed". So I think this callback is not appropriate.

> Did I done wrong ?
> Is there another solution ?

> Guillaume.

> >-----Original Message-----
> >The best place is at the end of the OnInitDialog
>  handler. You can add this
> >handler using the MFC Wizard.

> >Good luck !



> >> I'm not very used to MFC and this problem drived me
>  crazy
> >> during the whole week-end... please you MFC gurus, help
> >> me !

> >> My app is a dialog box which calls another dialog box
> >> ("myDialog") with the following command :

> >> myDialog.DoModal();

> >> Once "myDialog" is displayed I want it to display some
> >> strings that are in an array (let say 10 elements), but
> >> one string every second. My problem is I don't know
>  when
> >> to start my refresh loop.
> >> How do I know that the dialog box is ready ? Can't find
> >> the appropriate WM message.
> >> I thought I could respond to some WM_IDLE, but I can't
> >> find such messages for a DialogBox.
> >> I tried WM_PAINT, but as I supposed, display occurs
>  only
> >> when the whole array is parsed and therefore, only the
> >> last string is displayed after 10 seconds.
> >> I also tried to start refreshing after the user
>  clicked on
> >> some button, it worked fine because I had the callback
> >> On_ButtonCLick in which I could put my refresh loop.
> >> But I want the refreshing to start as soon as the
>  dialog
> >> is shown. What callback or WM message should I respond
>  to ?

> >> Thanks for your help,
> >> Guillaume.

> >.



Sat, 07 May 2005 11:19:33 GMT  
 Automatic dialog box refreshing
#define IDT_SHOW 1 // or some other random number

BOOL CMyDialog::OnInitDialog()
   {
    ... usual stuff
    StartTimer(IDT_SHOW, 1000, NULL);
    ... usual stuff
  }

void CMyDialog::OnTimer(UINT nTimerId, ....assorted stuff here...)
   {
    switch(nTimerId)
        { /* nTimerId */
         case IDT_SHOW:
                c_MyControl.SetWindowText(strings[i]);
                i++;
                if(i > ...some limit of your choice...)
                   { /* all done */
                     KillTimer(IDT_SHOW)
                    } /* all done */
         } /* nTimerId */
    }

Quote:

>The best place is at the end of the OnInitDialog handler. You can add this
>handler using the MFC Wizard.

>Good luck !



>> I'm not very used to MFC and this problem drived me crazy
>> during the whole week-end... please you MFC gurus, help
>> me !

>> My app is a dialog box which calls another dialog box
>> ("myDialog") with the following command :

>> myDialog.DoModal();

>> Once "myDialog" is displayed I want it to display some
>> strings that are in an array (let say 10 elements), but
>> one string every second. My problem is I don't know when
>> to start my refresh loop.
>> How do I know that the dialog box is ready ? Can't find
>> the appropriate WM message.
>> I thought I could respond to some WM_IDLE, but I can't
>> find such messages for a DialogBox.
>> I tried WM_PAINT, but as I supposed, display occurs only
>> when the whole array is parsed and therefore, only the
>> last string is displayed after 10 seconds.
>> I also tried to start refreshing after the user clicked on
>> some button, it worked fine because I had the callback
>> On_ButtonCLick in which I could put my refresh loop.
>> But I want the refreshing to start as soon as the dialog
>> is shown. What callback or WM message should I respond to ?

>> Thanks for your help,
>> Guillaume.

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Mon, 09 May 2005 05:32:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Refresh Dialog box???

2. How to refresh my dialog box whenever it gets focus after changes in Registry

3. How to refresh/update modeless dialog box appearance..?

4. Automatic refreshing values in PropertyGrid

5. Automatic refresh of datagrid for client machines

6. Automatic, periodoc view refresh

7. Refresh one Dialog after pressing OK in an other dialog

8. Modeless dialog box together with modal dialog box

9. activating a button on a dialog box from a dialog box

10. Dialog box in a dialog box

11. transfer data from one dialog box to another dialog box

12. PBM: Message box not displayed after main dialog box is closed in MFC dialog-based app

 

 
Powered by phpBB® Forum Software