Recent

Author Topic: [SOLVED] Defining TDBDropDownCombo or JvDBLookupCombo field widths?  (Read 383 times)

1HuntnMan

  • Sr. Member
  • ****
  • Posts: 437
  • From Delphi 7 to Lazarus
    • NewFound Photo Art
I defined fieldwiths for DropDownCombos awhile back when I was using TDbf datasets.  The code works below but after switching to SQLite there's no errors but just doesn't work.  See below from FormShow:

Code: Pascal  [Select][+][-]
  1. procedure TFrmInvces.FormShow(Sender: TObject);
  2. begin
  3.   TFloatField(QryInvces.FieldByName('INVCEAMT')).Currency:= True;
  4.   TFloatField(QryInvces.FieldByName('DISCOUNT')).Currency:= True;
  5.   TFloatField(QryInvces.FieldByName('PAIDAMT')).Currency:= True;
  6.   TFloatField(QryInvces.FieldByName('AMTDUE')).Currency:= True;
  7.   //=> Define field widths for dropdowncombo's...
  8.   //QryInvces.FieldByName('CLIENT').DisplayWidth:= 20;
  9.   DSrcInvces.DataSet.FieldByName('CLIENT').DisplayWidth:= 20;
  10.   DSrcInvces.DataSet.FieldByName('PRJNAME').DisplayWidth:= 40;
  11.   DSrcInvces.DataSet.FieldByName('REQBYLNAME').DisplayWidth:= 9;
  12.   DSrcInvces.DataSet.FieldByName('REQBYFNAME').DisplayWidth:= 8;
  13.   DSrcSOs.DataSet.FieldByName('REQBYLNAME').DisplayWidth:= 9;
  14.   DSrcSOs.DataSet.FieldByName('REQBYFNAME').DisplayWidth:= 8;
  15.   DSrcSOs.DataSet.FieldByName('REQBYMI').DisplayWidth:= 3;
  16.  

The dropdown when testing used to widen for each field width esp. if you define the dropdown for 3 fields vs. 1 field i.e. displaying the Contacts Lastname | Firstname | Mi.  The dropdown is just displaying the Lastname and the 1st char. of the Firstname.
« Last Edit: February 12, 2026, 08:09:01 pm by 1HuntnMan »

1HuntnMan

  • Sr. Member
  • ****
  • Posts: 437
  • From Delphi 7 to Lazarus
    • NewFound Photo Art
Re: Defining TDBDropDownCombo or JvDBLookupCombo field widths?
« Reply #1 on: February 12, 2026, 08:08:22 pm »
Figured it out. You have to expand the DropDownWidth property, Ha!  You still have to define the widths of each field, i.e. FormShow. As per my previous post, the JvDBLookupCombo for looking up the Contact who requested the proposal then finally invoicing the Client. You still need to define the DisplayWidth for each field you are going to display in the DropDownCombo. I do this at the top of FormShow before I open any tables. Now when you define each displaywidth for each field, that doesn't add up to the DropDownWidth so you need to experiment a bit to get a good display of the DropDownCombo during runtime.

Have a Nice Day!  ;D

 

TinyPortal © 2005-2018