Programming Reference Guides

Programming Reference Guides

Postby xProgrammer » Sun Aug 24, 2008 12:48 pm

Hi all

What does everyone use when writing their code. I have the xHarbour Language Reference Guide version 1.1 (I had an enterprise subscription) that I assume is copyright. The information is pretty good (although it pretty much ignores any Linux consideration) and some of the navigation is either awkward or not working correctly. Its a pdf and I think subject to commercial copyright?

I also have a pdf Harbour Guide which I assume is copyright also but free to use and distribute? Navigation doesn't work correctly in my copy of that either - I think pagination was changed after the links were established.

Antonio has produced some nice documentation on FiveWin (I probably don't have the latest) and more basic but quite good on Five Linux but not really designed for quick on-line use.

I would like to be able to quickly call up documentation on a particular function or class or command etc in a little on line application. Does one exist? Should one exist?

I did just have a quick look at the Harbour Guide and copied the text to a text file and then wrote a quick and dirty xBase program to split up each topic and put it into a memo field and extract the topic (title) and copy it to another field. So that might be a rather crude beginning for a partial system if indeed none really exists.

I have found that even with the rather classy xHarbour reference I have had to use the Harbour guide for functions such as __ObjSetValueList().

Any suggestions / comments ?

Happy coding

xProgrammer
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Mon Aug 25, 2008 10:49 am

Doug,

For standard Clipper docs, you can use:
http://www.ousob.com/ng/53guide/
http://www.ousob.com/ng/cltech/

For specific Harbour info, you can review its source code. It helps many times.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xProgrammer » Wed Aug 27, 2008 5:45 am

Hi Antonio

Thanks for the information.

Since I am still frustrated by the awkwardness of finding information in the available documentation I thought that a useful first step might be to convert the Harbour Guide to a series of html pages, a process which I have commenced. About 80 to 90% of the conversion I have been able to do with a little xHarbour program I wrote for the purpose but then comes the tedious task of doing the remaining changes and putting togther "index pages". To date I have converted topics that begin with A through C and T through Z plus made a start on D, S and I. To give you an idea of the output here's the html for a sample page:

Code: Select all  Expand view  RUN
<html><head><title>    ACOPY()                                                     </title></head><body><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_functions.html">Functions</a> <a href="hf_array.html">Array-Functions</a><hr>
    <h1>ACOPY()</h1><p>
Copy elements from one array to another
  </p><h3>Syntax</h3><p>
      ACOPY( <var>&lt;aSource&gt;</var>, <var>&lt;aTarget&gt;</var>, [<var>&lt;nStart&gt;</var>], [<var>&lt;nCount&gt;</var>], [<var>&lt;nTargetPos&gt;</var>] )
      --&gt; aTarget
  </p><h3>Arguments</h3><p>
       <var>&lt;aSource&gt;</var>  is the array to copy elements from.<br/><br/>
       <var>&lt;aTarget&gt;</var>  is the array to copy elements to.<br/><br/>
       <var>&lt;nStart&gt;</var>   is the beginning subscript position to copy from <var>&lt;aSource&gt;</var><br/><br/>
       <var>&lt;nCount&gt;</var>   the number of subscript elements to copy from <var>&lt;aSource&gt;</var>.<br/><br/>
       <var>&lt;nTargetPos&gt;</var>  the starting subscript position in <var>&lt;aTarget&gt;</var> to copy elements
       to.
  </p><h3>Returns</h3><p>
       <var>&lt;aTarget&gt;</var>  an array pointer reference
  </p><h3>Description</h3><p>
       This function copies array elements from <var>&lt;aSource&gt;</var> to <var>&lt;aTarget&gt;</var>. <var>&lt;nStart&gt;</var> is
       the beginning element to be copied from <var>&lt;aSource&gt;</var>; the default is 1.</p><p>
       <var>&lt;nCount&gt;</var> is the number of elements to be copied from <var>&lt;aSource&gt;</var>;   the default
       is the entire array.</p><p>
       <var>&lt;nTargetPos&gt;</var> is the subscript number in the target array,<var>&lt;aTarget&gt;</var>,   to which
       array elements are to be copied; the default is 1<p></p>
       This function will copy all data types in <var>&lt;aSource&gt;</var> to <var>&lt;aTarget&gt;</var>.
       If an array element in <var>&lt;aSource&gt;</var> is a pointer reference to another array,
       that array pointer will be copied to <var>&lt;aTarget&gt;</var>; not all subdimensions will be
       copied from one array to the next. This must be accomplished via the ACLONE()
       function.<p></p>
       Note If array <var>&lt;aSource&gt;</var> is larger then <var>&lt;aTarget&gt;</var>, array elements will start
       copying at <var>&lt;nTargetPos&gt;</var> and continue copying until the end of array <var>&lt;aTarget&gt;</var> is
       reached. The ACOPY() function doesn't append subscript positions to the target
       array, the size of the target array <var>&lt;aTarget&gt;</var> remains constant.
  </p><h3>Examples</h3><pre>
      LOCAL nCount := 2, nStart := 1, aOne, aTwo
      aOne := {"HABOUR"," is ","POWER"}
      aTwo := {"CLIPPER"," was ","POWER"}
      ACOPY(aOne, aTwo, nStart, nCount)
  </pre><h3>Status</h3><p>
       Ready
  </p><h3>Compliance</h3><p>
       This function is CA Clipper compliant
  </p><h3>Files</h3><p>
       Library is vm
</p><h3>See Also</h3><p>
    <a href="h_ACLONE.html">ACLONE()</a>
    <a href="h_ADEL.html">ADEL()</a>
    <a href="h_AEVAL.html">AEVAL()</a>
    <a href="h_AFILL.html">AFILL()</a>
    <a href="h_AINS.html">AINS()</a>
    <a href="h_ASORT.html">ASORT()</a>
<br/><hr><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_functions.html">Functions</a> <a href="hf_array.html">Array-Functions</a></body></html>


I will have an alphabetical index but also you will see from the header and the footer that I am producing functional indexes too such as this one for array functions:

Code: Select all  Expand view  RUN
<html><head><title>(Harbour) ARRAY FUNCTIONS</title></head><body><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_functions.html">Functions</a> <hr>
    <h1>(Harbour) ARRAY FUNCTIONS</h1><p>
<br/>
<a href="h_AADD.html">AADD()</a><br/>
<a href="h_ACHOICE.html">ACHOICE()</a><br/>
<a href="h_ACLONE.html">ACLONE()</a><br/>
<a href="h_ACOPY.html">ACOPY()</a><br/>
<a href="h_ADEL.html">ADEL()</a><br/>
<a href="h_ADIR.html">ADIR()</a><br/>
<a href="h_AEVAL.html">AEVAL()</a><br/>
<a href="h_AFIELDS.html">AFIELDS()</a><br/>
<a href="h_AFILL.html">AFILL()</a><br/>
<a href="h_AINS.html">AINS()</a><br/>
<a href="h_ARRAY.html">ARRAY()</a><br/>
<a href="h_ASCAN.html">ASCAN()</a><br/>
<a href="h_ASIZE.html">ASIZE()</a><br/>
<a href="h_ASORT.html">ASORT()</a><br/>
<a href="h_ATAIL.html">ATAIL()</a><br/>
<a href="h_LEN.html">LEN()</a><br/>

<br/><hr><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_functions.html">Functions</a> </body></html>


Currently I have entries in the following groupings (more will no doubt come as I convert more pages)

Code: Select all  Expand view  RUN
<html><head><title>Harbour Functions</title></head><body><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <hr>
    <h1>HARBOUR FUNCTIONS</h1><p>
<a href="hf_array.html">Array-Functions</a><br/>
<a href="hf_control.html">Control-Functions</a><br/>
<a href="hf_convert.html">Conversion-Functions</a><br/>
<a href="hf_datafile.html">Data-File-Functions</a><br/>
<a href="hf_date.html">Date-Functions</a><br/>
<a href="hf_filesystem.html">File-System-Functions</a><br/>
<a href="hf_internal.html">Internal-Functions</a><br/>
<a href="hf_keyboard.html">Keyboard-Functions</a><br/>
<a href="hf_maths.html">Mathematical-Functions</a><br/>
<a href="hf_screen.html">Screen-Functions</a><br/>
<a href="hf_string.html">String-Functions</a><br/>
<a href="hf_test.html">Test-Functions</a><br/>
<a href="hf_time.html">Time-Functions</a><br/>
<a href="hf_UI.html">UI-Functions</a>

<br/><hr><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a>  </body></html>


I'm not just converting pages related to functions as you can see from this higher level page

Code: Select all  Expand view  RUN
<html><head><title>HARBOUR DOCUMENTATION</title></head><body><a href="xbase.html">xBase</a> <hr>
    <h1>HARBOUR DOCUMENTATION</h1><p>
<br/>
<a href="h_commands.html">Harbour-Commands</a><br/>
<a href="h_functions.html">Harbour-Functions</a><br/>
<a href="h_information.html">Harbour-Information</a><br/>
<a href="h_objects.html">Harbour-Objects</a><br/>
<a href="h_setcommands.html">Harbour-Set-Commands</a><br/>

<br/><hr><a href="xbase.html">xBase</a> </body></html>


Eventually I would like to have Five Linux, xHarbour as entries form the top level screen

Code: Select all  Expand view  RUN
<html><head><title>xBase DOCUMENTATION</title></head><body> <hr>
    <h1>xBase DOCUMENTATION</h1><p>
<br/>
<a href="harbour.html">Harbour-Documentation</a>
<br/><hr> </body></html>


There are lots of maybes if other people are interested in this type of project. Perhaps someone might like to work on documenting FiveWin in the same or a similar format? I want to look in greater depth at the best format for documenting classes/objects but have converted the page for Harbour's TBROWSENew. I will include it in my next post.

Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby xProgrammer » Wed Aug 27, 2008 5:58 am

Hi Antonio

Herewith the page for TBROWSENew as a sample of the sort of layout one might use for Five Linux (or Five Win) classes.

Code: Select all  Expand view  RUN
<html><head><title>TBROWSENew()</title></head><body><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_objects.html">Objects</a> <hr>
    <h1>TBROWSENew()</h1><p>
Create a Browse Object
</p><h3>Constructor syntax</h3><p>
      TBROWSENew(<var>&lt;nTop&gt;</var>,<var>&lt;nLeft&gt;</var>,<var>&lt;nBottom&gt;</var>,<var>&lt;nRight&gt;</var>)    --&gt; <var>&lt;oBrowse&gt;</var>
  </p><h3>Arguments</h3><p>
       <var>&lt;nTop&gt;</var>      Top Row</p><p>
       <var>&lt;nLeft&gt;</var>     Top Left Column</p><p>
       <var>&lt;nBottom&gt;</var>   Bottom Row</p><p>
       <var>&lt;nRight&gt;</var>    Bottom Right Column</p><p>
  </p><h3>Returns</h3><p>
       <var>&lt;oBrowse&gt;</var>    An new Browse Object
  </p><h3>Description</h3><p>
       This function set up a browsing window at top-left coordinates of
       <var>&lt;nTop&gt;</var>,<var>&lt;nLeft&gt;</var> to bottom-right coordinates of <var>&lt;nBottom&gt;</var>,<var>&lt;nRight&gt;</var>.     To browse
       Database files use TBROWSEDB() function instead.</p>
       <h4>Properties:</h4>
  <table><thead><td>Property</td><td>Purpose</td></thead><tr><td>
       :aColumns</td><td>Array to hold all browse columns</td></tr><tr><td>
       :autoLite</td><td>Logical value to control highlighting</td></tr><tr><td>
       :cargo</td><td>User-definable variable</td></tr><tr><td>
       :colorSpec</td><td>Color table for the TBrowse display</td></tr><tr><td>
       :colPos</td><td>Current cursor column position</td></tr><tr><td>
       :colSep</td><td>Column separator character</td></tr><tr><td>
       :footSep</td><td>Footing separator character</td></tr><tr><td>
       :freeze</td><td>Number of columns to freeze</td></tr><tr><td>
       :goBottomBlock</td><td>Code block executed by TBrowse:goBottom()</td></tr><tr><td>
       :goTopBlock</td><td>Code block executed by TBrowse:goTop()</td></tr><tr><td>
       :headSep</td><td>Heading separator character</td></tr><tr><td>
       :hitBottom</td><td>Indicates the end of available data</td></tr><tr><td>
       :hitTop</td><td>Indicates the beginning of available data</td></tr><tr><td>
       :leftVisible</td><td>Indicates position of leftmost unfrozen column in display</td></tr><tr><td>
       :nBottom</td><td>Bottom row number for the TBrowse display</td></tr><tr><td>
       :nLeft</td><td>Leftmost column for the TBrowse display</td></tr><tr><td>
       :nRight</td><td>Rightmost column for the TBrowse display</td></tr><tr><td>
       :nTop</td><td>Top row number for the TBrowse display</td></tr><tr><td>
       :rightVisible</td><td>Indicates position of rightmost unfrozen column in display</td></tr><tr><td>
       :rowCount</td><td>Number of visible data rows in the TBrowse display</td></tr><tr><td>
       :rowPos</td><td>Current cursor row position</td></tr><tr><td>
       :skipBlock</td><td>Code block used to reposition data source</td></tr><tr><td>
       :stable</td><td>Indicates if the TBrowse object is stable</td></tr><tr><td>
    :aRedraw</td><td>Array of logical items indicating, is appropriate row need to be redraw</td></tr><tr><td>
    :RelativePos</td><td>Indicates record position relatively position of first record on the screen</td></tr><tr><td>
    :lHeaders</td><td>Internal variable which indicates whether there are column footers to paint</td></tr><tr><td>
    :lFooters</td><td>Internal variable which indicates whether there are column footers to paint</td></tr><tr><td>
    :aRect</td><td>The rectangle specified with ColorRect()</td></tr><tr><td>
    :aRectColor</td><td>The color positions to use in the rectangle specified with ColorRect()</td></tr><tr><td>
    :aKeys</td><td>Holds the Default movement keys</td></tr></table>
<h4>Methods:</h4>
  <table><thead><td>Method</td><td>Purpose</td></thead><tr><td>
    New(nTop, nLeft, nBottom, nRight)</td><td>Create an new Browse class and set the default values</td></tr><tr><td>
    Down()</td><td>Moves the cursor down one row</td></tr><tr><td>
    End()</td><td>Moves the cursor to the rightmost visible data column</td></tr><tr><td>
    GoBottom()</td><td>Repositions the data source to the bottom of file</td></tr><tr><td>
    GoTop()</td><td>Repositions the data source to the top of file</td></tr><tr><td>
    Home()</td><td>Moves the cursor to the leftmost visible data column</td></tr><tr><td>
    Left()</td><td>Moves the cursor left one column</td></tr><tr><td>
    PageDown()</td><td>Repositions the data source downward</td></tr><tr><td>
    PageUp()</td><td>Repositions the data source upward</td></tr><tr><td>
    PanEnd()</td><td>Moves the cursor to the rightmost data column</td></tr><tr><td>
    PanHome()</td><td>Moves the cursor to the leftmost visible data column</td></tr><tr><td>
    PanLeft()</td><td>Pans left without changing the cursor position</td></tr><tr><td>
    PanRight()</td><td>Pans right without changing the cursor position</td></tr><tr><td>
    Right()</td><td>Moves the cursor right one column</td></tr><tr><td>
    Up()</td><td>Moves the cursor up one row</td></tr><tr><td>
    ColCount()</td><td>Return the Current number of Columns</td></tr><tr><td>
    ColorRect()</td><td>Alters the color of a rectangular group of cells</td></tr><tr><td>
    ColWidth( nColumn )</td><td>Returns the display width of a particular column</td></tr><tr><td>
    Configure( nMode )</td><td>Reconfigures the internal settings of the TBrowse object</td></tr><tr><td>
    LeftDetermine()</td><td>Determine leftmost unfrozen column in display</td></tr><tr><td>
    DeHilite()</td><td>Dehighlights the current cell</td></tr><tr><td>
    DelColumn( nPos )</td><td>Delete a column object from a browse</td></tr><tr><td>
    ForceStable()</td><td>Performs a full stabilization</td></tr><tr><td>
    GetColumn( nColumn )</td><td>Gets a specific TBColumn object</td></tr><tr><td>
    Hilite()</td><td>Highlights the current cell</td></tr><tr><td>
    InsColumn( nPos, oCol )</td><td>Insert a column object in a browse</td></tr><tr><td>
    Invalidate()</td><td>Forces entire redraw during next stabilization</td></tr><tr><td>
    RefreshAll()</td><td>Causes all data to be recalculated during the next stabilize</td></tr><tr><td>
    RefreshCurrent()</td><td>Causes the current row to be refilled and repainted on next stabilize</td></tr><tr><td>
    SetColumn( nColumn, oCol )</td><td>Replaces one TBColumn object with another</td></tr><tr><td>
    Stabilize()</td><td>Performs incremental stabilization</td></tr><tr><td>
    DispCell( nColumn, cColor )</td><td>Displays a single cell</td></tr></table>

<p>nMode is an undocumented parameter in CA-Cl*pper
</p><h3>Examples</h3><e>
     See tests/testbrw.prg
</p><h3>Tests</h3><p>
     See tests/testbrw.prg
</p><h3>Status</h3><p>
      Started
</p><h3>Compliance</h3><p>
      This functions is Compatible with Ca-Clipper 5.2. The applykey() and    Setkey()
      methods are only visible if HB_COMPAT_C53 is defined.
</p><h3>Platforms</h3><p>
      All
</p><h3>Files</h3><p>
      Library is rtl
</p><h3>See Also</h3><p>
   <a href="h_TBROWSEDB.html">TBROWSEDB()</a>
<br/><hr><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_objects.html">Objects</a> </body></html>


I am learning as I go because I didn't have this information when I started and tend only to look at the documentation (such as it is) when I need to know how to do something or to check syntax. But the result of this is that it is easy to overlook helpful features / opportunities.

I also note the number of times people have asked questions in these forums about doing something in FiveWin only to find out that there is a method available in the appropriate class that does exactly what they want but it wasn't in the documentation and they didn't look at the source code.

Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby xProgrammer » Wed Aug 27, 2008 6:04 am

Hi Antonio

I am also converting "information pages", for example:

Code: Select all  Expand view  RUN
<html><head><title>Strong Typing</title></head><body><a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_information.html">Information</a> <hr>
    <h1>Strong Typing</h1><p>
Compile-Time type checking
  </p><h3>Description</h3><p>
       Strong Type Checking, could also be described as "Compile-Time Type
       Checking". As you might know Clipper, generates a Run-Time Error, ("Type
       Mismatch") when we attempt to perform some operations with the wrong type of
       Variable.
       </p><h3>Examples</h3><pre>:
       LOCAL Var1 := "A"
       ? Var1 * 3 // Error here.
       @ Var1, 7 SAY 'Hello' // Error here.
       ? SubStr( "Hello", Var1 ) // Error here.
</pre><p>
       The above 3 lines would all result in Run-Time Error, because Var1 is  of type
       CHARACTER but the above lines used it as if it was of type NUMERIC.</p><p>
       Using Strong Type Checking, or Compile-Time Type Checking, the above problem
       would have been discovered and reported in COMPILE-TIME, rather than waiting for
       the inevitable problem to be discovered when we finally execute the program.
       Strong Typed Languages allow the programmer to "tell" the compiler (declare)
       what is the type of a each Variable, so that the Compiler in return can warn the
       programmer, when ever such Declared (Strong Typed) Variable, is used in a context
       which is incompatible with its declared type.</p><p>
       For instance, if we "told" the compiler that Var1 above is of type CHARACTER</p><pre>
       LOCAL Var1 AS CHARACTER </pre><p>the Harbour Compiler could, in return, warn us if we
       attempted to perform the calculation:</p><pre>
       Var1 * 3</pre><p>
       because the Compiler knows we can't perform a multiplication of a Character.
       (we might allow it in some context, but this is beyond the scope of this
       discussion). Similarly we would have been warned when attempting to use Var1 as a
       Row Number </p><pre> @ Var1 </pre><p> or as the 2nd operand of the SubStr() function </p>
       <pre>SubStr("Hello", Var1) </pre><p> because the Compiler knows that these operations require a
       NUMERIC rather than CHARACTER type.</p><p>
       The above may save us lots of time, by pointing a problem, we can not escape,
       since such code will never perform correctly once executed. So rather than wait to
       the testing cycle, for such problems to be discovered, (and some times even later,
       after we may have distributed our applications) instead we may know of such
       problems as soon as we type </p><pre>HARBOUR ProgName -w3</pre><p>
       Harbour also offers a hybrid mode, where it can report such type mismatch
       problems, even without requiring the programmer to declare the type of variables.
       This feature, is referred to as Adaptive Type Checking. The programmer, is not
       required to make any changes in his code, to take advantage of this feature. All of
       the above 3 errors would have been reported just as effectively as if the
       programmer Strong Typed (declared) Var1. Harbour would have been able to report
       such problems at compile time,because the assignment</p><pre> Var1 := "A" </pre><p>implied that Var1
       is of type CHARACTER,until it will be assigned another value. Therefore Harbour
       will "remember" that Var1 "adapted" type CHARACTER, and thus the subsequent
       multiplication</p><pre>Var1 * 3</pre><p> will be reported as an error, as soon as you attempt to
       compile such code.</p><p>
       The nice aspect of this hybrid mode, is that unlike Strong Typed
       Variables,you don't have to declare the type, so no code changes are need, the
       Type instead is assumed by implication (type of the assigned value). The other
       benefit, is that it is completely ok to assign a new value of different type, any
       time, to such undeclared (variant) variable. As soon as we assign a new type, the
       Compiler will than protect us from using the Variable in an incompatible context,
       since the variable "adapted" this type as soon as we assigned a value which implies
       a type.</p><p>
       While Adapted Type Checking may be fairly effective in reporting many common
       mistakes, to take full benefits of such Compile-Time checking, it is recommended
       to do declare the Type of Variables, when ever possible.</p><p>
The Harbour Strong Type features, also allows the declaration of the expected
parameters (including optionals) of User Defined Functions, as well as their
return Type. Similarly, you may declare the Type of any Class Variables, Methods,
and Methods Parameters.</p><hr>
<a href="xbase.html">xBase</a> <a href="harbour.html">Harbour</a> <a href="h_information.html">Information</a>


I realise that the documentation has its limitations - it isn't at all comprehensive, its not consistent, some of the examples aren't that illustrative etc. But it seems like a great starting point if I can get a number of people using it and improving it. I would like to convert the xHarbour documentation and cross reference the two but as it is / was a product you had to pay for that may not be legally possible.

Would you mind me putting FiveLinux documentation in such a form?

Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Wed Aug 27, 2008 6:53 am

Doug,

We can give you write access to our Wiki where you could upload all the FiveLinux docs and modify them, enhance them, etc. so other users may cooperate too:

www.fivetechsoft.com/wiki

Edited: I just reviewed it now, and I saw that we already gave you write access to it, but you have not used it yet :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Programming Reference Guides

Postby Patrick Mast » Wed Aug 27, 2008 4:18 pm

Hello,

I always use our online xHDN (xHarbour Developers Network) pages to lok up anything regarding xHarbour. http://www.xHarbour.com/xHDN

Its always up to date.

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby xProgrammer » Fri Aug 29, 2008 7:02 am

Hi all

I've done a page for the FiveLinux TWindow Class. I'm trying to make the layout / contents easy to use / follow. I would be interested in comments / suggestions. I have started with TWindow because this information should probably be included on pages relating to its many subclasses. Its easy to overlook capabilities of parent classes when using their child classes.

Regards
xProgrammer

Code: Select all  Expand view  RUN
<html>
<head>
<title>TWindow Class</title>
</head>
<body>
<h1>TWindow Class</h1>
An object of class TWindow is used to create a GUI window for a FiveLinux application.  It also serves as the base class for most of the FiveLinux GUI classes.
<h3>Inherits From</h3>
No parent class.
<h3>Inheritted By</h3>
TDialog
TControl ( and its sub classes: TBar, TButton, TCheckbox, TClipboard, TCombobox, TFolder, TGet, TGroup, TImage, TListbox, TMenu, TMsgBar, TSay, TScrollbar, TWBrowse )
<h3>Syntax</h3>
<h4>Instantiation</h4>
<p>DEFINE WINDOW &lt;oWnd&gt; [ TITLE &lt;cTitle&gt; ] [ MENU &lt;oMenu&gt; ] [ SIZE &lt;nWidth&gt;, &lt;nHeight&gt; ]</p>
where:</br></br>
&lt;oWnd&gt; = the returned object of class TWindow</br></br>
&lt;cTitle&gt; = the title of the new window</br></br>
&lt;oMenu&gt; = the menu to be assigned to the new window</br></br>
&lt;nWidth&gt; = the width of the new window in pixels</br></br>
&lt;nHeight&gt; = the height of the new window in pixels

<h4>Activation</h4>
<p>ACTIVATE WINDOW &lt;oWnd&gt; [ VALID &lt;uValid&gt; ] [ ON [ LEFT ] CLICK &lt;uLClick&gt; ] [ ON RIGHT CLICK &lt;uRClick&gt; ] [ ON INIT &lt;uInit&gt; ] [ MAXIMIZED ] </p>
where:</br></br>
&lt;oWnd&gt; = the TWindow object to be activated</br></br>
&lt;uValid&gt; = a code block to be evaluated when the TWindow object attempts to close</br></br>
&lt;uLClick&gt; = a code block to be evaluated when the user clicks the left mouse button on the TWindow object</br></br>
&lt;uRClick&gt; = a code block to be evaluated when the user clicks the right mouse button on the TWindow object</br></br>
&lt;uInit&gt; = a code block to be evaluated when the TWindow object is created

<h3>Properties</h3>
<table BORDER=2 CELLPADDING=5>
<thead><td><b>Type</b></td><td><b>Defined In </b></td><td><b>Name</b></td><td><b>Type</b></td><td><b>Description</b></td></thead>
<tr><td>DATA</td><td>TWindow</td><td><b>hWnd</b></td><td>handle</td><td>An internal handle of the window, dialog or control</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>oWnd</b></td><td>object</td><td>The container parent window or dialog</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>oMenu</b></td><td>object</td><td>The pulldown menu object if defined</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>oPopup</b></td><td>object</td><td>The popup menu object if defined</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>oMsgBar</b></td><td>object</td><td>The message bar object if defined</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>aControls</b></td><td>array</td><td>An array with all the child controls objects</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bValid</b></td><td>codeblock</td><td>Evaluated to allow the close or focus loose on controls</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bLClicked</b></td><td>codeblock</td><td>Evaluate when the mouse is L clicked</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bLDblClick</b></td><td>codeblock</td><td>Evaluated when the mouse is L double clicked</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bRClicked</b></td><td>codeblock</td><td>Evaluated when the mouse is R clicked</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bRDblClick</b></td><td>codeblock</td><td>Evaluated when the mouse is R double clicked</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bReSized</b></td><td>codeblock</td><td>Evaluated when the window is resized</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bKeyDown</b></td><td>codeblock</td><td>Evaluated when a key is pressed</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bLostFocus</b></td><td>codeblock</td><td>Evaluated when the focus is lost</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bInit</b></td><td>codeblock</td><td>Evaluated when the window is created</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>cargo</b></td><td>variant</td><td>User defined cargo value</td></tr>
<tr><td>static</td><td>TWindow</td><td><b>aWindows</b><td>array</td><td> </td></tr>
<tr><td>static</td><td>TWindow</td><td><b>oWndDefault</b><td>object</td><td> </td></tr>
<tr><td COLSPAN= 5>The following properties aren't part of the standard TWindow Class</td></tr>
<tr><td>DATA</td><td>TWindow</td><td><b>bStartUp</b></td><td>codeblock</td><td>Evaluated</td></tr></table>
</table>

<h3>Methods</h3>
<table BORDER=2 CELLPADDING=5>
<thead><td><b>Type</b></td><td><b>Defined In </b></td><td><b>Name</b></td><td><b>Details</b></td></thead>
<tr><td>CONSTRUCTOR</td><td>TWindow</td><td><b>New(</b><br/><var>    &lt;cTitle,</var><br/> <var>    &lt;oMenu</var>,<br/> <var>    &lt;nWidth</var>,<br/> <var>    &lt;nHeight</var> <b>)</b><br/>    --&gt; self</td><td>Creates a new TWindow object<br/>    &lt;cTitle&gt; = Title to be displayed at in top of window<br/>    &lt;oMenu&gt; = Menu to be assigned to window<br/>    &lt;nWidth&gt; = width of window in pixels<br/>    &lt;nHeight&gt; = height of window in pixels<br/>    returns a pointer to the newly instantiated object</td></tr>
<tr><td>METHOD</td><td>TWindow</td><td><b>Activate(</b><br/><var>     &lt;bValid,<br/>     &lt;bLClicked,<br/>     &lt;bRClicked,<br/>     &lt;lMaximized,<br/>     &lt;bInit </var><b>)</b><br/>    --&gt; nil</td><td>Activates the window<br/>    &lt;bValid&gt; = Code block evaluated when there is an attempt to close the window<br/>    &lt;bLClicked&gt; = Code block evaluated when the left mouse button is clicked<br/>    &lt;bRClicked&gt; = Code block evaluated when the right mouse button is clicked<br/>    &lt;lMaximised&gt; If .T. is passed the window will be maximised<br/>    &lt;bInit&gt; = Code block evaluated when the window is created<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>AddControl(</b><br/><var>     &lt;oCtrl&gt; </var><b>)</b><br/>     --&gt; self ???</td><td>Adds a control to the window<br>    &lt;oCtrl&gt; = the control to be added<br/>    </td></tr>
<tr><td>METHOD</td><td>TWindow</td><td><b>AEvalWhen()</b><br/>    --&gt; nil</td><td>Evaluates the WHEN condition of all child controls<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Center()</b><br/>    --&gt; ???</td><td>Centers the window on the screen<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>_cToolTip(</b><var><br/>    &lt;cText&gt;</var><b> )</b><br/>     --&gt; ???</td><td>Sets the associated tooltip text<br/>    &lt;cText&gt; = The tooltip text to be set<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Disable()</b><br/>     --&gt; ???</td><td>Disable the window / dialog / control<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Enable()</b><br/>     --&gt; ???</td><td>Enable the window / dialog / control<br/>    </td></tr>
<tr><td>METHOD</td><td>TWindow</td><td><b>End()</b><br/>    --&gt; lEnd</td><td>Closes the window / dialog <br/>    returns logical true (.T.) if window / dialog could be closed</td></tr>
<tr><td>METHOD</td><td>TWindow</td><td><b>HandleEvent( </b><br/><var>    &lt;nMsg&gt;,<br/>     &lt;nWParam&gt;,<br/>     &lt;nLParam&gt;</var><b>)</b><br/>    --&gt; nil</td><td>Handles events passed back from GTK+<br/>    &lt;nMessage&gt; = Event received back from GTK+<br/>    &lt;nWParam&gt; = W Parameter received back from GTK+<br/>    &lt;nLParam&gt; = L Parameter received back from GTK+<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Hide()</b><br/>     --&gt; ???</td><td>Hide the window / dialog / control<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>LButtonDown()</b><br/>     --&gt; ???</td><td>Invokes the Left Button Down Code Block<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>lFocused()</b><br/>    --&gt; &lt;lHasFocus&gt;</td><td>Determines if the window / dialog / control has the focus<br/>    returns logical true (.T.) if window / dialog / control has the focus</td></tr>
<tr><td>METHOD</td><td>TWindow</td><td><b>Link()</b><br/>    --&gt; nil</td><td>Adds the window / dialog / control to the aWindows array<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Maximize()</b><br/>     --&gt; ???</td><td>Maximize the window / dialog / control<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>nLeft()</b><br/>    --&gt; &lt;nPixLeft&gt;</td><td>Determines the left coordinate of the window / dialog / control<br/>    returns the left coordinate of the window / dialog / control in pixels</td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>nHeight()</b><br/>    --&gt; &lt;nPixHeight&gt;</td><td>Determines the height of the window / dialog / control<br/>    returns the height of the window / dialog / control in pixels</td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>nTop()</b><br/>    --&gt; &lt;nPixTop&gt;</td><td>Determines the top coordinate of the window / dialog / control<br/>    returns the top coordinate of the window / dialog / control in pixels</td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>nWidth()</b><br/>    --&gt; &lt;nPixWidth&gt;</td><td>Determines the width of the window / dialog / control<br/>    returns the width of the window / dialog / control in pixels</td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>RButtonDown()</b><br/>     --&gt; ???</td><td>Invokes the Right Button Down Code Block<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Refresh()</b><br/>     --&gt; ???</td><td>Refreshes the window / dialog / control<br/>    </td></tr>
<tr><td>METHOD</td><td>TWindow</td><td><b>Resize( </b><br/><var>    &lt;nSizeType&gt;,<br/>     &lt;nWidth&gt;,<br/>     &lt;nHeight&gt;</var><b>)</b><br/>    --&gt; nil</td><td>Resizes the window / dialog / control<br/>    &lt;nSizeType&gt; = ???<br/>    &lt;nWidth&gt; = new width in pixels<br/>    &lt;nnHeight&gt; = new Height in pixels<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>SetFocus()</b><br/>     --&gt; ???</td><td>grabs the focus for the window / dialog / control<br/>    </td></tr>
<tr><td>METHOD</td><td>TWindow</td><td><b>SetMenu(</b><var><br/>    oMenu</var><b>)</b><br/>    --&gt; nil</td><td>Adds a menu object to the window / dialog / control<br/>    &lt;oMenu&gt; = the menu object to be added<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>SetText(</b><var><br/>    cText</var><b>)</b><br/>    --&gt; ???</td><td>Sets the text for the window / dialog / control<br/>    &lt;cText&gt; = the new text<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Show()</b><br/>     --&gt; ???</td><td>Displays the window / dialog / control<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>Update()</b><br/>     --&gt; ???</td><td>Updates children of the window / dialog / control<br/>    </td></tr>
<tr><td COLSPAN= 4>The following methods aren't part of the standard TWindow Class</td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>SetBackgroundColor(</b><var><br/>    sCol,<br/>    iState </var><b>)</b><br/>    --&gt; ???</td><td>Sets the background color for the window / dialog / control in &lt;iState&gt;<br/>    &lt;sCol&gt; = the desired color<br/>    &lt;iState&gt; = the GTK state for which the color is to be set<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>SetForegroundColor(</b><var><br/>    sCol,<br/>    iState </var><b>)</b><br/>    --&gt; ???</td><td>Sets the foreground color for the window / dialog / control in &lt;iState&gt;<br/>    &lt;sCol&gt; = the desired color<br/>    &lt;iState&gt; = the GTK state for which the color is to be set<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>SetTextColor(</b><var><br/>    sCol,<br/>    iState </var><b>)</b><br/>    --&gt; ???</td><td>Sets the text color for the window / dialog / control in &lt;iState&gt;<br/>    &lt;sCol&gt; = the desired color<br/>    &lt;iState&gt; = the GTK state for which the color is to be set<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>SetBaseColor(</b><var><br/>    sCol,<br/>    iState </var><b>)</b><br/>    --&gt; ???</td><td>Sets the base color for the window / dialog / control in &lt;iState&gt;<br/>    &lt;sCol&gt; = the desired color<br/>    &lt;iState&gt; = the GTK state for which the color is to be set<br/>    </td></tr>
<tr><td>INLINE<br/>METHOD</td><td>TWindow</td><td><b>SetEntrySelection(</b><var><br/>    lSel</var><b>)</b><br/>    --&gt; ???</td><td>Sets whether entries are selected by default on control focus<br/>    &lt;lSel&gt; = passing logical false (.F.) disables this behaviour<br/>    </td></tr>
</table>
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Fri Aug 29, 2008 7:05 am

Doug,

Why don't you include it in the wiki so its easier to be read and to cooperate to modify it, etc. ? :-)

www.fivetechsoft.com/wiki
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xProgrammer » Fri Aug 29, 2008 10:09 am

Hi Antonio

I logged on to the wiki and uploaded my html code. It seems that the wiki is configured not to support embedded html code. I ratgher gather that you are the person that would need to change that configuration option. I gather from the wiki documentation that this does represent a bit of a security risk if you had a malicious person with edit access. I did put up a page bwith the html code and a test page where I started converting to the straight wiki code. The table capabilities with the straight wiki code don't include rowspan unfortunately which is a problem with my current layout design. Please advise if you are happy to enable html support.

Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Fri Aug 29, 2008 10:40 am

Doug,

Better, easier and safer not to use HTML code.

You can copy and paste your text and format it using the wiki formatting tools. There are great wikis built using DokuWiki:

http://www.dokuwiki.org/dokuwiki
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xProgrammer » Fri Aug 29, 2008 12:13 pm

Hi Antonio

I have reformatted the TWindow documentation into a form suitable for the wiki and put it there. The thing I am not so keen about is that it presumably isn't in a form that can be easily downloaded onto a machine locally and run locally. So maybe I need to look into a way of producing both forms in one basic go - perhaps with some reformatting program.

Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Fri Aug 29, 2008 3:55 pm

Doug,

It looks excellent now! :-)

Many thanks!

http://www.fivetechsoft.com/wiki/doku.php?id=twindow

A sugestion: we should use a namespace for each FiveTech product. i.e.: flh_twindow, fwh_twindow, etc.

Also, I remember there was another way. I need to review it...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests