Re: Paint message fire galore

Tech-Archive recommends: Fix windows errors by optimizing your registry



In article <1808D09C-342B-4086-9797-50B08ED257E4@xxxxxxxxxxxxx>
Jesper,Denmark <JesperDenmark@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Thanks Peter,

I have been using the paint event handler since MFC (I guess) to
reflect my data like this:

...._Paint(..)
{
textBox1.Text = someString;

//and

if ( true == foo )
{
radioButton1.Checked = true;
}
else
{
radioButton2.Checked = true;
}
}

Is this not good style?,

No, it's not a good style. Sorry to say, it was never a good style,
whether you were using MFC, or writing straight to the native Win32
API.
What's the alternative?

That's very hard to say without knowing what "someString" is and what
"foo" is. However, as a general rule of thumb, your design should be
changed so that when "someString" changes, that's where you set the
text in the TextBox, and when "foo" changes, that's where you change
the state of the RadioButton control.

Pete


--

I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo

.


Quantcast