thank you. but i took the example exactly from the documentation. It should work also on a single line. I have a 500to1000 of this only in 1 application, transforming this on more than a line is a lot of work and less readable.
However I can’t find out to let it work like the examples in the documentation
and even with your example I get “New” as Deprecated warning message
Are you sure? The syntax given for New doesn’t include calls like in your example. First you create the new object, then you call one of its methods – it’s always two steps.
Thank you for the suggestions , I know when and how to handle errors and sincerely also in other languages it’s very usual to write it on one single row. Split this single row in more than one is very unprofessional in a very big project
I still believe there must be a solution or something wrong in the code.
The documentation appears to be in error here. New cannot be used like that and the compiler will complain about a syntax error if you try. You can’t very well argue with the compiler.
Of course, as you need to create a new FolderItem, and without New no constructor gets called and you cannot pass any parameters. It’s just that New cannot be used in the way that this example in the documentation suggests. The syntax of New (New — Xojo documentation) doesn’t support method calls, except implicitly by calling a constructor.
Just write the code in two lines and be done with it.
Hello Julia, I found out that deprecated methods API1 are not treated in the same way as API2. They don’t share always the same code and behavior could be little different. I think they left the code unchanged for compatibility issues and API2 gets internal improvements.
I’d second Jeff’s proposal to initialise a Folder_templates property at startup. In fact that’s exactly what I have done in one app where the same folder gets accessed at multiple points in my code.
Function CreateFolderItem(Path) As FolderItem
Return New FolderItem(Path, FolderItem.PathTypes.Native)
End Function
Use that in place of GetFolderItem and call it a day. Yes, there are better ways to handle this, but for the level of usage here, it’s at least a decent middle ground.
just checked your example. Your way you always create a folder even if not requested and so you don’t have any control of it. Final solution is exactly is best solution to fix the Xojo-bug you can’t concatenate .Child(..)
PS: Du Alter, hab schon lange nicht mehr REM gesehen das erinnert mich an alte Zeiten Gruss