[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

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,
0
crystyan
Asked:
crystyan
1 Solution
 
2266180Commented:
 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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now