FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour :winstyle in the TFolderEx dialog
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
:winstyle in the TFolderEx dialog
Posted: Mon Mar 02, 2026 11:43 AM

Hi,

Is it possible to change the style in the TFolderEx dialog? I tried this

oDlg:oFolder:aDialogs[1]:winstyle(nOr(oDlg:oFolder:aDialogs[1]:nStyle, WS_VSCROLL),  .T.)

the window has not changed

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: :winstyle in the TFolderEx dialog
Posted: Mon Mar 02, 2026 01:04 PM

Dear Yuri,

Yes, it is possible, but your current approach has three distinct problems that prevent it from working.


---

Problem 1: The WinStyle() call does nothing

The WinStyle() method delegates to GetSetGWLStyle(): 0-cite-0

Inside GetSetGWLStyle, the first parameter (nStyle) is treated as a mask to check โ€” it computes uRet = lAnd(nSet, nStyle). Then:

  • SetWindowLong to add a style is only called when !uRet .AND. lOnOff โ€” meaning the bit is not yet set and you want to turn it on.
  • SetWindowLong to remove a style is only called when uRet .AND. !lOnOff.

Your call passes nOr(currentStyle, WS_VSCROLL) as nStyle. Since lAnd(currentWindowStyle, nOr(currentStyle, WS_VSCROLL)) returns the full currentWindowStyle (a non-zero/truthy value), uRet is truthy, and neither branch fires. SetWindowLong is never called at all.

The correct call is simply:

aDialogs[1]:WinStyle( WS_VSCROLL, .T. )

passing only the flag bit as the first argument, not the combined style.


---

Problem 2: SWP_FRAMECHANGED is required after SetWindowLong

Even with the correct SetWindowLong call, Windows will not visually refresh the non-client area (where the scrollbar lives) unless SetWindowPos is called with SWP_FRAMECHANGED. This is a well-established pattern throughout the codebase: 0-cite-1 0-cite-2


---

Problem 3: oVScroll is not created when style is changed after activation

TDialog:Initiate() only auto-creates the oVScroll scroll object when WS_VSCROLL is present at dialog creation time: 0-cite-3

Adding the style afterward leaves oVScroll as NIL, so scroll events are never handled.


---

The Correct Approach: Set the style BEFORE activation

In TFolderEx:New(), the tab-page dialogs are created (with DEFINE DIALOG ... STYLE WS_CHILD) and stored in ::aDialogs, but they are not yet activated (no hWnd) when the parent is a dialog: 0-cite-4

Default() is deferred until the parent dialog is activated (via TFolderEx:Initiate()): 0-cite-5

Default() only calls ACTIVATE DIALOG oDlg NOWAIT for dialogs that don't yet have a handle: 0-cite-6

This means after DEFINE FOLDEREX but before ACTIVATE DIALOG on the parent, you can modify nStyle directly on the tab page dialog objects โ€” adding WS_VSCROLL to aDialogs[n]:nStyle. When the parent is later activated, TDialog:Initiate() will find WS_VSCROLL in the style and automatically create oVScroll.

The canonical example of this pattern (for TFolder) is shown in samples/misc/don.prg: 0-cite-7

After activation, configure the oVScroll object in ON INIT: 0-cite-8


---

Summary Diagram

</s>
flowchart TD
    A["DEFINE FOLDEREX oFld ... OF oDlg"] --&gt; B["TFolderEx:New() โ€” creates aDialogs entries (no hWnd yet)"]
    B --&gt; C["&gt;&gt;&gt; SET aDialogs[n]:nStyle := nOr(..., WS_VSCROLL) HERE &lt;&lt;&lt;"]
    C --&gt; D["ACTIVATE DIALOG oDlg"]
    D --&gt; E["TFolderEx:Initiate() โ†’ Default()"]
    E --&gt; F["ACTIVATE DIALOG aDialogs[n] NOWAIT"]
    F --&gt; G["TDialog:Initiate() checks lAnd(nStyle, WS_VSCROLL)"]
    G --&gt; H["oVScroll is auto-created and ready to configure"]
<e>

---

