Recent

Author Topic: [SOLVED] .Text property ot TComboBox  (Read 405 times)

CM630

  • Hero Member
  • *****
  • Posts: 1346
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
[SOLVED] .Text property ot TComboBox
« on: May 09, 2025, 09:45:01 am »
I just had some troubles - I changed the index of a combo during startup (applying the settings), but the combo showed a wrong value.
Then I figured out, that the reason is that the combo had its .Text property <> '' and this value was applied when setting the localisation (from .PO).
I set .Text to '' and now the combo shows what it should.
Shall I take care that Combos shall always have empty .Text properties or shall I do sth. else?
If it is the first case, maybe I shall take care of emptying some properties of other controls, too? Which are they?
« Last Edit: May 13, 2025, 03:37:38 pm by CM630 »
Лазар 4,0 32 bit (sometimes 64 bit); FPC3,2,2

Thaddy

  • Hero Member
  • *****
  • Posts: 16959
  • Ceterum censeo Trump esse delendam
Re: .Text property ot TComboBox
« Reply #1 on: May 09, 2025, 11:54:25 am »
Basically e.g. TMemo too. The designer adds a default value. I always clear them out. So, yes, call clear.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

munair

  • Hero Member
  • *****
  • Posts: 855
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: .Text property ot TComboBox
« Reply #2 on: May 10, 2025, 08:53:57 am »
It also depends on whether you want those controls read only. When setting up combos (and memos), I clear the default text in the IDE and often make them read only unless preferred otherwise. Then I populate them and set the default index in a form create or later, depending on desired behavior.
It's only logical.

CM630

  • Hero Member
  • *****
  • Posts: 1346
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Лазар 4,0 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018