Pausing between edit box writes - how to??? - Programmer

This is a discussion on Pausing between edit box writes - how to??? - Programmer ; I'm writing a VC++ 6.0 app. where I output messages on a text box using the CDialog class's DoDataExchange method. I do the following.... CString m_Display; m_Display = "First Display"; DoDataExchange(...) ::Sleep(4000); m_Display = "Second Display"; DoDataExchange(...); I expect to ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Pausing between edit box writes - how to???

  1. Pausing between edit box writes - how to???

    I'm writing a VC++ 6.0 app. where I output messages on a text box using
    the CDialog class's DoDataExchange method. I do the following....

    CString m_Display;
    m_Display = "First Display";
    DoDataExchange(...)
    ::Sleep(4000);
    m_Display = "Second Display";
    DoDataExchange(...);

    I expect to see "First Display", pause for 4secs, then "Second Display".
    However, I don't see the "First Display" at all - I just see a blank,
    and then "Second Display". What gives? What's another technique to do this?

    -Zilla



  2. Re: Pausing between edit box writes - how to???

    Zilla wrote:
    > I'm writing a VC++ 6.0 app. where I output messages on a text box using
    > the CDialog class's DoDataExchange method. I do the following....
    >
    > CString m_Display;
    > m_Display = "First Display";
    > DoDataExchange(...)
    > ::Sleep(4000);
    > m_Display = "Second Display";
    > DoDataExchange(...);
    >
    > I expect to see "First Display", pause for 4secs, then "Second Display".
    > However, I don't see the "First Display" at all - I just see a blank,
    > and then "Second Display". What gives? What's another technique to do this?
    >
    > -Zilla
    >
    >


    "What gives" is that the control can't paint itself when you are not
    pumping messages. Your main GUI thread should never do things that take
    a long time because during such times it stops pumping messages,
    freezing the GUI.

    If you create a control member variable (type CEdit) then you can call
    its SetWindowText function, followed by a call to UpdateWindow. This
    will make it paint immediately.


    --
    Scott McPhillips [VC++ MVP]


  3. Re: Pausing between edit box writes - how to???

    Scott McPhillips [MVP] wrote:
    > Zilla wrote:
    >
    >> I'm writing a VC++ 6.0 app. where I output messages on a text box
    >> using the CDialog class's DoDataExchange method. I do the following....
    >>
    >> CString m_Display;
    >> m_Display = "First Display";
    >> DoDataExchange(...)
    >> ::Sleep(4000);
    >> m_Display = "Second Display";
    >> DoDataExchange(...);
    >>
    >> I expect to see "First Display", pause for 4secs, then "Second
    >> Display". However, I don't see the "First Display" at all - I just
    >> see a blank, and then "Second Display". What gives? What's another
    >> technique to do this?
    >>
    >> -Zilla
    >>
    >>

    >
    > "What gives" is that the control can't paint itself when you are not
    > pumping messages. Your main GUI thread should never do things that take
    > a long time because during such times it stops pumping messages,
    > freezing the GUI.
    >
    > If you create a control member variable (type CEdit) then you can call
    > its SetWindowText function, followed by a call to UpdateWindow. This
    > will make it paint immediately.
    >
    >


    Thanks, I'll try this.

    -Zilla



  4. Re: Pausing between edit box writes - how to???

    Zilla wrote:
    > Scott McPhillips [MVP] wrote:
    >
    >> Zilla wrote:
    >>
    >>> I'm writing a VC++ 6.0 app. where I output messages on a text box
    >>> using the CDialog class's DoDataExchange method. I do the following....
    >>>
    >>> CString m_Display;
    >>> m_Display = "First Display";
    >>> DoDataExchange(...)
    >>> ::Sleep(4000);
    >>> m_Display = "Second Display";
    >>> DoDataExchange(...);
    >>>
    >>> I expect to see "First Display", pause for 4secs, then "Second
    >>> Display". However, I don't see the "First Display" at all - I just
    >>> see a blank, and then "Second Display". What gives? What's another
    >>> technique to do this?
    >>>
    >>> -Zilla
    >>>
    >>>

    >>
    >> "What gives" is that the control can't paint itself when you are not
    >> pumping messages. Your main GUI thread should never do things that
    >> take a long time because during such times it stops pumping messages,
    >> freezing the GUI.
    >>
    >> If you create a control member variable (type CEdit) then you can call
    >> its SetWindowText function, followed by a call to UpdateWindow. This
    >> will make it paint immediately.
    >>
    >>

    >
    > Thanks, I'll try this.
    >
    > -Zilla
    >
    >


    Ok I was successful with this. Now how can I make the CEdit class
    recognize \n\r escape sequence for line feed and carriage return?

    -Zilla



  5. Re: Pausing between edit box writes - how to???

    Zilla wrote:
    > Ok I was successful with this. Now how can I make the CEdit class
    > recognize \n\r escape sequence for line feed and carriage return?


    You can't. You will have to change the data to use \r\n before writing
    it to the edit control.

    --
    Scott McPhillips [VC++ MVP]


+ Reply to Thread