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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a specific component from an MDI child

Status
Not open for further replies.

Colosseus

Programmer
Aug 19, 2004
2
NO
Hello, I'm writing a code editor, which is built upon an MDI interface. Now, on my MDI child form, I have only one component, which is a TRichEdit component named Code. How can I access the Code component of the currently active MDI child?

Also, how can I choose which MDI child that is active?

Thank you
 
If you cast the ActiveMDIChild as the type of form that it is (ie. TChildForm) then you can access its components directly from the main form.

if ActiveMDIChild is TChildForm then begin
// you can reference RichEdit "Code"
TChildForm(ActiveMDIChild).Code
end;

In MDI applications, ActiveMDIChild refers to the active window.
 
Hi man, I had the same problem a few months ago.

Lets say you have a criteria for each MDIchild (declared in public section of the MDI unit
public
{ Public declarations }
zxName:String //title of a mdi window for example "a.txt"
end;

You can cycle through the MDIChild forms with this

for i:=0 to mainform.MDIChildCount-1 do
if TMDIChild(mainform.MDIChildren).zxName=mdiName
then mainform.MDIChildren.Code.Lines.Add('Text to Add');
{ where mdiName is the criteria name of the window (MDI // FOrm in which you want to add string }

I use this to add string to the richedit when the MDI Child form is Titled zxName

Hope this will help you.Good Luck !




Spent
mail:teknet@mail.orbitel.bg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top