Jump to content

Recommended Posts

Posted

TUniComboBox created at runtime does not correctly capture the ItemIndex property, only the value initially defined.

Exemple:

var Combo := TUniComboBox.Create(Form);

with Combo do
begin
  Name := 'CtPageSize_Combo';
  Style := csDropDownList;
  OnChange := OnPageSizeChange;

  BeginUpdate();
  Clear();
  Items.Add('5');
  Items.Add('10');
  Items.Add('25');
  Items.Add('50');
  Items.Add('75');
  Items.Add('100');
  EndUpdate();
  ItemIndex := 2;
end;

procedure OnPageSizeChange(Sender: TObject);
begin
  var ComboBox := (Sender as TUniComboBox);

  // Error, returns '25' value
  var Value := StrToInt(ComboBox.Text);
  
  // Same Error, returns ItemIndex = 2  
  var Value2 := StrToInt(ComboBox.Items[ComboBox.ItemIndex]);
end;

 

Posted

1.95.0.1607

I resolved..

The problem occurs when trying to use the component within the grid via the PagingBarAuxControl property; if there is no parent component, it does not update the ItemIndex value.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...