Solved

Accessing components on a MDI form....

Posted on 1997-09-30
1
153 Views
Last Modified: 2010-04-04
I'm trying to add items to a list box which is on a MDI child form from other areas in the code..

I tried to use this code:

FrmMain.ActiveMDIChild.Listbox.Items.Add( ' Test');

where FrmMain is the parent form of the MDI form.

the code says that it expects a 'Field Identifier' after
ActiveMDIChild.

I am also only using version 1 of delphi.

How can I add to the listbox which is on a MDI form from anywhere in my code and not just in the file it was declared in?

Thanks for you help...
0
Comment
Question by:rowen
1 Comment
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 60 total points
ID: 1346642
The reason is that the ActiveMDIChild property doesn't have a property called ListBox, so you have to cast the ActiveMDIChild property to the type of your MDI child form, e.g.:

TMyMDIChild(frmMain.ActiveMDIChild).ListBox.Items.Add('Test');

I presume Delphi 1 would allow you to type-cast like this.  (I use Delphi 3.)

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now