Wish "Automatic" property creation

LucaMs

Expert
Licensed User
Longtime User
EDIT:
https://www.b4x.com/android/forum/threads/tool-property-generator.126789/post-793028


Same as for custom types:

1611135867765.png


If the cursor is on a SINGLE PRIVATE variable declaration in Class_Globals, shows a "dialog" like that to allow the creation of the two property routines (it would be better if you could choose if read-only)
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Especially not for private variables
?

You know better than me what I mean:
B4X:
Private Class_Globals
    Private mMyProperty As Int ' <--- this "kind" of private variable
End Sub

Public Sub setMyProperty(Value As Int)
    mMyProperty = Value
End Sub
Public Sub getMyProperty As Int
    Return mMyProperty
End Sub

If you mean that B4X classes shouldn't have properties... ok.
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms
 

Alexander Stolte

Expert
Licensed User
Longtime User
If you think there are those who asked to automatically enter #End Region...!
that was my wish :D
Because on #IF the ide makes automatic an #END IF
And this is what I notice every time I create a region.
 
D

Deleted member 103

Guest
To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms
Unfortunately this is not correct.
There has always been something like that in Visual Studio, and it is a very good and useful function.
But since every "Sub" in B4x can be a procedure, a function or a property, it is not absolutely necessary.
 

ilan

Expert
Licensed User
Longtime User
if you set a variable as private why would you want to use it as "public"?
set the variable as public and you won't need any setter/getters.
 

LucaMs

Expert
Licensed User
Longtime User
if you set a variable as private why would you want to use it as "public"?
set the variable as public and you won't need any setter/getters.
I create and declare that module private variable for the sole purpose of using it in conjunction with the ownership routines!

If "you" ask these questions, you don't have a clear idea about class properties.

If I declared a variable as public and global, I could modify its value from anywhere, without any checking on the set value, which I will instead do inside the "set" part of the property. Also, I couldn't make that variable read-only, while I can do it by creating just the "get" routine.
 
Top