Notes

  • For a window-based parent (where oWnd:hWnd is already non-empty at DEFINE FOLDEREX time), Default() is called immediately inside New(), so there is no window between creation and activation. In that case you must call SetWindowLong + SetWindowPos with SWP_FRAMECHANGED + manually DEFINE SCROLLBAR oVScroll VERTICAL OF aDialogs[n] after the fact.
  • The don.prg sample uses TFolder, not TFolderEx, but the aDialogs lifecycle and oVScroll/oHScroll configuration pattern is identical for both classes.
  • Just adding WS_VSCROLL makes the scrollbar visible, but you still need to call SetRange() and wire the bGoDown, bGoUp, bPageDown, bPageUp, bPos, and bTrack codeblocks to actually scroll content (typically via ScrollWindow()).

Citations

File: source/classes/window.prg (L2606-2617)

Code (text): Select all Collapse
METHOD ToolWindow( nStyle ) CLASS TWindow

   DEFAULT nStyle := SWP_NOSIZE + SWP_NOMOVE + SWP_NOZORDER + SWP_NOACTIVATE + SWP_FRAMECHANGED

   SetWindowLong( ::hWnd, GWL_EXSTYLE,;
                  nOr( GetWindowLong( ::hWnd, GWL_EXSTYLE ), WS_EX_TOOLWINDOW ) )
   SetWindowPos( ::hWnd, 0, ::nTop, ::nLeft, ::nRight - ::nLeft + 1,;
                 ::nBottom - ::nTop + 1, nStyle )                      // 55 )
   // 55 is nOr( SWP_NOSIZE, SWP_NOMOVE, SWP_NOZORDER,;
   // SWP_NOACTIVATE, SWP_FRAMECHANGED )

return nil

File: source/classes/window.prg (L3903-3931)

Code (text): Select all Collapse
METHOD GetSetGWLStyle( lExtended, nStyle, lOnOff ) CLASS TWindow

   local nGwl     := If( lExtended, GWL_EXSTYLE, GWL_STYLE )
   local nSet, uRet

   nSet     := If( Empty( ::hWnd ), If( lExtended, ::nExStyle, ::nStyle ), GetWindowLong( ::hWnd, nGwl ) )
   uRet     := nSet

   if ValType( nStyle ) == 'N'
      uRet     := lAnd( nSet, nStyle )
      if ValType( lOnOff ) == 'L'
         if Empty( ::hWnd )
            nSet  := If( lOnOff, nOr( nSet, nStyle ), nAnd( nSet, nNot( nStyle ) ) )
            if lExtended
               ::nExStyle  := nSet
            else
               ::nStyle    := nSet
            endif
         else
            if uRet .and. !lOnOff
               SetWindowLong( ::hWnd, nGwl, nAnd( nSet, nNot( nStyle ) ) )
            elseif ! uRet .and. lOnOff
               SetWindowLong( ::hWnd, nGwl, nOr( nSet, nStyle ) )
            endif
         endif
      endif
   endif

return uRet

File: source/classes/btnbmp.prg (L906-906)

Code (text): Select all Collapse
                 nOr( SWP_NOMOVE, SWP_NOSIZE, SWP_FRAMECHANGED ), 1 )

File: source/classes/dialog.prg (L945-951)

Code (text): Select all Collapse
   if lAnd( ::nStyle, WS_VSCROLL )
      DEFINE SCROLLBAR ::oVScroll VERTICAL OF Self
   endif

   if lAnd( ::nStyle, WS_HSCROLL )
      DEFINE SCROLLBAR ::oHScroll HORIZONTAL OF Self
   endif

File: source/classes/tfoldex.prg (L371-385)

Code (text): Select all Collapse
   for n = 1 to nLen

      DEFINE DIALOG oDlg OF Self STYLE nOR( WS_CHILD, If( ! ::oWnd:IsKindOf( "TDIALOG"), WS_CLIPCHILDREN, 0 ) );
         FROM 0, 1 TO ::nHeight(), ::nWidth() PIXEL ;
         FONT ::ownd:oFont ;
         HELPID If( Len( ::aHelps ) >= n , ::aHelps[ n ] , NIL )

      oDlg:SetBrush( ::oBrush )
      ::aDialogs[ n ] = oDlg

      oDlg:cVarName := "Page" + AllTrim( Str( n ) )
      oDlg:Hide()
      // oDlg:lTransparent := .T.

   next

