Solved

Accessing components on a MDI form....

Posted on 1997-09-30
1
154 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

816 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

7 Experts available now in Live!

Get 1:1 Help Now