Einzelnen Beitrag anzeigen

Medium

Registriert seit: 23. Jan 2008
3.679 Beiträge
 
Delphi 2007 Enterprise
 
#2

AW: TComboBox and string object

  Alt 14. Feb 2012, 14:14
The most direct way: Use a global variable for your string. But that can still end up in all sorts of messes because of the compiler magic strings come with. Especially fun stuff like copy-on-write related things.
(Edit, to be clear: Do NOT do this! It may work in some special and simple cases, but is dirty like whatnot.)

A more sensible way: Define a TStringList in a suitable scope, and put the index of your desired string from that list into your Object-Property. To read it, just use that index on your StringList. You'll save yourself a lot of potential trouble that way
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)

Geändert von Medium (14. Feb 2012 um 14:16 Uhr)
  Mit Zitat antworten Zitat