File: source/classes/tfoldex.prg (L841-846)

Code (text): Select all Collapse
      if oDlg:hWnd == NIL
         ACTIVATE DIALOG oDlg NOWAIT VALID ( Self, .f. );
               ON INIT ::Move( aMove[ 1 ], aMove[ 2 ] )
      endif
      oDlg:SetSize( aMove[ 3 ], aMove[ 4 ] + 2 )
      oDlg:Hide()

File: source/classes/tfoldex.prg (L1029-1041)

Code (text): Select all Collapse
METHOD Initiate( hDlg ) CLASS TFolderEx

   LOCAL uValue := ::Super:Initiate( hDlg )
   LOCAL nStyle := nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, WS_CLIPCHILDREN )
   //force style

   SetWindowLong( ::hWnd, -16, nStyle )

   ::UpdateRegion()

   ::Default()

RETURN uValue

File: samples/misc/don.prg (L40-60)

Code (text): Select all Collapse
for i := 1 to len( ofolder:adialogs )

   DEFINE DIALOG ODIALOG OF OFOLDER ;
      STYLE NOR( WS_VISIBLE, WS_DLGFRAME, WS_CHILD, WS_VSCROLL, WS_HSCROLL)

   if i = 1
     @ 1, 1 BUTTON "&Hello" OF odialog ;
       ACTION MsgInfo( "Hello world! from page 1")
   elseif i = 2
     @ 2, 2 BUTTON "&Hello" OF odialog ;
       ACTION MsgInfo( "Hello world! from page 2")
   elseif i = 3
     @ 3, 3 BUTTON "&Hello" OF odialog ;
       ACTION MsgInfo( "Hello world! from page 3")
   endif

  ofolder:adialogs[ i ] := odialog

next

return ofolder

File: samples/misc/don.prg (L79-114)

Code (text): Select all Collapse
function SetScrollBarsValues( ofolder )
local i, ovscroll, OHSCROLL

for i := 1 to len( ofolder:adialogs )

   OVSCROLL := oFolder:aDialogs[ i ]:OVSCROLL
   OVSCROLL:SETRANGE( 1, 100 )

   OVSCROLL:bPAGEDOWN = { |  | msgstop( 'page down' ) }
   OVSCROLL:bGoDOWN =   { |  | msgstop( 'go down' ) }

   OVSCROLL:bPAGEUP = { |  | msgstop( 'page up  ' ) }
   OVSCROLL:bGoUP =   { |  | msgstop( 'go up    ' ) }

   // THUMBPOSITION
   OVSCROLL:bPOS  =   { | NPOS | msgstop( 'bpos block')  }
   OVSCROLL:bTRACK  = { | NPOS | msgstop( 'btack block' )  }

   OHSCROLL := oFolder:aDialogs[ i ]:OHSCROLL
   OHSCROLL:SETRANGE( 1, 100 )

   OHSCROLL:bPAGEDOWN = { |  | msgstop( 'page RITE' ) }
   OHSCROLL:bGoDOWN =   { |  | msgstop( 'go RITE' ) }

   OHSCROLL:bPAGEUP = { |  | msgstop( 'page LEFT' ) }
   OHSCROLL:bGoUP =   { |  | msgstop( 'go LEFT  ' ) }

   // THUMBPOSITION
   OHSCROLL:bPOS  =   { | NPOS | msgstop( 'bpos block')  }
   OHSCROLL:bTRACK  = { | NPOS | msgstop( 'btack block' )  }

   OHSCROLL:LUPDATE := .T.

next

return ofolder
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: :winstyle in the TFolderEx dialog
Posted: Mon Mar 02, 2026 01:25 PM

Thank you, Antonio! I'll try. :shock:

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: :winstyle in the TFolderEx dialog
Posted: Mon Mar 02, 2026 03:49 PM

Here is a complete walkthrough of how the pattern works, backed entirely by the actual source code.


---

Overview

