Android Question add comments to class library properties

rbirago

Active Member
Licensed User
Longtime User
when I create a B4X library via IDE B4X generates comments for methods from the commented lines before the method itself...but how to generate coments for public properties or the whole class?

thank you

Roberto
 

DonManfred

Expert
Licensed User
Longtime User
but how to generate coments for public properties
Put getter and setter together. Add a command before them.

I don´t know how if it is possible to create a command for the hole class...

Inside a javawrapper you can using a special methodname...

Add this
B4X:
/**
     * The HTTP library allows you to communicate with web services and to download resources from the web.
     *As network communication can be slow and fragile this library handles the requests and responses in the background and raises events when a task is ready.
     *There are two HTTP examples which demonstrates this library: <link>Currency Converter|http://www.b4x.com/forum/basic4android-getting-started-tutorials/6506-currency-converter-http-web-services-more.html</link> and a more complex example: <link>Flickr Viewer|http://www.b4x.com/forum/basic4android-getting-started-tutorials/6646-flickr-viewer.html</link>.
     */
    public static void LIBRARY_DOC() {
      
    }
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
For public properties you could do like this:

'Get or set the Left value of the view
Public setLeft (value as int)
mLeft =value
End sub

Public In getLeft as int
Return mLeft
End sub

In this example, mLeft is a global variable, and the user , due to the lowercase set/get prefix, will get a unified Left property.
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
perhaps my question is not so clear...I try again:

if I create a B4X class that has for example one property and one method the lines are:

.....
dim MyProperty as string 'some value

.....

'multiply number1 and number2
sub MyMethod(Number1 as int, Number2 as int) as int
dim result as int = number1 * number2
return result
end sub
.....

When I COMPILE TO LIBRARY (via IDE) I will see by object browser my method and my property.
In the comments of MyMethod there is "multiply number1 and number2"....but how to fill comments in MyProperty?

I hope now it's clearer....

thanks

Roberto
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Did you have a look at the B4x CustomView Booklet?

B4X:
'sets or gets MyProperty
Private mMyProperty As String

Public Sub setMyProperty(My Property As String)
    mMyProperty = MyProperty
    'your code
End Sub

Public Sub getMyProperty As String
     'your code
    Return mMyProperty
End Sub

In Main:
B4X:
MyMethod.MyProperty = MyString
 
Upvote 0
Top