Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: object's properties, methods

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    239

    Question object's properties, methods

    How to find out in Lianja what properties / methods of an object exist?
    In VFP, the amembers() function returns a 2-dimensional array, with the names of properties / methods in the first column and "Property" / "Method" / "Event" in the second column.
    Is there a corresponding function in Lianja?

  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    HI,

    Lianja has amembers(): https://www.lianja.com/doc/index.php/AMEMBERS()

    As the Doc notes, it does not support UI Framework classes.

    Hank

  3. #3
    Senior Member
    Join Date
    Oct 2012
    Posts
    239
    here is the code:
    Code:
    define class myForm as custom
       alias = ""
       szimbol = ""
       procedure setup 
            alias = "my_alias"
       endproc
       procedure main
            szimbol = "my_szimboL"
       endproc
    enddefine
    
    procedure _amember
    private oForm
    private array aRy[2,2]
      oForm = createobject("myForm")
      amembers(aRy,oForm,1)
    for i = 1 to alen(aRy,1)
      ? iif(!empty(aRy[i,1]),aRy[i,1],""),iif(!empty(aRy[i,2]),aRy[i,2],"")
    endfor
    running in VFP, and the result:
    Code:
    ADDOBJECT    Method 
    ADDPROPERTY     Method 
    ALIAS  Property
    BASECLASS     Property
    CLASS   Property
    CLASSLIBRARY     Property
    COMMENT    Property
    CONTROLCOUNT      Property
    CONTROLS    Property
    DESTROY    Event
    ERROR   Event
    HEIGHT  Property
    HELPCONTEXTID    Property
    INIT Event
    LEFT  Property
    MAIN  Method 
    NAME   Property
    NEWOBJECT    Method 
    OBJECTS   Property
    PARENT   Property
    PARENTCLASS     Property
    PICTURE  Property
    READEXPRESSION     Method 
    READMETHOD     Method 
    REMOVEOBJECT     Method 
    RESETTODEFAULT     Method 
    SAVEASCLASS      Method 
    SETUP  Method 
    SHOWWHATSTHIS      Method 
    SZIMBOL   Property
    TAG  Property
    TOP  Property
    WHATSTHISHELPID     Property
    WIDTH  Property
    WRITEEXPRESSION     Method 
    WRITEMETHOD     Method
    the same in Lianja (with a little modif, since Lianja's amember() has only 2 paremeters:
    Code:
    define class myForm as custom
       alias = ""
       szimbol = ""
       procedure setup 
            alias = "my_alias"
       endproc
       procedure main
            szimbol = "my_szimboL"
       endproc
    enddefine
    
    procedure _amember
    private oForm
    private array aRy[2,2]
      oForm = createobject("myForm")
      amembers(aRy,oForm)
    for i = 1 to alen(aRy,1)
      ? iif(!empty(aRy[i,1]),aRy[i,1],""),iif(!empty(aRy[i,2]),aRy[i,2],"")
    endfor
    and the result:
    Code:
     ALIAS
     SZIMBOL

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi,

    FORM is a member of the UI Framework, and therefore per the docs is not covered by amembers().

    Presumably if you were to write your own class, not based on the UI Framework classes, it would work. It only does properties, however, per the docs, as your custom class example demonstrates.

    If you want it to do more, go to the Tickets on the main site Menu and file an Enhancement Request.

    Hank
    Last edited by HankFay; 2021-12-17 at 17:44.

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Hi Hank

    He is just creating a. CUSTOM class which is non UI.

    As per VFP if the third parameter is omitted or zero…

    Put only a list of oObject's properties in ArrayName. In this case, ArrayName is one-dimensional. VFP objects only.

    So Lianja works the same as it does not support the third parameter.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi Barry,

    Right. And if he wants it to support the 3rd parameter he can file an Enhancement Request, making the case for the utility of this enhancement.

    For those reading: my batting average is 1.000 for ER's when I can make a significant Use Case. If it's just a "it would be nice" ER, my average is well about .500.

    Hank

  7. #7
    Senior Member
    Join Date
    Oct 2012
    Posts
    239
    hi Hank
    "use case" is: I have a relatively large system in VFP that works to examine the structure of an object (at any depth) and works according to what methods an object has.
    I know that all problems can be solved in many ways, so I could reorganize the system e.g. with the try-catch structure. However, it would be more work for me than to query the existing methods of an object.
    I will ask for an ER if Barry suggests it. For now, I asked if there was a way in Lianja to query the existing methods of an object.

  8. #8
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi strato,

    And in this case, the Docs already had the answer.

    Hank

  9. #9
    Senior Member
    Join Date
    Oct 2012
    Posts
    239
    sorry Hank, can you help me? What is the answer in the doc? How do I know the names of existing methods in an object?

  10. #10
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi Strato,

    I posted a link to the amembers Doc in response to your first message in this thread. Did you click on it and read it?

    To summarize the document:

    1) amembers covers properties only

    2) amembers does not work with UI Framework classes.

    If you want it to do differently than the Doc states, a) file an Enhancement Request in which b) you make the case for it to be enhanced. When I am making the case, I typically present a Use Case, which I show a need for the change in a common programming situation. If there is no alternative to having the change, all the better. If it's a common need (more than 1 developer), even better.

    Hank

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us