Object property problem. Very simple to solve !

Hi there,

I`m new to objects and I have this prob:

lets say I have

  TDisplayMessage = record
                      description: String;
                      category: Byte;
                      category_path: String;
                      font_name: TFontName;
                      size: Byte;
                      bold: Boolean;
                      italic: Boolean;
                      text_color: TColor;
                      background_color: TColor;
                      text: String;
                      friendly_name: String;
                      url: String;
                      sound_path: String;
                      application_path: String;
                    end;

  TReminder = class(TObject)

  private
    ReminderDate: TDateTime;
    DisplayMessage: TDisplayMessage;
    Scheduler: TScheduler;

  protected
  //
  public
  //
  published
    constructor Create;
    destructor Destroy;
    procedure DisplayReminder;
  end;

what I want is a property named CategoryPath wich will return a string. The property will check the value of DisplayMessage.category and will return a string according with that value.

It`s very simple. I hope it makes sence.

I need this ASAP pls.

Thanks,
crystyanAsked:
Who is Participating?
 
2266180Connect With a Mentor Commented:
 TReminder = class(TObject)

  private
    ReminderDate: TDateTime;
    DisplayMessage: TDisplayMessage;
    Scheduler: TScheduler;
    function getCategoryPath:string;
  protected
  //
  public
  //
  published
    property CategoryPath:string read getCategoryPath;
    constructor Create;
    destructor Destroy;
    procedure DisplayReminder;
  end;

function TReminder.getCategoryPath:string;
begin
  if DisplayMessage.category='blabla' then result:='some text'
  else if blablabla
  else if so on and so far
end;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.