Thank you guys for the many helpful responses!
Since I'm not aware of "good style" yet, I'll follow first what makes sense to the old scripter. I added a "Form1." to the respective Form Components that I want to access.
I somehow seemed to have tried every other combination of that all
In my logic, the function would be a good (or reasonable) method for an Object - but I would create a separate object (for I'm doing I would guess a Record?) and add it to it there.
I never did GUI programming, If I needed to have a that, I chose the easy way out via WebView and rendered HTML. For those who maybe are unaware, I would have an HTML-Form and send those values in the form to the backend and "do stuff with it". In my head, the Directory Edit is such a Formfield - and the Form doesn't exist as Object, but is "just the Frontend"
Declare the field as public and get rid of the property: one less level of indirection and avoids some of the limitations of properties.
For that, I would do insert this line in the "public" section of the type declaration of the form like so, right? And add "TForm1l." to the function name in the implementation, since now it's a method.
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
DirectoryEdit1: TDirectoryEdit;
procedure Button1Click(Sender: TObject);
private
public
function FunctionIWantToCall: TStringList
end;
What pops in my head/logic there is - this shouldn't be a method - it doesn't do anything with the Form, the function takes values from components on the form and creates something new with it? Maybe I just think more procedural than OO...The damage of writing a scripting language for a living xD