Code (mermaid): Select all Collapse
sequenceDiagram
  "Main()" ->> "build_pages()": "creates FOLDER, calls build_pages(oFld)"
  "build_pages()" ->> "DEFINE DIALOG": "per tab: STYLE NOR(WS_CHILD, WS_VSCROLL, ...)"
  "Main()" ->> "ACTIVATE DIALOG": "ON INIT SetScrollBarsValues(oFld)"
  "ACTIVATE DIALOG" ->> "TDialog:Initiate()": "detects WS_VSCROLL in nStyle"
  "TDialog:Initiate()" ->> "TScrollBar:WinNew()": "auto-creates ::oVScroll on each page dialog"
  "SetScrollBarsValues()" ->> "oVScroll:SetRange()": "SetRange(1, 100)"
  "SetScrollBarsValues()" ->> "oVScroll callbacks": "bGoDown, bGoUp, bPageDown, bPageUp, bPos, bTrack"

---

Step 1 โ€” Define the main dialog and FOLDER control

The outer DEFINE DIALOG and FOLDER (which creates a TFolderEx) are set up in Main(). The ON INIT clause fires the scroll-bar configuration function after all page dialogs have been activated and their oVScroll objects have been instantiated. 1-cite-0


---

Step 2 โ€” Build the tab page dialogs with WS_VSCROLL

Inside build_pages(), each tab page dialog is defined OF OFOLDER using STYLE NOR(...) that includes WS_VSCROLL (and optionally WS_HSCROLL). The style must be set here, before activation, so that TDialog:Initiate() can detect it and automatically create the oVScroll object. 1-cite-1


---

Step 3 โ€” Why WS_VSCROLL in the style creates oVScroll automatically

Inside TDialog:Initiate(), after the dialog window handle is established, the framework checks for WS_VSCROLL and WS_HSCROLL in ::nStyle. If found, it calls DEFINE SCROLLBAR ::oVScroll VERTICAL OF Self (which expands to TScrollBar():WinNew(...)), creating a non-true (window-embedded) scroll bar object with lIsChild = .T.. 1-cite-2


---

Step 4 โ€” The TScrollBar:WinNew() constructor

WinNew is the constructor for window-embedded scroll bars (those created by WS_VSCROLL/WS_HSCROLL). It sets lIsChild = .T., which causes SetRange, SetPos, GoUp, GoDown, etc., to use SB_VERT/SB_HORZ flags (acting on the parent window handle) instead of treating ::hWnd as a standalone control. 1-cite-3


---

Step 5 โ€” SetRange, GoUp, GoDown internals

  • SetRange(nMin, nMax): stores ::nMin/::nMax and calls Win32 SetScrollRange using SB_VERT because lIsChild = .T. and lVertical = .T.
  • GoUp() / GoDown(): move the thumb one step, then evaluate ::bGoUp / ::bGoDown if assigned.
  • PageUp() / PageDown(): move by ::nPgStep, then evaluate ::bPageUp / ::bPageDown.
  • ThumbPos(nPos) / ThumbTrack(nPos): evaluate ::bPos / ::bTrack with the drag position. 1-cite-4

---

Step 6 โ€” Configuring scrollbars in ON INIT via SetScrollBarsValues()

After activation (in ON INIT), oFolder:aDialogs[i]:oVScroll is already populated. SetScrollBarsValues() iterates every page dialog, calls SetRange(1, 100), and assigns all six callback blocks: bPageDown, bGoDown, bPageUp, bGoUp, bPos, and bTrack. The same pattern is repeated for oHScroll. 1-cite-5


---

Key class reference โ€” TFolderEx:aDialogs

TFolderEx stores each tab page as a TDialog in the aDialogs array. In New(), the array is pre-allocated to the number of prompts. The Default() method activates each page dialog NOWAIT, which triggers Initiate() on each one (and thus oVScroll creation if the style includes WS_VSCROLL). 1-cite-6 1-cite-7 1-cite-8


---

