TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: ERIC SCHREIBER
date: 1997-07-30 20:36:00
subject: MDI Parent Color problem

Delphi 1 & 3:
I've got an MDI app that I've added a "change program background color" 
feature to. This color gets set in a (non-mdi, modal) config dialog box. When 
I exit the dialog box, testing shows that I'm correctly setting my background 
color variable (BGColor). Then I assign that variable to the MainForm.Color 
property.
The kick is that the main form (the MDI parent form) doesn't immediately 
change color. If I resize the app/form even one pixel (or maximize/restore), 
the entire background color changes correctly. If I drag one of the MDI 
Children around within the main form, it acts like a paintbrush, leaving a 
trail of the new correct color as it moves.
However, I cannot for the life of me get the whole background to repaint 
automatically when exiting the config dialog.
When I exit the config dialog, I'm setting BGColor with whatever color was 
chosen in the dialog. This is working correctly, as evidenced by the fact 
that the backgroud does repaint *eventually*.
    MainForm.Color := BGColor; {BGColor is getting set correctly}
After this call I've tried:
    MainForm.Repaint;
and
    MainForm.Refresh;
and even
    MainForm.Invalidate;
    MainForm.Update;
None of these will cause the MDI Parent form background to immediately and 
automatically change to the new color. Can anyone offer any advice?
Thanks!
EEAS
eric@kobayashi.com          http://www.kobayashi.com/maru/
--- Blue Wave/DOS v2.21
---------------
* Origin: The Aircrash Bureau Chicago 773-278-1195 33.6 (1:115/327)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.