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

Thread: Question/Suggestion for Importer

  1. #1
    Member
    Join Date
    Feb 2012
    Location
    Ontario, Canada
    Posts
    98

    Question/Suggestion for Importer

    Barry

    I know sometimes we ask for more than what is possible or even doable. I just recently discoverered you can view program code for SCX files through VFP using Tools - Class Browser and I have to admit it is much easier to read code when all controls (via ADD OBJECT) are contained in the FORM CLASS. However the code generated is not excutable through VFP since container nesting is not supported for ADD OBJECT and Event/Method Procedure names.

    Is it possible for Lianja to handle container nesting for ADD OBJECT and Event/Method Procedure names? If not then is it possible for the IMPORTER to only generate DEFINE CLASS for containers? I have played around running VFP Class Browser code in Lianja and it appears to work fine after moving code into containers and properly ordering as per container nesting.

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,081
    Robert, can you let provide me a small code snippet that demonstrates what you want the importer to achieve. Show me the code vfp is unable to execute exactly.
    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

  3. #3
    Member
    Join Date
    Feb 2012
    Location
    Ontario, Canada
    Posts
    98
    Here is a Form containing a Pageframe with 2 controls in Page1. The form and both controls are subclassed. This is the code generated from the Class Browser. The commandsub1 procedure name does not show the nested container.

    DEFINE CLASS formsub1 AS formsub

    Top = 3
    Left = 4
    DoCreate = .T.
    Caption = "Form2"
    Name = "Formsub1"

    ADD OBJECT pageframe1 AS pageframe WITH ;
    ErasePage = .T., ;
    PageCount = 2, ;
    Top = 12, ;
    Left = 12, ;
    Width = 348, ;
    Height = 228, ;
    Name = "Pageframe1", ;
    Page1.Caption = "Page1", ;
    Page1.Name = "Page1", ;
    Page2.Caption = "Page2", ;
    Page2.Name = "Page2"

    ADD OBJECT formsub1.pageframe1.page1.labelsub1 AS labelsub WITH ;
    Left = 152, ;
    Top = 56, ;
    Name = "Labelsub1"

    ADD OBJECT formsub1.pageframe1.page1.commandsub1 AS commandsub WITH ;
    Top = 152, ;
    Left = 130, ;
    Height = 27, ;
    Name = "Commandsub1"

    PROCEDURE commandsub1.Click
    THISFORM.RELEASE
    ENDPROC

    ENDDEFINE

  4. #4
    Member
    Join Date
    Feb 2012
    Location
    Ontario, Canada
    Posts
    98
    If I change the code to only show the container classes, this runs in Lianja.

    define class page1_3qe0t5ay0 as page

    ** Properties
    Caption = "Page1"
    Name = "Page1"

    ADD OBJECT labelsub1 AS labelsub WITH ;
    Left = 72, ;
    Top = 48, ;
    Name = "Labelsub1"

    ADD OBJECT commandsub1 AS commandsub WITH ;
    Top = 144, ;
    Left = 120, ;
    Height = 27, ;
    Name = "Commandsub1"

    ** Methods
    PROCEDURE commandsub1.Click
    THISFORM.RELEASE

    ENDPROC

    enddefine

    define class page2_3qe0t5ay0 as page

    ** Properties
    Caption = "Page2"
    Name = "Page2"

    enddefine

    define class pageframe1_3qe0t5ay0 as pageframe

    ** Properties
    ErasePage = .T.
    PageCount = 0
    Top = 12
    Left = 12
    Width = 348
    Height = 228
    Name = "Pageframe1"

    ADD OBJECT page1 AS page1_3qe0t5ay0
    ADD OBJECT page2 AS page2_3qe0t5ay0

    enddefine

    ////////////////////////////////////////////////////////////////////////////////
    define class formsub1 as formsub

    ** Children
    add object pageframe1 as pageframe1_3qe0t5ay0

    ** Properties
    DoCreate = .T.
    Caption = "Form2"
    Name = "Formsub1"

    enddefine

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,081
    Hmm the code generated by the class browser is not exactly readable. It's combining lots of classes together with no define class body for them.

    So what you are saying is that vfp can't handle nested ADD OBJECT commands inside container classes as Lianja can. The class browser is treating them as anonymous classes. I'd be interested to see what it does with container methods in these anonymous classes.

    i guess my question is, what are you wanting to achieve? Import the scx files into Lianja or run the code that Lianja generates under vfp?
    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 Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,081
    Ah I see now. This is just the way the class browser is generating the code. Vfp in fact is creating the form by reading the scx file.

    How vfp creates the form is not how the class browser sees it as they are two different things entirely.
    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

  7. #7
    Member
    Join Date
    Feb 2012
    Location
    Ontario, Canada
    Posts
    98
    I not sure what you mean when you say not exactly readable. This first output above creates the smallest code file and you can read it top to bottom. The DEFINE CLASS body for each control is handled in the ADD OBJECT.

    *** Are you saying Lianja can handle ADD OBJECT container2.container3.controlname inside container1?

    I only want to import SCX into Lianja and move forward from there - I have no interest to run anything through VFP.

  8. #8
    Member
    Join Date
    Feb 2012
    Location
    Ontario, Canada
    Posts
    98
    Sorry - I replied just after you did. The Class Browser code is not executable through VFP - It is more intended for source code control.

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,081
    What I am saying is the class browser is not generating proper class definitions. It is implictly creating objects on the add object command. Anyway, no. That strange syntax of implicitly reference unknown classes is not supported.

    ADD OBJECT formsub1.pageframe1.page1.labelsub1 AS labelsub WITH ;
    Left = 152, ;
    Top = 56, ;
    Name = "Labelsub1"

    Page1 is not a class it's an implicit object in the pageframe class so it cannot be treated as a class in ADD OBJECT.


    So, forget the code the class browser is generating that was an addon written in vfp itself not actually part of the vfp engine.

    ok. Can we get back to the original issue you reported and fix the importer so it reads te scx file and generates code that will run under Lianja.

    Your original issue is to do with the beautifier is that correct?
    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

  10. #10
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,081
    Well that's not surprising looking at what it generated.

    What we need to do is solve the forward referencing of classes is that correct?

    (sorry about the typos I'm on my iPad)
    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

Page 1 of 2 12 LastLast

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