Recent

Author Topic: TComboBox Question  (Read 4649 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2211
    • Lazarus and Free Pascal italian community
TComboBox Question
« on: August 03, 2010, 11:14:40 am »
How do I select code from the last value of my TComboBox? Excuse the stupid question!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

BlueIcaro

  • Hero Member
  • *****
  • Posts: 743
    • My github
Re: TComboBox Question
« Reply #1 on: August 03, 2010, 11:50:37 am »
Did you tried:

Quote
Value :=  MyComboBox.Items[MyComboBox.Count-1].Text;

/BlueIcaro

xinyiman

  • Hero Member
  • *****
  • Posts: 2211
    • Lazarus and Free Pascal italian community
Re: TComboBox Question
« Reply #2 on: August 03, 2010, 12:25:47 pm »
resolved with

Cmb_Turni.ItemIndex:=NumMax-1; //because index start to 0
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

eny

  • Hero Member
  • *****
  • Posts: 1628
Re: TComboBox Question
« Reply #3 on: August 03, 2010, 06:16:16 pm »
resolved with

Cmb_Turni.ItemIndex:=NumMax-1; //because index start to 0
Not resolved and a dorment bug!
BlueIcaro gave the right hint:

if Cmb_turni.Count > 0 then
  Cmb_turni.ItemIndex := Cmb_turni.Count-1;
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

xinyiman

  • Hero Member
  • *****
  • Posts: 2211
    • Lazarus and Free Pascal italian community
Re: TComboBox Question
« Reply #4 on: August 04, 2010, 01:35:06 pm »
resolved with

Cmb_Turni.ItemIndex:=NumMax-1; //because index start to 0
Not resolved and a dorment bug!
BlueIcaro gave the right hint:

if Cmb_turni.Count > 0 then
  Cmb_turni.ItemIndex := Cmb_turni.Count-1;

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018