Notes

  1. Style must be set before ACTIVATE: TDialog:Initiate() reads ::nStyle at WM_INITDIALOG time. If you modify nStyle after activation, oVScroll will not be created automatically โ€” you would need to call DEFINE SCROLLBAR ::oVScroll VERTICAL OF oDlg manually.

  2. lIsChild = .T. on the scroll bar object (set by WinNew) means all Win32 calls (SetScrollRange, SetScrollPos, GetScrollPos) operate on the parent dialog's window handle with SB_VERT/SB_HORZ flags, not on a separate control handle. This is a "non-true" scroll bar.

  3. oHScroll follows the identical pattern โ€” just replace WS_VSCROLL with WS_HSCROLL and use ::oHScroll with HORIZONTAL orientation. The lVertical = .F. flag on the resulting object causes SB_HORZ to be passed to all Win32 calls, and bGoDown/bGoUp semantically mean "go right"/"go left".

  4. The ON INIT callback is evaluated at line 963โ€“968 of dialog.prg, after oVScroll is already created (lines 945โ€“951), so it is always safe to access oFolder:aDialogs[i]:oVScroll inside ON INIT. 1-cite-9

Citations

File: samples/misc/don.prg (L7-31)

Code (text): Select all Collapse
function Main()

   local oDlg, oFld

ALTD(1)
ALTD( )

   DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
      FROM 5, 5 TO 30, 80

  ODLG:NSTYLE := nOR( DS_MODALFRAME,  ;
                         WS_MINIMIZEBOX        ,  ;
                         WS_VISIBLE, WS_CAPTION,  ;
                         WS_SYSMENU, WS_THICKFRAME, WS_MAXIMIZEBOX )

   @ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
      OF oDlg SIZE 160, 90

   ofld := build_pages( ofld )

   ODLG:BRESIZED := {| |  FOLDRESIZE( ODLG ) }

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT SetScrollBarsValues( oFld )

File: samples/misc/don.prg (L37-60)

Code (text): Select all Collapse
function build_pages( ofolder )
local odialog, i

for i := 1 to len( ofolder:adialogs )

   DEFINE DIALOG ODIALOG OF OFOLDER ;
      STYLE NOR( WS_VISIBLE, WS_DLGFRAME, WS_CHILD, WS_VSCROLL, WS_HSCROLL)

   if i = 1
     @ 1, 1 BUTTON "&Hello" OF odialog ;
       ACTION MsgInfo( "Hello world! from page 1")
   elseif i = 2
     @ 2, 2 BUTTON "&Hello" OF odialog ;
       ACTION MsgInfo( "Hello world! from page 2")
   elseif i = 3
     @ 3, 3 BUTTON "&Hello" OF odialog ;
       ACTION MsgInfo( "Hello world! from page 3")
   endif

  ofolder:adialogs[ i ] := odialog

next

return ofolder

File: samples/misc/don.prg (L79-114)

Code (text): Select all Collapse
function SetScrollBarsValues( ofolder )
local i, ovscroll, OHSCROLL

for i := 1 to len( ofolder:adialogs )

   OVSCROLL := oFolder:aDialogs[ i ]:OVSCROLL
   OVSCROLL:SETRANGE( 1, 100 )

   OVSCROLL:bPAGEDOWN = { |  | msgstop( 'page down' ) }
   OVSCROLL:bGoDOWN =   { |  | msgstop( 'go down' ) }

   OVSCROLL:bPAGEUP = { |  | msgstop( 'page up  ' ) }
   OVSCROLL:bGoUP =   { |  | msgstop( 'go up    ' ) }

   // THUMBPOSITION
   OVSCROLL:bPOS  =   { | NPOS | msgstop( 'bpos block')  }
   OVSCROLL:bTRACK  = { | NPOS | msgstop( 'btack block' )  }

   OHSCROLL := oFolder:aDialogs[ i ]:OHSCROLL
   OHSCROLL:SETRANGE( 1, 100 )

   OHSCROLL:bPAGEDOWN = { |  | msgstop( 'page RITE' ) }
   OHSCROLL:bGoDOWN =   { |  | msgstop( 'go RITE' ) }

   OHSCROLL:bPAGEUP = { |  | msgstop( 'page LEFT' ) }
   OHSCROLL:bGoUP =   { |  | msgstop( 'go LEFT  ' ) }

   // THUMBPOSITION
   OHSCROLL:bPOS  =   { | NPOS | msgstop( 'bpos block')  }
   OHSCROLL:bTRACK  = { | NPOS | msgstop( 'btack block' )  }

   OHSCROLL:LUPDATE := .T.

