[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

Creating Instances of LookupCombo box

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?
0
VENKAT
Asked:
VENKAT
  • 2
1 Solution
 
intheCommented:
hi,
i gues you want to create it at runtime ,if so you can
create it like:

//uses DBCtrls (need to add this manually)


var
Lu : TDBLookupComboBox;
begin
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;
  end;
end;


procedure Form1.MyClick (Sender : TObject);
begin
// do something
// note here the tag property is useful if you
// have more than one as you know who was sender.
end;
0
 
MotazCommented:
You can create LookupComBox as:

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

What did you mean by RVD?
Motaz
0
 
VENKATAuthor Commented:
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.
0
 
VENKATAuthor Commented:
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.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now