AdvComboBox

I do not destroy lists in AdvComboBox and still cannot access their objects. And I don't destroy them either. But just one exchange of the list in AdvComboBox and I already have a problem. It does not matter which assignment technique I use

   advcbxFirst.Items.Assign (lstOwnerFirst);
   or
   advcbxFirst.Items: = lstOwnerFirst;

There is no problem with the standard ComboBox

I cannot see any problem.
Tested with 2 TAdvComboBox instances on the form and 4 TEdit instances and the code:


procedure TForm1.FormCreate(Sender: TObject);
var
  edt: TEdit;
begin
  AdvComboBox1.Items.AddObject('edit1',Edit1);
  AdvComboBox1.Items.AddObject('edit2',Edit2);
  AdvComboBox1.Items.AddObject('edit3',Edit3);
  AdvComboBox1.Items.AddObject('edit4',Edit4);
  AdvComboBox2.Items.Assign(Advcombobox1.Items);

  edt := TEdit(AdvComboBox2.Items.Objects[1]);
  edt.Text := AdvComboBox2.Items[1];
end;

and these objects can used without any issue.

If a problem persists with the latest version of our components, prepare a sample source project + detailed steps and send this to support.
  lstOwnerFirst := TStringList.Create;
  lstOwnerSecond := TStringList.Create;
  lstOther := TStringList.Create;
...

Example of populating lists:

  if qryOwnerMinMaxPeriod.FieldByName('MAXPERIOD').AsDateTime = oGlobalVar.LastDateFoc then
  begin
    lstFirst:= TList<Integer>.Create;
    lstFirst.Add(FldPrimaryKey.AsInteger);
    lstFirst.Add(FldFLATNUMBER.AsInteger);
    DecodeDate(qryOwnerMinMaxPeriod.FieldByName('MINPERIOD').AsDateTime, Year, Month, Day);
    lstFirst.Add(Year);
    lstFirst.Add(Month);
    lstOwnerFirst.AddObject(FldFULLNAME.AsString +' (' + FldFlatNumber.AsString + ')', lstFirst);
  end;

  AdvComboBox1.Items.Assign (lstOwnerFirst);
...
  AdvComboBox1.Items.Assign (lstOwnerSecond);
...
  AdvComboBox1.Items.Assign (lstOther);
...

procedure TfrmChangeOwner.DestroyLists;
begin
  FreeAndNilStringsObjects(lstOwnerFirst);  //  AV
  FreeAndNil(lstOwnerFirst);
...

procedure FreeAndNilStringsObjects(AStrings: TStrings);
var
  I: Integer;
  Obj: TObject;
begin
  for I := AStrings.Count -1 downto 0 do
  begin
    Obj := AStrings.Objects;
    Obj.Free;   //  AV
    Obj := nil;
  end;

  AStrings.Clear;
end;

I asked to please prepare a sample source project with which this can be reproduced.


I'm confused. In the upcoming example, it works as it should.

Please try to provide a sample source app with which we can reproduce the issue.

I couldn't do a broken example. I'm still looking for a mistake with me.

I sent the entire app with the accessory. But only things related to the problem. I couldn't do it any other way. The rest is in email.

I forgot. In RadioGroup you have to click on the last, then on the first item again and close the form.

When I replaced my component with TMS, it works for me. At least I know where to look for a mistake.

Using TMS Pack v10.1.5.1, 125% Scale, Windows 10 1909, Delphi 10.3.3

The issue with the label font size is still there. I finally came up with the steps to reproduce:
- On a form add combo boxes with and without items set at design time.
and run the app.
Those with loaded items have their labels oversized whereas empty ones have no issues.

- Now add items to any of the combo boxes with empty items, the label becomes oversized. Delete its items and things are back to normal.

- In Build 10.1.5.0: same issue but when the combo box items is empty, the label is too small, adding items fixes the problem.

Hope this helps to fix this annoying glich.
   
Karim Kouni.

We could trace & fix this issue. 
The next update will address this.

Thanks. To add to this, This issue does not show up if the items are populated at runtime. Only Design time. 

Yes, we had seen this and fixed this already.

Can we have an autosize property where the combobox adjusts the width of its dropdown list to the items maximum length similar to Kanopka controls that come with delphi. 

We have added the property AutoDropWidth that will enable this.
This will be included in the next release.

I am trying to use the above but the width of the dropdown is the full width of the column. Is there a special setting that should or should not be used? I have tried grid.Navigation.AutoComboDropSize := true; and also my own size as grid.combobox.dropwidth := 100; but nothing changes. I am using version 8.6.9.0 .

Jim

Tested with a default TAdvStringGrid on the form and the code:

procedure TForm1.AdvStringGrid1GetEditorProp(Sender: TObject; ACol,
  ARow: Integer; AEditLink: TEditLink);
begin
  advstringgrid1.AddComboString('BMW');
  advstringgrid1.AddComboString('Mercedes');
  advstringgrid1.AddComboString('Audi');
  advstringgrid1.AddComboString('Porsche');
  advstringgrid1.AddComboString('Ferrari');
  advstringgrid1.Combobox.DropWidth := 200;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  advstringgrid1.Options := advstringgrid1.Options + [goEditing];
  AdvStringGrid1.DefaultEditor := edComboEdit;
end;

and this clearly shows the dropdown width of the combobox is set via advstringgrid1.Combobox.DropWidth

I believe you. My question was what I most likely could have changed by mistake so as to cause this problem. Perhaps I should just drop a fresh AdvstringGrid on my form.

I just dropped a new copy of the AdvStringGrid onto my form and linked all of the event handlers to the new component and inserted
advstringgrid1.Combobox.DropWidth := 200;
in the GetEditorProp handler but the problem is still there.

My application is more complex because other rows have just string input or checkboxes. Thus I did not set the defaultEcitor as edComboEdit but use the GetEditorType event handler to set AEditor := edComboEdit when I know I am on such a row. Should that make a difference?

Everything seems to work ok except the width of the drop.

Jim