Is there a way to fill a Delphi array using something like
array = array('this','that','and uh'); // php
array = ['this','that','and uh']; // javascript
Or if there's not, maybe you could give me a hint on what I'm trying to do:
I have this array of TButtons. I'm adding some buttons to the array, which should be visible to the user. Using this method of an array, I can easily use a loop to set their visibility property.
With a dynamic array, and a suitably modern version of Delphi you can use an array constructor.
myArray := TArray<string>.Create('this', 'that', 'and uh');
If you want to create an array of buttons then it is written so:
buttons := TArray<TButton>.Create(btn1, btn2, btn3);
And then to iterate over the array of buttons:
for button in buttons do
DoSomething(button);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With