next

return ofolder

File: source/classes/dialog.prg (L945-968)

Code (text): Select all Collapse
   if lAnd( ::nStyle, WS_VSCROLL )
      DEFINE SCROLLBAR ::oVScroll VERTICAL OF Self
   endif

   if lAnd( ::nStyle, WS_HSCROLL )
      DEFINE SCROLLBAR ::oHScroll HORIZONTAL OF Self
   endif

   if ::oIcon != nil
      ::SendMsg( WM_SETICON, 0, ::oIcon:hIcon )
   endif

   ::SetAlphaLevel()

   if ::oBar != nil   // added 2016-04-06. It is not necessary to call
      ::oBar:Adjust() // oDlg:Resize() in ON INIT clause
   endif

   if ::bInit != nil
      lResult = Eval( ::bInit, Self )
      if ValType( lResult ) == "L" .and. ! lResult
         lFocus = .f.
      endif
   endif

File: source/classes/scrllbar.prg (L15-99)

Code (text): Select all Collapse
CLASS TScrollBar FROM TControl

   DATA   lVertical, lReDraw, lIsChild, nMin, nMax, nPgStep
   DATA   bGoUp, bGoDown, bGoTop, bGoBottom, bPageUp, bPageDown, bPos
   DATA   bTrack

   CLASSDATA aProperties INIT { "cVarName", "nMin", "nMax",;
                                "nPgStep", "nTop", "nLeft", "nWidth", "nHeight",;
                                "Cargo", "nOrientation" }

   METHOD New( nRow, nCol, nMin, nMax, nPgStep, lVertical, oWnd, nWidth, nHeight,;
               bUpAct, bDownAct, bPgUp, bPgDown, bPos, lPixel, nClrText,;
               nClrBack, cMsg, lUpdate, bWhen, bValid, lDesign ) CONSTRUCTOR

   METHOD WinNew( nMin, nMax, nPgStep, lVertical, oWnd, bUpAction,;
                  bDownAction, bPgUp, bPgDown, bPos, nClrText, nClrBack,;
                  lUpdate, bWhen, bValid ) CONSTRUCTOR

   METHOD ReDefine( nID, nMin, nMax, nPgStep, oWnd, bUpAction, bDownAction, ;
                    bPgUp, bPgDown, bPos, nClrText, nClrBack, cMsg,;
                    lUpdate, bWhen, bValid ) CONSTRUCTOR

   METHOD cToChar() INLINE ::Super:cToChar( "SCROLLBAR" )

   METHOD GetPos() INLINE GetScrollPos( If( ::lIsChild, ::oWnd:hWnd, ::hWnd ),;
            If( ::lIsChild, If( ::lVertical, SB_VERT, SB_HORZ ), SB_CTL ) )

   METHOD GetRange() INLINE GetScrollRange( If( ::lIsChild, ::oWnd:hWnd, ::hWnd ),;
            If( ::lIsChild, If( ::lVertical, SB_VERT, SB_HORZ ), SB_CTL ) )

   METHOD HandleEvent( nMsg, nWParam, nLParam )

   METHOD Initiate( hDlg ) INLINE  ::Super:Initiate( hDlg ), ;
                               ::SetRange( ::nMin, ::nMax ),;
                               ::SetPos( ::nMin )

   // These two have to be BLOCK

   METHOD GoUp()   BLOCK { | Self, nPos | nPos := ::GetPos(),;
                                          if( nPos > ::nMin,;
                                              ::SetPos( --nPos ), ),;
                          If( ::bGoUp != nil, Eval( ::bGoUp ),) }

   METHOD GoDown() BLOCK { | Self, nPos | nPos := ::GetPos(),;
                                          if( nPos < ::nMax,;
                                              ::SetPos( ++nPos ), ),;
                          If( ::bGoDown != nil, Eval( ::bGoDown ),) }


   METHOD GoTop() INLINE  ::SetPos( ::nMin ),;
                          If( ::bGoTop != nil, Eval( ::bGoTop ),)

   METHOD GoBottom() INLINE  ::SetPos( ::nMax ),;
                             If( ::bGoBottom != nil, Eval( ::bGoBottom ),)

   METHOD PageUp() INLINE  ::SetPos( ::GetPos() - ::nPgStep ),;
                           If( ::bPageUp != nil, Eval( ::bPageUp ),)

   METHOD PageDown() INLINE  ::SetPos( ::GetPos() + ::nPgStep ),;
                             If( ::bPageDown != nil, Eval( ::bPageDown ),)

   METHOD SetPage( nSize, lReDraw )

   METHOD SetPos( nPos ) INLINE ;
                 SetScrollPos( if( ::lIsChild, ::oWnd:hWnd, ::hWnd ),;
                 If( ::lIsChild, If( ::lVertical, SB_VERT, SB_HORZ ), SB_CTL ),;
                 nPos, ::lReDraw )

   METHOD SetRange( nMin, nMax ) INLINE ;
                                  ::nMin := nMin, ::nMax := nMax, ;
           SetScrollRange( if( ::lIsChild, ::oWnd:hWnd, ::hWnd ), ;
               if( ::lIsChild, If( ::lVertical, SB_VERT, SB_HORZ ), SB_CTL ), ;
                    nMin, nMax, ::lReDraw )

   METHOD ThumbPos( nPos ) INLINE  If( ::bPos != nil, Eval( ::bPos, nPos ),)

   METHOD MouseMove( nRow, nCol, nKeyFlags )

   METHOD ThumbTrack( nPos ) INLINE If( ::bTrack != nil, Eval( ::bTrack, nPos ),)

   METHOD nOrientation() INLINE If( ::lVertical, 1, 2 )

   METHOD _nOrientation( n )

