Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI app problem

Status
Not open for further replies.

Leonardl

Programmer
Joined
Aug 25, 2002
Messages
9
Location
US
I am trying to set a buttons enable property from within the child form, but nothing happens.

procedure TMDIChild.WebBrowser1CommandStateChange(Sender: TObject;
Command: Integer; Enable: WordBool);
begin
case Command of
CSC_NAVIGATEBACK: form1.backbtn.Enabled:=Enable;
CSC_NAVIGATEFORWARD: form1.Forwrdbtn.Enabled := Enable;
end;
end;

what gives?
 
i think it should be like this

procedure TMDIChild.WebBrowser1CommandStateChange(Sender: TObject; Command: Integer; Enable: Boolean);
begin
case Command of
1: form1.backbtn.Enabled := Enable;
2: form1.Forwrdbtn.Enabled := Enable;
end;
end;

in this procedure Command is declared as integer so case Command is looking for a number not CSC_NAVIGATEBACK or CSC_NAVIGATEFORWARD
 
but yet when I step through the code i see it get set to true, but the button is still disabled. I created a test mdi app with a few buttons and can set their props from the child form with no prob. so I think there is somthing i don't yet know. maybe its in the webrowser component.
even thid doesn't work:

procedure TMDIChild.WebBrowser1CommandStateChange(Sender: TObject; Command: Integer; Enable: Boolean);
begin
form1.backbtn.enabled:=true; {debug->evaluate on breakpoint here says enabled = true , but not so}
end;
hmmm...

 
make sure the buttons parent is enabled.

ie.. if the button is on a panel and the panel is disabled the buttons wont work..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top