Creating Instances of LookupCombo box

Posted on 2002-05-22
Last Modified: 2010-04-04
I would like to use LookupCombo box with out placing component on my Form, I would like to create using coding only. Actually i have a table which connected to GRID and RVD. So when i execute my RVD from table itself i would like to specify which field will be display as Lookup Combo box. Anybody can help me please?
Question by:VENKAT
  • 2
LVL 17

Accepted Solution

inthe earned 50 total points
ID: 7028997
i gues you want to create it at runtime ,if so you can
create it like:

//uses DBCtrls (need to add this manually)

Lu : TDBLookupComboBox;
Lu := TDBLookupComboBox.Create(self);
with Lu do begin
    Parent := Self;
    Name:= 'MyLu';
    Left:= 10;
    Top:= 10;
Tag := 4;
    DataSource:= DataSource1;
    DataField:= 'Category';
 //  etc for any other properties you want to set..
//also add any events you want
    OnClick := Form1.MyClick;

procedure Form1.MyClick (Sender : TObject);
// do something
// note here the tag property is useful if you
// have more than one as you know who was sender.

Expert Comment

ID: 7028999
You can create LookupComBox as:

  Lookup: TLookupComboBox;
  Lookup:= TLookupCompoBox(Self);
  Lookup.Parent:= Self;
  Lookup.Lef:= 100;
  Lookup.Top:= 50;
  Lookup.Datasource:= Datasource1;
  Lookup.DataField:= 'Subject';

What did you mean by RVD?

Author Comment

ID: 7029160
hi inthe/Motaz
   i wrote code for my TwwDBLookupCombo as u write. But If i have component on my wwDBGrid, after i assign properties i used to double click the wwDBGrid by open the connected table. Then i can select that FieldName from Selected Field List and can assign ControType='CustomEdit' and ControlName='wwDBLookupCombo1'. So how to do all these thigns here. RVD means wwRecordViewDialog from InfoPower. So later when i edit my wwDBGrid with RVD, i should be able to see that Field with LookupCombo. Thats my wish. I am using all InfoPower componnets.
Thank you.

Author Comment

ID: 7032065
Hi Inthe
   Thank u very much. I got Lookup Combo in Grid and RVD aswell. Actually 75% of my problem is solved. Next little bit is Onclick function from this combo. I did not understand ur TAG usefulness. Can u explain me clearly how to do this Onclick and also Tag useful in that. Thank u again.

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

Suggested Solutions

Title # Comments Views Activity
ddeman not working in activex 3 92
Wininet read php file from internet issue 6 80
add combobox item based on numbers 9 119
Delphi: Connect to running MS Outlook 4 47
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

10 Experts available now in Live!

Get 1:1 Help Now