ENDCLASS

File: source/classes/scrllbar.prg (L171-200)

Code (text): Select all Collapse
METHOD WinNew( nMin, nMax, nPgStep, lVertical, oWnd, bUpAction,;
               bDownAction, bPgUp, bPgDown, bPos, nClrText, nClrBack,;
               lUpdate, bWhen, bValid ) CLASS TScrollBar

   DEFAULT nMin := 1, nMax := 2, nPgStep := 1, lVertical := .t.,;
           nClrText  := GetSysColor( COLOR_WINDOW ),;
           nClrBack  := GetSysColor( COLOR_SCROLLBAR ),;
           lUpdate   := .f.

   ::oWnd      = oWnd
   ::lVertical = lVertical
   ::lReDraw   = .t.
   ::lIsChild  = .t.
   ::nMin      = nMin
   ::nMax      = nMax
   ::nPgStep   = nPgStep
   ::bGoUp     = bUpAction
   ::bGoDown   = bDownAction
   ::bPageUp   = bPgUp
   ::bPageDown = bPgDown
   ::bPos      = bPos
   ::lUpdate   = lUpdate
   ::bWhen     = bWhen
   ::bValid    = bValid
   ::hWnd      = 0

   ::SetRange( nMin, nMax )
   ::SetPos( nMin )

return Self

File: source/classes/tfoldex.prg (L37-41)

Code (text): Select all Collapse
CLASS TFolderEx FROM TControl

   CLASSDATA lRegistered AS LOGICAL

   DATA aDialogs

File: source/classes/tfoldex.prg (L264-385)

Code (text): Select all Collapse
   ::aDialogs    = {}
   ::aEnable     = {}
   ::aPos        = {}
   ::aVisible    = {}
   ::aPrompts    = CheckArr( aPrompts )
   ::aOrder      = {}
   ::aLines      = {}

   nLen = Len( ::aPrompts )

   if aAlign == NIL
      aAlign = Array( nLen )
   endif

   if aHelps == NIL
      aHelps = Array( nLen )
   endif

   if aBitmaps == NIL
      aHelps = Array( nLen )
   endif

   ::aVisible   = Array( nLen )
   ::aEnable    = Array( nLen )

   AFill( ::aVisible, .T. )
   AFill( ::aEnable, .T. )


//////////////////////// begin -->> byte-one 2010

