Solved

Property with a pick list

Posted on 2009-07-03
1
347 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now