Francisco Neto Posted December 3, 2025 Posted December 3, 2025 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; Quote
Sherzod Posted December 3, 2025 Posted December 3, 2025 Hello, ItemIndex is zero-based, so ItemIndex = 2 correctly refers to the 3rd item ('25'). Quote
Francisco Neto Posted December 3, 2025 Author Posted December 3, 2025 Yes, but he always returns 2. The problem I'm having is that it always returns the same value even when selecting a different one. Quote
Sherzod Posted December 3, 2025 Posted December 3, 2025 Which version of uniGUI are you using? And could you create a simple test case? Quote
Francisco Neto Posted December 3, 2025 Author Posted December 3, 2025 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.