Get a Jumpstart with our Sample Apps
Results 1 to 2 of 2

Thread: First attempt at documneting components

  1. #1
    Real Name
    Steve Bovino
    Join Date
    Nov 2004
    Buffalo, NY

    Default First attempt at documenting components

    Below is some very rough code that demonstrates how to document each component in your project. I have found as my components multiply I wanted a way to have the data handy (mostly code imbedded in the component). Selwyn provided an undocumeted function that makes this possible.

    Create a code file and run this. The only prompt that will appear is a ui box signaling the process completed. In a matter of seconds (depends on how many componets) it will create two text files, one detailing the name and type of component, the other with the actuual xbasic code. It could be combined in one file. It also creates a database table called comp_docs in your current project directory with the name of the component, the type and the xbasic code. I will develop my documentation in the form of a report.

    As I said, it is rough. It could use more error checking and be incorporated in a nicely developed application format complete with user supplied input and prompts.

    Much of the documented text is courtesy of Alpha

    For now, it provides me usefull documentation for all of my components without having to open each one.


    'Date Created: 21-Feb-2007 01:30:39 PM
    'Last Updated: 21-Feb-2007 03:55:20 PM
    'Created By  : 
    'Updated By  : 
    dim DBpath as c
    dim shortname as c
    dim longname as c
    dim tbl as P
    dim xbasic as c
    dim result as c
    Dim comp_name as c
    Dim comp_type as c
    	shortname = "[default]\*.a5wcmp"
    	'the shortname has the projectname in [ ] 
    	longname = a5wcb_friendlyname_decode(shortname)
    	'the longname is the fully filename of the component
    	file_list = filefind.get(longname, 0, "PN")
    	'this creates an array of all the components in your project
      	 'this section creates text files detailing component info
      	  'and a database file to display the component data
      	'test for the existence of text files, if exist, remove 
      		if file.exists("c:\docs.txt") = .t. then
    		end if
    		if file.exists("c:\file_names.txt") = .t. then
    		end if
    	'create table for comp data
    	DBpath = a5.get_path()
    	table.field_add("comp_name", "c", 30)
    	tbl = table.create_end(Dbpath + "\\" + "comp_docs.dbf")
        'The create_end() method creates the table and assign an object pointer to the table
    	tbl ="comp_docs.dbf")
    	'process the array and populate table and text files
    	for each foo in file_list
        	if foo <> ""
    			xbasic = A5wcb_getGridInfo("xbasic",foo.value)
    			'the a5wcb_getGridInfo() function is for internal use and is therefore not documented.
    			'it is used to extract information from a saved component definition. even though the function name is a5wcb_getGridInfo()
    '			it can be used for other component types besides grids.
    			'the property that we want to extract is the 'xbasic' property.
    			'this is a string of xbasic code - the same code that you see in the Grid builder when you go to the Xbasic tab
    			result = evaluate_template(xbasic)
    			'the xbasic code in this string creates a dot variable (called 'tmpl') and assigns properties to 'tmpl'
    			'we want to execute the code in this variable so that 'tmpl' is instantiated.
    			'to do this we use the evaluate_template() function. if there are any xbasic errors in the code
    			'that is execute, then 'result' will be non-null
    			comp_type = tmpl.ComponentType ' set variables with different propoerties
    				if comp_type="NavigationSystem" ' check for navigation comp name
    					comp_name =
    					comp_name = tmpl.componentName ' dialog and grid use this property
    				End if
    			file.append("c:\file_names.txt",comp_name +  "  " + comp_type + crlf(1))
    			tbl.comp_name = comp_name
        		tbl.Comp_Xbasic = xbasic
    			tbl.comp_type = comp_type
      	end if
    FILE_ADD_TO_DB(Dbpath + "\\" + "comp_docs.dbf")
    ui_msg_box("Done!","The process has been completed.")
    Last edited by Steve Bovino; 02-21-2007 at 05:58 PM. Reason: can't spell

  2. #2
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Bay Area, California

    Default Re: First attempt at documenting components

    Thank Steve. We need more of documentation functions like a5wcb_getGridInfo(); one that shows how security is applied would be great.

    Now, I need to extract just the portion of tmpl that defines the fields to display. The sections look like this:

    with tmpl.field_info[1]
    	.Fieldname = "Id"
    	.Scope = "Local"
    	.DisplayFormat = ""
    	.DisplayUnFormat = ""
    	.ConditionalStyle = ""
    	.ConditionalStyleLevel = "Cell"
    	.ClientSideConditionalStyle = ""
    I wondered if this non-documented function has parameters to let me extract just that part? Right now a5wcb_getGridInfo() lists the entire xbasic for the grid.
    Steve Wood
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

Similar Threads

  1. Should a newbie attempt this?
    By smrogers in forum Alpha Five Version 7
    Replies: 9
    Last Post: 10-14-2007, 12:42 AM
  2. Lost Components
    By gboot1tc in forum Web Application Server v7
    Replies: 45
    Last Post: 12-05-2006, 04:33 PM
  3. Corrupt Components
    By graysarge in forum Web Application Server v7
    Replies: 8
    Last Post: 04-06-2006, 07:48 PM
  4. Web components
    By John Haytko in forum Alpha Five Version 6
    Replies: 3
    Last Post: 08-09-2004, 07:05 AM
  5. another attempt at file attach
    By eeetee in forum Alpha Five Version 4
    Replies: 1
    Last Post: 12-17-2002, 07:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts