LucaMs Expert Licensed User Longtime User Jan 20, 2021 #1 EDIT: https://www.b4x.com/android/forum/threads/tool-property-generator.126789/post-793028 Same as for custom types: 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: Jan 26, 2021
EDIT: https://www.b4x.com/android/forum/threads/tool-property-generator.126789/post-793028 Same as for custom types: 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)
Erel B4X founder Staff member Licensed User Longtime User Jan 20, 2021 #3 Will never be added. You don't need to add properties for fields. Especially not for private variables. Start with a regular variable and later switch to a property if you need to add logic. This is one of Java bloat features.
Will never be added. You don't need to add properties for fields. Especially not for private variables. Start with a regular variable and later switch to a property if you need to add logic. This is one of Java bloat features.
LucaMs Expert Licensed User Longtime User Jan 20, 2021 #4 Erel said: Especially not for private variables Click to expand... ? You know better than me what I mean: B4X: Copy 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: Jan 20, 2021
Erel said: Especially not for private variables Click to expand... ? You know better than me what I mean: B4X: Copy 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.
Erel B4X founder Staff member Licensed User Longtime User Jan 20, 2021 #6 LucaMs said: If you mean that B4X classes shouldn't have properties... ok. Click to expand... Generally speaking, there is no reason to automatically create logic-less properties.
LucaMs said: If you mean that B4X classes shouldn't have properties... ok. Click to expand... Generally speaking, there is no reason to automatically create logic-less properties.
LucaMs Expert Licensed User Longtime User Jan 20, 2021 #7 Erel said: Generally speaking, there is no reason to automatically create logic-less properties. Click to expand... I still don't understand what you mean. "Logic-less"?
Erel said: Generally speaking, there is no reason to automatically create logic-less properties. Click to expand... I still don't understand what you mean. "Logic-less"?
Erel B4X founder Staff member Licensed User Longtime User Jan 20, 2021 #8 With logic: Code: Copy Public Sub setNumber(n As Int) mNumber = Max(0, n) End Sub Without logic: Code: Copy Public Sub setNumber(n As Int) mNumber = n End Sub
With logic: Code: Copy Public Sub setNumber(n As Int) mNumber = Max(0, n) End Sub Without logic: Code: Copy Public Sub setNumber(n As Int) mNumber = n End Sub
LucaMs Expert Licensed User Longtime User Jan 20, 2021 #9 Yes, so you can say that templates are useless because they are "empty", "logic-less" 1 - you could have the need of a read-only property 2 - once created - as "template", you can add code, if needed.
Yes, so you can say that templates are useless because they are "empty", "logic-less" 1 - you could have the need of a read-only property 2 - once created - as "template", you can add code, if needed.
aeric Expert Licensed User Longtime User Jan 21, 2021 #10 LucaMs said: Done View attachment 106588 Click to expand... Would you share this app? Maybe someone would find it useful.
LucaMs said: Done View attachment 106588 Click to expand... Would you share this app? Maybe someone would find it useful.
Cableguy Expert Licensed User Longtime User Jan 21, 2021 #11 To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms
To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms
LucaMs Expert Licensed User Longtime User Jan 21, 2021 #12 Cableguy said: To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms Click to expand... If you think there are those who asked to automatically enter #End Region...! Any automatism that makes you save typing is always useful. Obviously it is less useful that it is done that way, with an external sw.
Cableguy said: To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms Click to expand... If you think there are those who asked to automatically enter #End Region...! Any automatism that makes you save typing is always useful. Obviously it is less useful that it is done that way, with an external sw.
Alexander Stolte Expert Licensed User Longtime User Jan 21, 2021 #13 LucaMs said: If you think there are those who asked to automatically enter #End Region...! Click to expand... that was my wish Because on #IF the ide makes automatic an #END IF And this is what I notice every time I create a region.
LucaMs said: If you think there are those who asked to automatically enter #End Region...! Click to expand... that was my wish Because on #IF the ide makes automatic an #END IF And this is what I notice every time I create a region.
LucaMs Expert Licensed User Longtime User Jan 21, 2021 #14 aeric said: Would you share this app? Maybe someone would find it useful. Click to expand... version 1.0.1 ? (attached) Attachments CreateProperty.jar CreateProperty.jar 408.7 KB · Views: 550
aeric said: Would you share this app? Maybe someone would find it useful. Click to expand... version 1.0.1 ? (attached)
LucaMs Expert Licensed User Longtime User Jan 21, 2021 #15 Note: you don't even need to press CTRL + C to copy the generated source code ? LucaMs said: Any automatism that makes you save typing is always useful. Click to expand...
Note: you don't even need to press CTRL + C to copy the generated source code ? LucaMs said: Any automatism that makes you save typing is always useful. Click to expand...
Alexander Stolte Expert Licensed User Longtime User Jan 21, 2021 #16 LucaMs said: you don't even need to press CTRL + C to copy the generated source code ? Click to expand...
LucaMs said: you don't even need to press CTRL + C to copy the generated source code ? Click to expand...
LucaMs Expert Licensed User Longtime User Jan 21, 2021 #17 "New" version https://www.b4x.com/android/forum/threads/tool-property-generator.126789/post-793028
D Deleted member 103 Guest Jan 24, 2021 #18 Cableguy said: To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms Click to expand... 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.
Cableguy said: To me this is like creating à machine to take the fork from the dish to your mouth when you have two perfect working arms Click to expand... 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 Jan 26, 2021 #19 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.
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 Jan 26, 2021 #20 ilan said: 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. Click to expand... 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.
ilan said: 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. Click to expand... 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.