Forum > General

Default values in property?

(1/2) > >>

Is there any way that I can assign default values to property? Method's default values are not applied automatically. 

      function GetMessage(RState: integer; lang: string=''; GoNext: boolean=false;
        ivExists: boolean=false; pid: integer=0; wave: integer=0): string;

      property AQMessage[RState:integer; lang:string; gonext, ivexists:boolean;
               pid, wave: integer]: string read getMessage;                 

Assign it a value in the constructor?

Actually problem is I can't use in following way.

    s := AQMessage(100);

Show your problem with more than 1 line of code would help us to help you.
How about to upload a small demo project that cover your problem?

So, you have a function, GetMessage, that might not give a "proper" result, in which case you want to return some default value?

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function GetMessage: string;begin  Result := DEFAULT_VALUE;   try    Result := GetTheMessage;  finally  end;end;


[0] Message Index

[#] Next page

Go to full version