Question: I am currently using the AppDelegate in my first iPhone app to handle application level events.

In my app I have an enabled and disabled state, so when the user selects disabled some of the buttons on the application should be set to disabled.

My AppDelegate gets notified of the state. But what is the best approach to let my UIViews know that they should disable some of their buttons?

What is the standard approach to communicate events from the AppDelegate to the UI screens?

**EDIT**:

My description is slightly wrong, the user can disable the buttons in my app but conditions such as lack of Wi-Fi can as well, so I need to be dynamically able to change the UI state also.

Answer: 
For array handling, array initialization and array constant declarations, Delphi doesn't make simple things simple.

In some situations similar to yours, I initialize the array with a utility function taking one open array parameter and returning the appropiate static string.

```
const
    MaxArray = 10;
type
    TRealStaticArray = array[0..MaxArray] of Real;

function RealArray(const AnArray: array of real):TRealStaticArray;
    const DefaultValue=0.0;
    var i: integer;
    begin
        // EDIT: commented out, thanks Serg. for i:= 0 to low(AnArray)-1 do result[i]:=DefaultValue;
        for i:= High(AnArray)+1 to MaxArray do
            result[i]:=DefaultValue;
        for i:= Low(AnArray) to High(AnArray) do
            if (i>=0) and (i<=MaxArray) then
                result[i]:=AnArray[i];
    end;

```

Use it this way:

```
 var MyArray: TRealStaticArray;
 ...
 MyArray := RealArray([10.0, 20.0, 30.0]);

```
Putting aside the general question, I'd like to point out that the specific use-case was never going to work anyway: Delphi can't return on the stack the contents of an array of unknown length. 

The return type of a function needs to be known by the calling code. It may be a pointer to the heap: it may even be a memory-managed object on the stack: but it is not permitted to be an undefined number of bytes on the stack, decided dynamically by the target function.

And in many other languages, the example

```
return (0,0,0)  //return pointer to automatic allocation

```

would be undefined, even if the compiler lets you do it. 

A common method of defining, using and returning const values is

```
int myarray[8] = {128, 38459, 438 ... 23674};
memcpy (myparam, myArray, sizeof (myArray)); 

```

... and you can do that in Delphi