Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Property with a pick list

Posted on 2009-07-03
1
Medium Priority
?
355 Views
Last Modified: 2013-11-23
I want to create a delphi object with a property which can be
one of the follow values:

(PENDING,DOWN,UP,SLEEPING....)

So that in my code i can do things like that:

Actor.Status := PENDING;
Node.Status := UP;

Should I define my const value and use them in a property?

Someone can show me how to do it, plz?
 
0
Comment
Question by:jaja2005
1 Comment
 
LVL 3

Accepted Solution

by:
btframework earned 2000 total points
ID: 24771201
type
  TMyStatus = (PENDING, DOWN, UP, SLEEP);

  TActor = class()
  private
    FStatus: TMyStatus;

  public
    property Status: TMyStatus read FStatus write SetStatus;
  endl

Something like that.

If TActore is not your class then you can define enumeration like:

type
  TMysStatus = (PENDING = 100, DOWN = 200, UP = 5, SLEEP = 1);

where 100, 200, 5 and 1 are the actual values defined for the class.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question