Главная страница | назад





Article #19478: ColorDialog COlor property does not change in the OnClose() event.

 Question and Answer Database
FAQ4478C.txt — ColorDialog COlor property does not change in the OnClose() event.
Category :VCL
Platform :All-32Bit
Product :All-CBuilder,
Question:
I am using a TColorDialog, in the 'OnClose' event I want to set the Color property
of another control, but it seems as though the color property is 'one behind' the
color that was selected, that is it is the previous color.
How can I get the right color from the dialog?
Answer:
You do not want to get the color in the OnClose(). This is because the OnClose() is called
even if the user selects the 'Cancel' button.
The dialog is modal, and blocks the calling thread untill it returns. Check the return
value and set the color then. ie:
if (true == ColorDialog1->Execure())
Color = ColorDialog1->Color;
3/22/99 2:05:12 PM

Last Modified: 01-SEP-99