Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 04-07-2002, 08:58 AM
matrix21 matrix21 is offline
Senior Member
 
Join Date: Nov 2001
Posts: 130
Default Greenhorn MDI wuestion

Hi,

please I have a greenhorn question:

-I have a MDI application.
-I have a child form that has a Chart and a Button component
-I have 3 different parameters to show so I am creating three child windows
-now I need to redraw all charts in all child forms at one time by pressing a button (there may be opened from one to three child windows) - how do I do it?

Thanks for advice.



matrix21
matrix21@seznam.cz
Reply With Quote
  #2  
Old 04-08-2002, 08:42 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Greenhorn MDI wuestion

What you should do is create a message handler that handles a custom message like WM_USER + 123 and refreshes the charts or whatever...whenever it's needed you can broadcast the message and that's all...like here's a message handler:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
TForm1 = class(TForm)
procedure WMREFRESHSTUFF(var Msg: TMessage); message WM_USER + 123;
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMREFRESHSTUFF(var Msg: TMessage);
begin
//Bla bla...
end;

end.


You can broadcast the message like this:

var
I: Integer;
begin
for
I := 0 to Unit1.Form1.MDIChildCount - 1 do
SendMessage(Unit1.Form1.MDIChildren[I].Handle, WM_USER + 123, 0, 0);
end;


Hope that helps...

gLes

"Today is the first day of the rest of your life"
/gLes@hab.hu/
Reply With Quote
  #3  
Old 04-16-2002, 03:02 AM
matrix21 matrix21 is offline
Senior Member
 
Join Date: Nov 2001
Posts: 130
Default RE: Greenhorn MDI wuestion

Hi,

thx a lot for your answer it helphed me in other probls. I just have another green. quest.....:

In the message I am broadcasting I want component ABC to get enabled in each ChildWind...how do I do it?

This does not work:

procedure TForm1.WMREFRESHSTUFF(var Msg: TMessage);
var
I: Integer;
begin
for I := 0 to Unit1.Form1.MDIChildCount - 1 do
Unit1.Form1.MDIChildren[I].ABC.Enabled:=true;
end;

Any advice.

Thx in advance.


end.

matrix21
matrix21@seznam.cz
Reply With Quote
  #4  
Old 04-16-2002, 06:38 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Greenhorn MDI wuestion

Not like that...since you have already broadcasted the message to each MDI window then you can put ABC.Enabled := True; directly in the message handler...if this is seperate from the WMREFRESHSTUFF then defiane another message and you're done...

Hope that helps...

gLes

"Today is the first day of the rest of your life"
/gLes@hab.hu/
Reply With Quote
  #5  
Old 04-16-2002, 12:39 PM
matrix21 matrix21 is offline
Senior Member
 
Join Date: Nov 2001
Posts: 130
Default RE: Greenhorn MDI wuestion

Thanks a lot...

matrix21
matrix21@seznam.cz
Reply With Quote
  #6  
Old 04-16-2002, 12:59 PM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Greenhorn MDI wuestion

You're welcome...

gLes

"Today is the first day of the rest of your life"
/gLes@hab.hu/
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:15 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.