#ifdef OLDCODE // upto FWH 14.06 : Modified on 2014-07-25

   // verify font by user
   if oFont == nil
      // verify font by paren
      if ::oWnd:oFont == nil
            oFont := TFont():New()
           oFont:hFont := GetStockObject( DEFAULT_GUI_FONT )
           aFontInfo = GetFontInfo( oFont:hFont )
       else
           aFontInfo := GetFontInfo( ::oWnd:oFont:hFont )
       endif
   else
       aFontInfo := GetFontInfo( oFont:hFont )
   endif

   IF ::nLayOut == LAYOUT_RIGHT .OR. ::nLayOut == LAYOUT_LEFT
      if hb_isObject( oFont ) // oFont is external and user provided
         oFont:end()          // This font should not :End() here  2014-07-25
      endif
      DEFINE FONT oFont NAME aFontInfo[ 4 ] ;
             SIZE aFontInfo[ 2 ], aFontInfo[ 1 ] NESCAPEMENT 900 * If( ::nLayOut == LAYOUT_RIGHT, -1, 1 )
   ELSE
      DEFINE FONT oFont NAME aFontInfo[ 4 ] ;
             SIZE aFontInfo[ 2 ], aFontInfo[ 1 ]
   ENDIF

   ::SetFont( oFont )

   oFont:End()
#else

   if oFont == nil
      ::GetFont()
   else
      ::SetFont( oFont )
   endif
   if ::nLayOut == LAYOUT_RIGHT .OR. ::nLayOut == LAYOUT_LEFT
      oFont    := ::oFont:Escapement( If( ::nLayOut == LAYOUT_RIGHT, 2700, 900 ) )
      ::SetFont( oFont )
      oFont:End()
   endif

#endif
  // Replaced on 2014-07-25 FWH 14.07
  // Old code was prematurely destroying the parameter font in cases of RIGHT & LEFT
  // Old code was stripping of attributes like Bold,Italic,etc from the provided font
  //
  //
  if ::lTransparent
     if ::oWnd:oBrush != NIL
        ::SetBrush( ::oWnd:oBrush )
     else
        ::oBrush = TBrush():New( , ::oWnd:nClrPane )
     endif
  else
     ::oBrush = TBrush():New( , nClrPane )
  endif

  ::nFolderHeight := max( ::nFolderHeight, ::oFont:nHeight * 1.2 )

//////////////////////////end -->> byte-one 2010

   ::bClrTabs  = bClrTabs
   ::bClrText  = bClrText
   ::aAlign    = CheckArr( aAlign )
   ::aHelps    = CheckArr( aHelps )
   ::bPopUp    = bPopUp

   ::aDialogs = Array( nLen )
   ::aBitmaps = {}
   ::aBrightBmp = {}
   ::LoadBitmaps( aBitmaps )

   DEFAULT cVarName := "oFldEx" + ::GetCtrlIndex()
   ::cVarName = cVarName
   for n = 1 to nLen

      DEFINE DIALOG oDlg OF Self STYLE nOR( WS_CHILD, If( ! ::oWnd:IsKindOf( "TDIALOG"), WS_CLIPCHILDREN, 0 ) );
         FROM 0, 1 TO ::nHeight(), ::nWidth() PIXEL ;
         FONT ::ownd:oFont ;
         HELPID If( Len( ::aHelps ) >= n , ::aHelps[ n ] , NIL )

      oDlg:SetBrush( ::oBrush )
      ::aDialogs[ n ] = oDlg

      oDlg:cVarName := "Page" + AllTrim( Str( n ) )
      oDlg:Hide()
      // oDlg:lTransparent := .T.

   next

File: source/classes/tfoldex.prg (L841-859)

Code (text): Select all Collapse
      if oDlg:hWnd == NIL
         ACTIVATE DIALOG oDlg NOWAIT VALID ( Self, .f. );
               ON INIT ::Move( aMove[ 1 ], aMove[ 2 ] )
      endif
      oDlg:SetSize( aMove[ 3 ], aMove[ 4 ] + 2 )
      oDlg:Hide()


   NEXT

   IF Len( ::aDialogs ) > 0
      IF ::nOption <= Len( ::aDialogs )
         ::aDialogs[ ::nOption ]:Show()
      ENDIF
   ENDIF

   ::ReSize()

RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion