A amykonio Active Member Licensed User Longtime User Aug 22, 2019 #1 Hi to everyone. I have a class with two private strings declared in Class_Globals. Code: Private ExportFolder As String Private FtpExportFolder As String Now I want to declare setters for those properties. This is what I do: Code: public Sub setExportFolder(Value As String) ExportFolder = Value End Sub public Sub setFtpExportFolder(Value As String) FtpExportFolder = Value End Sub Now when i try to use those setters from another class, there is no autocomplete. But if I type the commands they are accepted, and the application runs normally. Is this an expected behavior? (Working with B4J 7.51). Andreas.
Hi to everyone. I have a class with two private strings declared in Class_Globals. Code: Private ExportFolder As String Private FtpExportFolder As String Now I want to declare setters for those properties. This is what I do: Code: public Sub setExportFolder(Value As String) ExportFolder = Value End Sub public Sub setFtpExportFolder(Value As String) FtpExportFolder = Value End Sub Now when i try to use those setters from another class, there is no autocomplete. But if I type the commands they are accepted, and the application runs normally. Is this an expected behavior? (Working with B4J 7.51). Andreas.
Erel B4X founder Staff member Licensed User Longtime User Aug 22, 2019 #2 You will need to change the name of the global variables. You can change them to mExportFolder for example. Upvote 0
You will need to change the name of the global variables. You can change them to mExportFolder for example.
DonManfred Expert Licensed User Longtime User Aug 22, 2019 #3 The Variable name and the subsignature overwrite itself. Try name the internal vars like Code: Private mExportFolder As String Private mFtpExportFolder As String and setters like Code: public Sub setExportFolder(Value As String) mExportFolder = Value End Sub public Sub setFtpExportFolder(Value As String) mFtpExportFolder = Value End Sub Upvote 0
The Variable name and the subsignature overwrite itself. Try name the internal vars like Code: Private mExportFolder As String Private mFtpExportFolder As String and setters like Code: public Sub setExportFolder(Value As String) mExportFolder = Value End Sub public Sub setFtpExportFolder(Value As String) mFtpExportFolder = Value End Sub
A amykonio Active Member Licensed User Longtime User Aug 22, 2019 #4 Thank you both Erel and DonManfred. After this change, now it shows ok. But I'm a little confused about why these happened. I saw DonManfred answer: The Variable name and the subsignature overwrite itself. Click to expand... So the getter or setter must have a different name from the property? I was thinking they was the property name with a set or get as prefix. Andreas. Attachments upload_2019-8-22_12-40-34.png 77.7 KB · Views: 621 Upvote 0
Thank you both Erel and DonManfred. After this change, now it shows ok. But I'm a little confused about why these happened. I saw DonManfred answer: The Variable name and the subsignature overwrite itself. Click to expand... So the getter or setter must have a different name from the property? I was thinking they was the property name with a set or get as prefix. Andreas.
DonManfred Expert Licensed User Longtime User Aug 22, 2019 #5 amykonio said: So the getter or setter must have a different name from the property? Click to expand... yes A setter named setFtpExportFolder(Value As String) and the getter getFtpExportFolder() both point to FtpExportFolder which is a private property with the same name. Give the getter and setter another name or rename the internal vars. Upvote 0
amykonio said: So the getter or setter must have a different name from the property? Click to expand... yes A setter named setFtpExportFolder(Value As String) and the getter getFtpExportFolder() both point to FtpExportFolder which is a private property with the same name. Give the getter and setter another name or rename the internal vars.
A amykonio Active Member Licensed User Longtime User Aug 22, 2019 #6 DonManfred said: yes A setter named setFtpExportFolder(Value As String) and the getter getFtpExportFolder() both point to FtpExportFolder which is a private property with the same name. Give the getter and setter another name or rename the internal vars. Click to expand... Ok. Thank you. Now it's clear. Andreas. Upvote 0
DonManfred said: yes A setter named setFtpExportFolder(Value As String) and the getter getFtpExportFolder() both point to FtpExportFolder which is a private property with the same name. Give the getter and setter another name or rename the internal vars. Click to expand... Ok. Thank you. Now it's clear. Andreas.
Erel B4X founder Staff member Licensed User Longtime User Aug 22, 2019 #7 This could be changed in the future. If I remember correctly properties were implemented before the variables visibility scope keywords were added (Private / Public). Upvote 0
This could be changed in the future. If I remember correctly properties were implemented before the variables visibility scope keywords were added (Private / Public).