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

Thread: Header block for code

Hybrid View

  1. #1
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    484

    Header block for code

    I believe it is good practice to comment code.

    In VFP I have intellisence set so that if I type HB intellisence will add a header block to my code, such as prgs and class methods

    An example of this is

    *** Copyright Avian Management Services 2006
    *** {2006-08-03 16:53:18}
    #IF .F.
    TEXT
    ********************************
    * HELP BUILDER COMMENT BLOCK *
    ********************************
    *:Help Documentation
    *:Name:
    AVIAN_PDFOUTPUT.PRG
    *:Purpose:
    Outputs a report as PDF file using eReports
    *:Keywords:

    *:Parameters:
    tcReport: Name of the report to run
    tcOutPutFileName: The name of the output file. If blank will be same name as the report.
    tcOutPutDIR: The directory to save it in. If blank will be vfp temp dir
    tlFileNameUnique: If you want the output file name to be unique. Done by adding year month data and time to the end of the name.
    tlPreview: If you want to run the PDF file. Default will be .T.

    *:Returns:

    *:Remarks:

    *:Example:

    *:EndHelp
    ENDTEXT
    #ENDIF


    Would it be possible to have a menu option on the popup that does beautify to have an option of Add Head Block.
    This would read the text from a file, so the developer can modify it to look how they want and insert it into the code

    It would need to have ability to insert date time and program name. These could be marked in the file to be read as

    <<datetime()>>

    << Program Name>>

    Etc

    With the header blocks in code we could write a tool to read them and have the application be self documenting for the developer. We do this now in VFP using west Wind Help builder

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,681
    Hi David,

    v1.1 will have intellisense-like functionality. It's pretty much all done already but I have not turned it on as I have to go through the UI classes and setup the properties and methods with their descriptions for introspection.

    what you refer to would be better served by adding code snippets into the editor where you press a certain key and a drop down list of code snippet names is displayed in a dropdown listbox. You then choose what you want to insert from the list.

    sounds like a good ER for v1.1
    Last edited by barrymavin; 2013-07-26 at 22:37.
    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
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,923
    Quote Originally Posted by barrymavin View Post
    Hi David,

    v1.1 will have intellisense-like functionality. It's pretty much all done already but I have not turned it on as I have to go through the UI classes and setup the properties and methods with their descriptions for introspection.

    what you refer to would be better served by adding code snippets into the editor where you press a certain key and a drop down list of code snippet names is displayed in a dropdown listbox. You then choose what you want to insert from the list.

    sounds like a good ER for v1.1
    Speaking of which: we have access to the editor object. What editor objects attributes and methods are exposed and/or present?

    thanks,

    Hank

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,681
    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

  5. #5
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,923
    Quote Originally Posted by barrymavin View Post
    Right, I was wondering whether there were more attributes that could be exposed. With them, we could create extensions to do a number of things (thinking of CEECLone in VFP, or the header blocks David mentioned).

    thanks,

    Hank

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,681
    As I mentioned to David. V1.1 will include intellisense and code snippets if an ER is raised for them.
    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
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    484
    Hi Barry,

    The code snipped way sounds good to me. Look forward to V 1.1

  8. #8
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    484
    I'm trying to use this to set up a snippet for a prg header block

    I open the snippet editor and make an entry then save it

    Name:  snippit.png
Views: 38
Size:  46.0 KB

    Close the snippet editor with the X on the top right.

    Then in my prg type hb and then RETURN, nothing happens.

    When I go back into the snippet editor my entry can't be found

    Name:  snippi1.png
Views: 36
Size:  36.4 KB

    Any ideas on what I'm doing wrong?

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,681
    You click "new" then enter a snippet name. Add the code then click "Save".

    This works as part of intellisence. I just tested it to verify and its working as expected.

    type the first character of the snippet and wait the delay for intellisense to activate. You will see a popup list. Type further characters and the list is filtered. Press Tab to insert you snippet.

    That's all working for me but then I have intellisense turned on.
    Last edited by barrymavin; 2018-11-04 at 23:29.
    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
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    484
    Hi Barry,

    I did that but it does not seem to save the name. It gives it a blank entry for the name, as per the image below.

    If I close the snippet editor and then open it again and go to the blank entry in the names list, 3rd one down where the arrow is my code is there.

    I've tried to add the name again in that entry and save, but to no avail.

    The name I have tried is hb and I have also tried hb_header_block

    Name:  snippit3.png
Views: 33
Size:  58.5 KB

    Also when I now click on new it adds my header code to the script section of the snippet editor

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