Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - <b>4.1 fivewin own twbrowse class</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 4.1 FiveWin own TWBrowse class
--------------------------------------------------------------------------------

 FiveWin implements its own browse which has some important differences from
 the traditional MsDos Clipper TBrowse. This difference is based on the fact
 that we wanted FiveWin browsers to execute as fast as possible. Windows is
 a graphical environment, so applications user interface tends to be slower
 than their MsDos equivalents. If you want to work in the MsDos way, FiveWin
 also provides a new class TCBrowse, which it is a column based browse.

 FiveWin TWBrowse does not work with column objects, instead of those, it
 holds an codeblock (DATA bLine) which returns an array. The contents of
 this array is used to display each visible column content. This makes an
 important difference: Lets suppose we have a 10 columns browse, which
 also has 25 rows on the screen. If we were working with traditional browse
 to fully repaint the browse we were doing the following:

             10 columns x 25 rows = 250 codeblocks evaluations.

             FiveWin TWBrowse      = 25 codeblocks evaluations only !!!

 This fact makes FiveWin TWBrowses extremely fast, though it changes a little
 the way you are used to work with browsers. The main idea is that DATA bLine
 holds a codeblock that returns an array:

           <oBrw>:bLine = { || { "One", "Two", "Three", ... } }

 The second difference is that being in a graphical environment our users
 wanted to also show bitmaps (graphics) as browse elements. How could we
 distinct from normal data and bitmaps handles ? The solution was that a
 character string holds normal data, and numeric values are considered
 bitmap handles:

           <oBrw>:bLine = { || { nHBitmap, "One", "Two", "Three", ... } }

 When FiveWin TWBrowse evaluates this codeblock, it detects there is a numeric
 value as an element of that array, so that number is treated as a handle
 of a bitmap, and it is automatically painted on its column position. As
 you can use expressions to return that numeric value, you have an easy
 way to paint different bitmaps based on any condition:

       <oBrw>:bLine = { || { If( Clients->Balance > 0, hBmpPlus, hBmpNeg ),;
                             Clients->Last, Clients->First,;
                             Str( Clients->Balance ) } }

 Important: Always use character expressions as elements for the bLine array!
            A number will means a bitmap handle. An invalid bitmap handle
            (if by mistake you supply a number instead of a string expression)
            will cause strange results!

 Besides this difference, the TWBrowse object is almost identical to a
 MsDos Clipper TBrowse. We have just used 'Hungarian notation' (we specify
 the type of a DATA -instvar- preceding the DATA name) to specify the type
 of each TWBrowse object DATA:

             FiveWin TWBrowse          Clipper MsDos TBrowse
             ================          ====================

   DATAs         bGoTop                     GoTopBlock
                 bGoBottom                  GoBottomBlock
                 bSkip                      SkipBlock

                 nTop    (in pixels)        nTop
                 nLeft        "             nLeft
                 nBottom      "             nBottom
                 nRight       "             nRight

                 nRowPos                    RowPos
                 nRowCount() (METHOD)       RowCount
                 nColPos                    ColPos
                 (left visible column)
                 IsColVisible() (METHOD)

                 lHitTop                    HitTop
                 lHitBottom                 HitBottom

                 nClrText, nClrPane         ColorSpec
                 nClrBackHead, nClrForeHead
                 nClrBackFocus, nClrForeFocus

   METHODs       GoUp()                     Up()
                 GoDown()                   Down()
                 GoTop()                    GoTop()
                 GoBottom()                 GoBottom()
                 GoLeft()                   Left()
                 GoRight()                  Right()

                 PageUp()                   PageUp()
                 PageDown()                 PageDown()

                 Refresh()                  RefreshAll()
                 DrawSelect()               RefreshCurrent()
                 (DrawLine(nLine))

                 SetCols() (All of them)    SetColumn()
                 GetColSizes()              ColWidth()
                 ShowSizes()


             FiveWin TWBrowse          Clipper MsDos TColumn
             ================          =====================

   DATAs         aHeaders (All of them)     Heading
                 bLine    (All of them)     Block
                 aSizes   (All of them)     Width


 Beside these, FiveWin TWBrowse offers much more built-in functionality
 that traditional MsDos Clipper browse:


   METHODs       KeyDown()    (KEYBOARD)    No equivalents!
                 KeyChar()

                 LButtonDown()  (MOUSE)            "
                 LButtonUp()
                 MouseMove()
                 LDblClick()
                 RButtonDown()
                 RButtonUp()
                 nAtCol()

                 lEditCol() (Automatic editing)    "

                 VScroll()    (SCROLLBARS)         "
                 HScroll()

                 Skip()                            "

                 SetFilter()  (Index based )       "
                                 filters

                 Report()   (Automatic Reporting)  "

                 SetArray()   (Arrays editing)     "
                 SetTree()       (Trees)           "


 Finally, FiveWin implements easy xBase commands to build a whole browse
 with just one xBase command (there is no equivalent for this in MsDos
 Clipper TBrowse):

      From source code:         @ <nRow>, <nCol> LISTBOX <oLbx> ;
                                    FIELDS <Expression,...> ;
                                    HEADERS <Title,...> ;
                                    COLSIZES <Size,...> ;
                                    etc...

      From Resources:           REDEFINE LISTBOX <oLbx> ;
                                    FIELDS <Expression,...> ;
                                    HEADERS <Title,...> ;
                                    COLSIZES <Size,...> ;
                                    etc...

 See FiveWin Browse xBase commands and the Class TWBrowse explanation
 in this manual for a full description of the above xBase commands. Remember
 that FiveWin also provides a new powerful Class TCBrowse in case that you
 want to work with column objects. TCBrowse is also a fast browse, though
 not as fast as TWBrowse.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson