Solved

Property with a pick list

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 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

17 Experts available now in Live!

Get 1:1 Help Now