2011-12-13 17:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/gtwvg/wvgax.prg
  * contrib/gtwvg/wvgcheck.prg
  * contrib/gtwvg/wvgdarea.prg
  * contrib/gtwvg/wvglistb.prg
  * contrib/gtwvg/wvgpushb.prg
  * contrib/gtwvg/wvgscrlb.prg
  * contrib/gtwvg/wvgsle.prg
  * contrib/gtwvg/wvgwin.c
  * contrib/gtwvg/wvtwin.ch
    + Implemented: ::pointerFocus for WvgPushButton() and WvgCheckBox().
       This facilitates not to keep focus on push buttons after click.
    ! Fixed: focussing issues for WvgScrollBar() objects.
    + Implemented: WvgActiveXControl() for CUI hosting.

  * contrib/gtwvg/tests/demowvg.prg
  * contrib/gtwvg/tests/wvgtbrowser.prg
    + Reworked: The browser demonstration now holds Shell.Explorer.2 
       active-x control to navigate the web. Just click on "Active-X"
       check box.
    ! Fixed: navigation glitch when another control was activated 
       while the current focus has been on another GUI control.

    NOTE: this implementation is now production ready, take use of it.
This commit is contained in:
Pritpal Bedi
2011-12-14 01:22:25 +00:00
parent 0c58dc31b5
commit 22e96b642c
12 changed files with 422 additions and 234 deletions

View File

@@ -16,6 +16,31 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-12-13 17:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/wvgax.prg
* contrib/gtwvg/wvgcheck.prg
* contrib/gtwvg/wvgdarea.prg
* contrib/gtwvg/wvglistb.prg
* contrib/gtwvg/wvgpushb.prg
* contrib/gtwvg/wvgscrlb.prg
* contrib/gtwvg/wvgsle.prg
* contrib/gtwvg/wvgwin.c
* contrib/gtwvg/wvtwin.ch
+ Implemented: ::pointerFocus for WvgPushButton() and WvgCheckBox().
This facilitates not to keep focus on push buttons after click.
! Fixed: focussing issues for WvgScrollBar() objects.
+ Implemented: WvgActiveXControl() for CUI hosting.
* contrib/gtwvg/tests/demowvg.prg
* contrib/gtwvg/tests/wvgtbrowser.prg
+ Reworked: The browser demonstration now holds Shell.Explorer.2
active-x control to navigate the web. Just click on "Active-X"
check box.
! Fixed: navigation glitch when another control was activated
while the current focus has been on another GUI control.
NOTE: this implementation is now production ready, take use of it.
2011-12-13 10:37 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/src/rdd/dbfnsx/dbfnsx1.c
! fixed index header verification when index is loaded.

View File

@@ -581,39 +581,46 @@ FUNCTION BuildButtons()
LOCAL oXbp
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .f.
oXbp:caption := "Hi"
oXbp:create( , , { {|| -( maxrow()-1 ) }, -1 }, { -2, -4 } )
oXbp:activate := {|| Wvg_MessageBox( , "Harbour!" ) }
oXbp:toolTipText := "Harbour CUI/GUI Console"
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .f.
oXbp:caption := IMAGE_VOUCH
oXbp:create( , , { {|| -( maxrow()-1 ) }, -6 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F2 ) }
oXbp:toolTipText := "Open Another GET Screen"
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .f.
oXbp:caption := IMAGE_BROWSE
oXbp:create( , , { {|| -( maxrow()-1 ) }, -11 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F5 ) }
oXbp:toolTipText := "TBrowse + GUI Controls"
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .f.
oXbp:caption := IMAGE_NOTES
oXbp:create( , , { {|| -( maxrow()-1 ) }, -16 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F3 ) }
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .f.
oXbp:caption := IMAGE_TOOLS
oXbp:create( , , { {|| -( maxrow()-1 ) }, -21 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F6 ) }
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .f.
oXbp:caption := IMAGE_HELP
oXbp:create( , , { {|| -( maxrow()-1 ) }, -26 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F7 ) }
oXbp := WvgPushButton():new()
oXbp:pointerFocus := .f.
oXbp:caption := IMAGE_VR
oXbp:border := .f.
oXbp:create( , , { {|| -( maxrow()-1 ) }, -31 }, { -2, -4 } )

View File

@@ -60,7 +60,7 @@ FUNCTION WvtMyBrowse()
//----------------------------------------------------------------------//
FUNCTION ExecBrowser( oCrt )
LOCAL nKey, bBlock, oBrowse , aLastPaint, i, pGT, oVBar, oHBar
LOCAL nKey, bBlock, oBrowse , aLastPaint, i, pGT
LOCAL cFileIndex, cFileDbf, cRDD, nIndex, oTBar, cScr, info_ //, oLB
LOCAL lEnd := .f.
LOCAL aBlocks := {}
@@ -74,9 +74,11 @@ FUNCTION ExecBrowser( oCrt )
LOCAL cColor := SetColor( "N/W*,N/GR*,,,N/W*" )
LOCAL aObjects := WvtSetObjects( {} )
LOCAL hPopup := Wvt_SetPopupMenu()
LOCAL oVBar, oHBar, oCom, oTre, oChk, oSLE, oLBx, aNvg, oIdx
STATIC nStyle := 0
THREAD STATIC nFactor := 200
THREAD STATIC lActiveX := .f.
IF oCrt == NIL
cScr := SaveScreen( 0,0,maxrow(),maxcol() )
@@ -84,6 +86,8 @@ FUNCTION ExecBrowser( oCrt )
BrwBuildMenu( oCrt )
oTBar := BrwBuildToolBar( oCrt )
oTBar:buttonClick := {|oBtn| Vou_ExecTBarAction( oBtn ) }
SetMode( maxrow()+1, maxCol()+1 ) /* Neccessary because adding menu has reduced the overall size of window */
pGT := SetGT( 2, hb_gtSelect() )
@@ -111,7 +115,7 @@ FUNCTION ExecBrowser( oCrt )
Popups( 2 )
oBrowse := TBrowseWVG():New( nTop + 3, nLeft + 12, nBottom - 1, nRight - 2 )
oBrowse := TBrowseWVG():New( nTop + 2, nLeft + 12, nBottom - 1, nRight - 1 )
oBrowse:ColSep := " "
oBrowse:HeadSep := "__"
@@ -141,17 +145,19 @@ FUNCTION ExecBrowser( oCrt )
aLastPaint := WvtSetBlocks( aBlocks )
BrwBuildCheckBox( oCrt, oBrowse )
BrwBuildSLE( oCrt, oBrowse )
BrwBuildListBox( oCrt, oBrowse )
BrwBuildMLE( oCrt, oBrowse )
BrwBuildButtons( oCrt, oBrowse )
BrwBuildTree( oCrt, oBrowse )
DispBox( 0, 0, maxrow(), maxcol(), " ", "N/W" )
DispOutAt( oBrowse:nTop-2, oBrowse:nleft-2, padc( cFileDbf, oBrowse:nRight-oBrowse:nLeft+5 ), "W+/B*" )
oTBar:buttonClick := {|oBtn| Vou_ExecTBarAction( oBtn ) }
oCom := BrwBuildActiveX( oCrt, oBrowse )
oChk := BrwBuildCheckBox( oCrt, oBrowse, @lActiveX )
oSLE := BrwBuildSLE( oCrt, oBrowse )
aNvg := BrwBuildNvg( oCrt, oBrowse, oCom )
oLBx := BrwBuildListBox( oCrt, oBrowse )
oIdx := BrwBuildListBoxIdx( oCrt, oBrowse )
BrwBuildButtons( oCrt, oBrowse )
oTre := BrwBuildTree( oCrt, oBrowse )
Wvt_Keyboard( HB_K_RESIZE ) /* Refresh All GUI Controls */
WHILE ! lEnd
dispbegin()
@@ -200,14 +206,7 @@ FUNCTION ExecBrowser( oCrt )
CASE BrwHandleKey( oBrowse, nKey, @lEnd )
CASE nKey == HB_K_RESIZE
oBrowse:nBottom := maxrow() - 3
oBrowse:nRight := maxcol() - 5
BrwReposButtons( oCrt ) /* Because we are repositioning at the center of console width */
DispBox( 0, 0, maxrow(), maxcol(), " ", "N/W" )
DispOutAt( oBrowse:nTop-2, oBrowse:nleft-2, padc( cFileDbf, oBrowse:nRight - oBrowse:nLeft + 5 ), "W+/B*" )
oBrowse:configure()
BrwHandleResize( oCrt, oBrowse, oVBar, oHBar, oCom, oSLE, oLBx, oTre, oChk, aNvg, oIdx, lActiveX, cFileDbf )
ENDCASE
END
@@ -231,6 +230,52 @@ FUNCTION ExecBrowser( oCrt )
//-------------------------------------------------------------------//
STATIC FUNCTION BrwHandleResize( oCrt, oBrw, oVBar, oHBar, oCom, oSLE, oLBx, oTre, oChk, aNvg, oIdx, lActiveX, cFileDbf )
HB_SYMBOL_UNUSED( oSle )
HB_SYMBOL_UNUSED( oLBx )
HB_SYMBOL_UNUSED( oChk )
HB_SYMBOL_UNUSED( oIdx )
oCrt:setFocus()
oBrw:nBottom := iif( lActiveX, 20, maxrow()-3 )
oBrw:nRight := maxcol()-4
oBrw:configure()
DispBox( 0, 0, maxrow(), maxcol(), " ", "N/W" )
DispOutAt( oBrw:nTop-2, oBrw:nleft-2, padc( cFileDbf, oBrw:nRight - oBrw:nLeft + 5 ), "W+/B*" )
oVBar:setPosAndSize()
oHBar:setPosAndSize()
oCom:setPosAndSize()
// oSLE:setPosAndSize()
// oLBx:setPosAndSize()
// oIdx:setPosAndSize()
oTre:setPosAndSize()
// oChk:setPosAndSize()
BrwReposButtons( oCrt ) /* Because we are repositioning at the center of console width */
IF lActiveX
aNvg[ 1 ]:show()
aNvg[ 2 ]:show()
oCom:show()
ELSE
aNvg[ 1 ]:hide()
aNvg[ 2 ]:hide()
oCom:hide()
ENDIF
/* Why this is needed if WvgActiveXControl is hosted on the GT console */
oCrt:hide()
oCrt:show()
RETURN .t.
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwShowColumn( oBrw, cHeading )
LOCAL i, j, nCur
@@ -263,7 +308,7 @@ STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ )
oTree:hasLines := .T.
oTree:hasButtons := .T.
oTree:alwaysShowSelection := .T.
oTree:create( , , { -25, -1 }, { {|| -( maxrow()-1-25 ) }, -10 } )
oTree:create( , , { -24, -1 }, { {|| -( maxrow()-1-24 ) }, -10 } )
oTree:setColorFG( "W+" )
oTree:setColorBG( "R*" )
oTree:itemSelected := {|oItem| WVG_MessageBox( , iif( oItem <> NIL, oItem:caption, "Some Problem" ) ) }
@@ -284,42 +329,22 @@ STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ )
oTree:tooltipText := "Treeview embedded onto CUI window"
RETURN NIL
RETURN oTree
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildMLE( oCrt /*, oBrw*/ )
LOCAL oXbp
STATIC FUNCTION BrwBuildActiveX( oCrt, oBrw )
LOCAL oCom
oXbp := WvgMLE():new( oCrt )
oXbp:create( , , { -16,-1 }, { -8, -10 }, , .t. )
oXbp:setColorFG( "B" )
oXbp:setData( "Harbour's implementation of GUI controls onto CUI console." )
oXbp:tooltipText := "Multi-line Edit Control"
HB_SYMBOL_UNUSED( oBrw )
RETURN NIL
oCom := WvgActiveXControl():new( oCrt, , { -24, -13 }, { {|| -( maxrow()-1-24 ) }, {|| -( maxcol()-1-13 ) } }, , .f. )
oCom:CLSID := 'Shell.Explorer.2'
//oCom:mapEvent( 269, {|| uiDebug( ' E X P L O R E R - 2 6 9' ) } )
oCom:create()
oCom:navigate( "http://hbide.vouch.info" )
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildSLE( oCrt, oBrw )
LOCAL oXbp
oXbp := WvgStatic():new( oCrt )
oXbp:type := WVGSTATIC_TYPE_TEXT
oXbp:options := WVGSTATIC_TEXT_LEFT
oXbp:caption := "Field Name:"
oXbp:create( , , { -3, -13 }, { -1, -7 } )
oXbp:setColorFG( "W+" )
oXbp:setColorBG( "BG" )
oXbp := WvgSLE():new( oCrt )
oXbp:create( , , { -3, -21 }, { -1, -20 } )
oXbp:setColorFG( "N" )
oXbp:setColorBG( "BG+" )
oXbp:returnPressed := {|m1,m2,o| m1:=m1, m2:=m2, BrwShowColumn( oBrw, upper( trim( o:getData() ) ) ) }
oXbp:tooltipText := "Type in a field name and press ENTER"
RETURN NIL
RETURN oCom
/*----------------------------------------------------------------------*/
@@ -327,7 +352,7 @@ STATIC FUNCTION BrwBuildListBox( oCrt, oBrw )
LOCAL oXbp, i
oXbp := WvgListBox():new( oCrt )
oXbp:create( , , { -5,-1 }, { -10, -10 }, , .t. )
oXbp:create( , , { -4,-1 }, { -10, -10 }, , .t. )
oXbp:setColorFG( "W+" )
oXbp:setColorBG( "B*" )
oXbp:itemMarked := {|m1,m2,o| m1 := m1, m2 := m2, BrwShowColumn( oBrw, o:getCurItem() ) }
@@ -341,19 +366,105 @@ STATIC FUNCTION BrwBuildListBox( oCrt, oBrw )
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw )
STATIC FUNCTION BrwSetThisOrder( oBrw, nOrd )
DbSetOrder( nOrd )
oBrw:refreshAll()
oBrw:forceStable()
RETURN NIL
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw )
LOCAL oXbp, i, cKey, aIdx := {}
FOR i := 1 TO 10
IF ( cKey := IndexKey( i ) ) == ""
EXIT
ENDIF
aadd( aIdx, OrdName( i ) + ": " + cKey )
NEXT
oXbp := WvgListBox():new( oCrt )
oXbp:create( , , { -18,-1 }, { -5, -10 }, , .t. )
oXbp:setColorFG( "W+" )
oXbp:setColorBG( "B*" )
oXbp:itemMarked := {|m1,m2,o| m1 := m2, BrwSetThisOrder( oBrw, max( 0, ascan( aIdx, o:getCurItem() )-1 ) ) }
oXbp:addItem( "Natural Order" )
FOR i := 1 TO len( aIdx )
oXbp:addItem( aIdx[ i ] )
NEXT
oXbp:setData( 3 )
oXbp:tooltipText := "Click on an index to order database!"
RETURN oXbp
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildSLE( oCrt, oBrw )
LOCAL oXbp
oXbp := WvgStatic():new( oCrt )
oXbp:type := WVGSTATIC_TYPE_TEXT
oXbp:options := WVGSTATIC_TEXT_CENTER
oXbp:caption := "Field Name"
oXbp:create( , , { -15, -1 }, { -1, -10 } )
oXbp:setColorFG( "W+" )
oXbp:setColorBG( "BG" )
oXbp := WvgSLE():new( oCrt )
oXbp:create( , , { -16, -1 }, { -1, -10 } )
oXbp:setColorFG( "N" )
oXbp:setColorBG( "BG+" )
oXbp:returnPressed := {|m1,m2,o| m1:=m1, m2:=m2, BrwShowColumn( oBrw, upper( trim( o:getData() ) ) ) }
oXbp:tooltipText := "Type in a field name and press ENTER"
RETURN oXbp
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildNvg( oCrt, oBrw, oCom )
LOCAL oLbl, oXbp
HB_SYMBOL_UNUSED( oBrw )
oLbl := WvgStatic():new( oCrt )
oLbl:type := WVGSTATIC_TYPE_TEXT
oLbl:options := WVGSTATIC_TEXT_LEFT
oLbl:caption := "Navigate"
oLbl:create( , , { -23, -13 }, { -1, -6 }, , .f. )
oLbl:setColorFG( "W+" )
oLbl:setColorBG( "BG" )
oXbp := WvgSLE():new( oCrt )
oXbp:bufferLength := 300
oXbp:create( , , { -23, -19 }, { -1, {|| -( maxcol()-1-19 ) } }, , .f. )
oXbp:setColorFG( "N" )
oXbp:setColorBG( "BG+" )
oXbp:returnPressed := {|m1,m2,o| m1:=m2, oCom:navigate( trim( o:getData() ) ) }
oXbp:tooltipText := "Type in a http:// address and press ENTER"
oXbp:setData( "http://hbide.vouch.info/" )
RETURN { oLbl, oXbp }
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw, lActiveX )
LOCAL oXbp
HB_SYMBOL_UNUSED( oBrw )
oXbp := WvgCheckBox():new( oCrt )
oXbp:caption := "Navigate"
oXbp:selected := {|x,y,o| x := x, y := y, iif( o:getData(), oBrw:goTop():forceStable(), oBrw:goBottom():forceStable() ) }
oXbp:selection := .t.
oXbp:create( , , { -3,-1 }, { -1,-7 } )
oXbp:pointerFocus := .f.
oXbp:caption := "ActiveX"
oXbp:selected := {|x,y,o| x := y, lActiveX := o:getData(), Wvt_Keyboard( HB_K_RESIZE ) }
oXbp:selection := .f.
oXbp:create( , , { -23,-1 }, { -1,-10 } )
oXbp:setColorFG( "R+" )
oXbp:setColorBG( "W" )
oXbp:tooltipText := "Checked: GoTop, Unchecked: GoBottom"
oXbp:tooltipText := "Naviagate: http://hbide.vouch.info"
RETURN NIL
RETURN oXbp
/*----------------------------------------------------------------------*/
@@ -399,6 +510,9 @@ STATIC FUNCTION BrwBuildButtons( oCrt, oBrw )
FOR i := 1 TO len( aPmt )
oPB := WvgPushButton():new( oCrt )
IF i == 3 /* We do not want this button to gain focus anytime */
oPB:pointerFocus := .f.
ENDIF
IF i == len( aPmt )
oPB:caption := hb_dirBase() + "\" + "v_lock.bmp"
oPB:create( , , { {|| -maxrow() }, -nOff }, { -1,-aW[ i ] } )
@@ -411,16 +525,96 @@ STATIC FUNCTION BrwBuildButtons( oCrt, oBrw )
oPB:tooltipText := aPmt[ i ]
nOff += aW[ i ] + nG
IF i == len( aPmt )
oPB:destroy()
ENDIF
NEXT
RETURN NIL
/*----------------------------------------------------------------------*/
FUNCTION Vou_BrwAddScrollBars( oCrt, oBrw, oVBar, oHBar )
oHBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nBottom+1 ) }, {|| -( oBrw:nLeft ) } }, ;
{ -1, {|| -( oBrw:nRight - oBrw:nLeft + 1 ) } } )
oHBar:range := { 1, oBrw:colCount }
oHBar:type := WVGSCROLL_HORIZONTAL
oHBar:create()
oHBar:scroll := {|mp1| oBrw:colPos := mp1[ 1 ], oBrw:refreshAll(), oBrw:forceStable() }
oVBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nTop ) }, {|| -( oBrw:nRight+1 ) } }, ;
{ {|| -( oBrw:nBottom-oBrw:nTop+1 ) }, {|| -( 2 ) } } )
oVBar:range := { 1, LastRec() }
oVBar:type := WVGSCROLL_VERTICAL
oVBar:create()
oVBar:scroll := {|mp1| Vou_BrwSetVScroll( mp1, oBrw ) }
RETURN NIL
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwBuildMenu( oCrt )
LOCAL oMenu, oSMenu
oMenu := oCrt:menubar()
oSMenu := WvgMenu():new( oMenu ):create()
oSMenu:addItem( { '~First' , {|| alert( 'First' ) } } )
oSMenu:addItem( { '~Second', {|| alert( 'Second' ) } } )
oSMenu:addItem()
oSMenu:addItem( { '~Third' , {|| alert( 'Third' ) } } )
oMenu:addItem( { oSMenu, '~Hello' } )
oSMenu := WvgMenu():new( oMenu ):create()
oSMenu:addItem( { '~First' , {|| alert( 'First' ) } } )
oSMenu:addItem( '-' )
oSMenu:addItem( { '~Second', {|| alert( 'Second' ) } } )
oSMenu:addItem( { '~Third' , {|| alert( 'Third' ) } } )
oMenu:addItem( { oSMenu, '~MyFriends' } )
oSMenu := WvgMenu():new( oMenu ):create()
oSMenu:title := "~Procedural"
oSMenu:addItem( { "Procedure ~1", } )
oSMenu:addItem( { "Procedure ~2", } )
oSMenu:itemSelected := {|mp1| MyMenuProcedure( 100+mp1 ) }
oSMenu:checkItem( 2 )
oMenu:addItem( { oSMenu, NIL } )
RETURN oMenu
//----------------------------------------------------------------------//
STATIC FUNCTION BrwBuildToolBar( oCrt )
LOCAL oTBar, nRGB := RGB( 172,172,172 )
oTBar := WvgToolBar():new( oCrt, , { -0.1,-0.1 }, { -3, {|| -( maxcol()+1 ) } } )
oTBar:style := WVGTOOLBAR_STYLE_FLAT
oTBar:borderStyle := WVGFRAME_RECT
oTBar:buttonWidth := 40 //28
oTBar:buttonHeight := 26
oTBar:imageWidth := 26
oTBar:imageHeight := 24
oTBar:showToolTips := .t.
// After setting properties, create toolbar.
oTBar:create()
oTBar:addItem( "New" , hb_DirBase() + 'v_new.bmp' , , , , , , nRGB )
oTBar:addItem( "Select" , hb_DirBase() + 'v_selct1.bmp', , , , , , nRGB )
oTBar:addItem( "Calendar" , hb_DirBase() + 'v_calend.bmp', , , , , , nRGB )
oTBar:addItem( "Tools" , hb_DirBase() + 'v_lock.bmp' , , , , , , nRGB )
oTBar:addItem( "Index" , hb_DirBase() + 'v_index.bmp' , , , , , , nRGB )
oTBar:addItem( "Show" , hb_DirBase() + 'v_clclt.bmp' , , , , , , nRGB )
oTBar:addItem( "Hide" , hb_DirBase() + 'v_notes1.bmp', , , , , , nRGB )
RETURN oTBar
//----------------------------------------------------------------------//
// Key Handelling
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
LOCAL lVMove := .f.
LOCAL lHMove := .f.
@@ -512,6 +706,50 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
/*----------------------------------------------------------------------*/
FUNCTION Vou_NavigateToCell( oBrowse )
LOCAL nCount
IF LastKey() == K_LBUTTONUP
IF oBrowse:hitTest( mrow(), mcol() ) == -5121 // on a cell
oBrowse:deHilite()
oBrowse:refreshCurrent()
oBrowse:forceStable()
nCount := oBrowse:mRowPos - oBrowse:RowPos
DispBegin()
WHILE ( nCount < 0 )
nCount++
oBrowse:Up()
ENDDO
WHILE ( nCount > 0 )
nCount --
oBrowse:Down()
ENDDO
nCount := oBrowse:mColPos - oBrowse:ColPos
WHILE ( nCount < 0 )
nCount++
oBrowse:Left()
ENDDO
WHILE ( nCount > 0 )
nCount--
oBrowse:Right()
ENDDO
oBrowse:forceStable()
DispEnd()
oBrowse:hilite()
RETURN .t.
ENDIF
ENDIF
RETURN .f.
/*----------------------------------------------------------------------*/
STATIC FUNCTION DbSkipBlock( n )
LOCAL nSkipped := 0
@@ -593,63 +831,6 @@ STATIC FUNCTION Vou_ExecTBarAction( oBtn )
/*----------------------------------------------------------------------*/
FUNCTION Vou_NavigateToCell( oBrowse )
LOCAL nCount
LOCAL nHitWhere := oBrowse:HitTest( mrow(), mcol() )
IF nHitWhere == -5121 // on a cell
nCount := oBrowse:mRowPos - oBrowse:RowPos
DispBegin()
WHILE ( nCount < 0 )
nCount++
oBrowse:Up()
oBrowse:ForceStable()
ENDDO
WHILE ( nCount > 0 )
nCount --
oBrowse:Down()
oBrowse:ForceStable()
ENDDO
nCount := oBrowse:mColPos - oBrowse:ColPos
WHILE ( nCount < 0 )
nCount++
oBrowse:Left()
ENDDO
WHILE ( nCount > 0 )
nCount--
oBrowse:Right()
ENDDO
DispEnd()
RETURN .t.
ENDIF
RETURN .f.
/*----------------------------------------------------------------------*/
FUNCTION Vou_BrwAddScrollBars( oCrt, oBrowse, oVBar, oHBar )
oHBar := WvgScrollBar():new( oCrt, , { {|| -( maxrow()-2 ) }, {|| -( oBrowse:nLeft ) } }, ;
{ -1, {|| -( maxcol() - 5 - oBrowse:nLeft + 1 ) } } )
oHBar:range := { 1, oBrowse:colCount }
oHBar:type := WVGSCROLL_HORIZONTAL
oHBar:create()
oHBar:scroll := {|mp1| oBrowse:colPos := mp1[ 1 ], oBrowse:refreshAll(), oBrowse:forceStable() }
oVBar := WvgScrollBar():new( oCrt, , { {|| -( oBrowse:nTop ) }, {|| -( maxcol()-4 ) } }, ;
{ {|| -( maxrow()-3-oBrowse:nTop+1 ) }, {|| -( 2 ) } } )
oVBar:range := { 1, LastRec() }
oVBar:type := WVGSCROLL_VERTICAL
oVBar:create()
oVBar:scroll := {|mp1| Vou_BrwSetVScroll( mp1, oBrowse ) }
RETURN NIL
/*----------------------------------------------------------------------*/
FUNCTION Vou_BrwSetVScroll( mp1, oBrowse )
LOCAL nCmd, nPos
@@ -847,65 +1028,3 @@ FUNCTION ConfigBrowser( aFields, cUseAlias, aTLBR, cDesc, oParent, cColorSpec, n
//-------------------------------------------------------------------//
STATIC FUNCTION BrwBuildMenu( oCrt )
LOCAL oMenu, oSMenu
oMenu := oCrt:menubar()
oSMenu := WvgMenu():new( oMenu ):create()
oSMenu:addItem( { '~First' , {|| alert( 'First' ) } } )
oSMenu:addItem( { '~Second', {|| alert( 'Second' ) } } )
oSMenu:addItem()
oSMenu:addItem( { '~Third' , {|| alert( 'Third' ) } } )
oMenu:addItem( { oSMenu, '~Hello' } )
oSMenu := WvgMenu():new( oMenu ):create()
oSMenu:addItem( { '~First' , {|| alert( 'First' ) } } )
oSMenu:addItem( '-' )
oSMenu:addItem( { '~Second', {|| alert( 'Second' ) } } )
oSMenu:addItem( { '~Third' , {|| alert( 'Third' ) } } )
oMenu:addItem( { oSMenu, '~MyFriends' } )
oSMenu := WvgMenu():new( oMenu ):create()
oSMenu:title := "~Procedural"
oSMenu:addItem( { "Procedure ~1", } )
oSMenu:addItem( { "Procedure ~2", } )
oSMenu:itemSelected := {|mp1| MyMenuProcedure( 100+mp1 ) }
oSMenu:checkItem( 2 )
oMenu:addItem( { oSMenu, NIL } )
RETURN oMenu
//----------------------------------------------------------------------//
STATIC FUNCTION BrwBuildToolBar( oCrt )
LOCAL oTBar
oTBar := WvgToolBar():new( oCrt, , { -0.1,-0.1 }, { -3, {|| -( maxcol()+1 ) } } )
oTBar:style := WVGTOOLBAR_STYLE_FLAT
oTBar:borderStyle := WVGFRAME_RECT
oTBar:buttonWidth := 40 //28
oTBar:buttonHeight := 26
oTBar:imageWidth := 26
oTBar:imageHeight := 24
oTBar:showToolTips := .t.
// After setting properties, create toolbar.
oTBar:create()
oTBar:addItem( "New" , hb_DirBase() + 'v_new.bmp' )
oTBar:addItem( "Select" , hb_DirBase() + 'v_selct1.bmp' )
oTBar:addItem( "Calendar" , hb_DirBase() + 'v_calend.bmp' )
oTBar:addItem( "Tools" , hb_DirBase() + 'v_lock.bmp' )
oTBar:addItem( "Index" , hb_DirBase() + 'v_index.bmp' )
oTBar:addItem( "Show" , hb_DirBase() + 'v_clclt.bmp' )
oTBar:addItem( "Hide" , hb_DirBase() + 'v_notes1.bmp' )
RETURN oTBar
//----------------------------------------------------------------------//

View File

@@ -84,7 +84,6 @@ CLASS WvgActiveXControl FROM WvgWindow
DATA server INIT NIL
DATA license INIT NIL
DATA controlFlags INIT 0
DATA visible INIT .T.
DATA default INIT .F.
DATA cancel INIT .F.
@@ -102,7 +101,7 @@ CLASS WvgActiveXControl FROM WvgWindow
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLicense )
METHOD Destroy()
METHOD execEvent( nEvent, ... )
METHOD handleEvent( nEvent, aInfo )
METHOD handleEvent( nEvent, aNM )
METHOD mapEvent( nEvent, bBlock )
METHOD inheritPresParams()
@@ -129,6 +128,7 @@ METHOD WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisibl
::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::style := WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN + WS_CLIPSIBLINGS
::exStyle := WS_EX_CLIENTEDGE
::objType := objTypeActiveX
::className := 'WIN_OLEAUTO'
@@ -158,25 +158,39 @@ METHOD WvgActiveXControl:Create( oParent, oOwner, aPos, aSize, aPresParams, lVis
Win_AxInit()
hWnd := WAPI_CreateWindowEX( 0, "AtlAxWin", ::CLSID, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ;
hWnd := WAPI_CreateWindowEX( ::exStyle, "AtlAxWin", ::CLSID, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ;
::aSize[ 1 ], ::aSize[ 2 ], Win_N2P( ::hContainer ), 0 )
IF empty( hWnd )
RETURN NIL
ENDIF
::hWnd := Win_P2N( hWnd )
::pWnd := hWnd
hObj := __AxGetControl( Win_N2P( ::hWnd ) )
hObj := __AxGetControl( ::pWnd )
if empty( hObj )
RETURN NIL
ENDIF
::oOLE:__hObj := hObj
__AxDoVerb( Win_N2P( ::hWnd ), -4 )
__AxDoVerb( ::pWnd, -4 )
IF !Empty( ::hEvents )
::oOle:__hSink := __AxRegisterHandler( ::oOle:__hObj, {|nEvent,...| ::execEvent( nEvent, ... ) } )
ENDIF
::oParent:addChild( SELF )
#if 0
::SetWindowProcCallback() /* Is this needed to catch windowing events ? - NO */
#endif
::oParent:addChild( Self )
IF ::visible
::show()
ELSE
::hide()
ENDIF
::setPosAndSize()
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
RETURN Self
@@ -199,16 +213,25 @@ PROCEDURE execEvent( nEvent, ... ) CLASS WvgActiveXControl
/*----------------------------------------------------------------------*/
METHOD WvgActiveXControl:handleEvent( nEvent, aInfo )
METHOD WvgActiveXControl:handleEvent( nEvent, aNM )
LOCAL nHandled := 0
HB_SYMBOL_UNUSED( aInfo )
HB_SYMBOL_UNUSED( aNM )
SWITCH nEvent
CASE WM_SIZE
CASE HB_GTE_RESIZED
IF ::isParentCrt()
::rePosition()
ENDIF
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, NIL, NIL, self )
eval( ::sl_resize, NIL, NIL, Self )
ENDIF
EXIT
CASE HB_GTE_ANY
IF aNM[ 1 ] == WM_LBUTTONUP
uiDebug( "here the event is caught" )
ENDIF
EXIT
@@ -227,12 +250,10 @@ METHOD WvgActiveXControl:OnError()
/*----------------------------------------------------------------------*/
METHOD WvgActiveXControl:Destroy()
#if 0
WAPI_OutputDebugString( "WvgActiveXControl:Destroy()" )
#endif
IF !empty( ::oOLE:__hObj )
IF WAPI_IsWindow( Win_N2P( ::hWnd ) )
WAPI_DestroyWindow( Win_N2P( ::hWnd ) )
IF ! empty( ::oOLE:__hObj )
IF WAPI_IsWindow( ::pWnd )
WAPI_DestroyWindow( ::pWnd )
ENDIF
::oOle := NIL
::hWnd := NIL
@@ -244,9 +265,9 @@ METHOD WvgActiveXControl:Destroy()
METHOD WvgActiveXControl:mapEvent( nEvent, bBlock )
if hb_isNumeric( nEvent ) .and. hb_isBlock( bBlock )
IF hb_isNumeric( nEvent ) .AND. hb_isBlock( bBlock )
::hEvents[ nEvent ] := bBlock
endif
ENDIF
RETURN Self

View File

@@ -159,10 +159,9 @@ METHOD WvgCheckBox:handleEvent( nMessage, aNM )
::oParent:setFocus()
ENDIF
eval( ::sl_lbClick, ::editBuffer, NIL, Self )
IF ::isParentCrt()
IF ::pointerFocus
::setFocus()
ENDIF
// RETURN EVENT_HANDELLED
ENDIF
ENDIF

View File

@@ -76,12 +76,6 @@
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_traceLog( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS WvgDrawingArea INHERIT WvgWindow
DATA caption INIT ""
@@ -130,12 +124,8 @@ METHOD WvgDrawingArea:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl
/*----------------------------------------------------------------------*/
METHOD WvgDrawingArea:handleEvent( nMessage, aNM )
LOCAL hDC
hb_traceLog( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
DO CASE
CASE nMessage == HB_GTE_RESIZED
IF hb_isBlock( ::sl_resize )
eval( ::sl_resize, NIL, NIL, self )
@@ -144,15 +134,12 @@ METHOD WvgDrawingArea:handleEvent( nMessage, aNM )
RETURN EVENT_HANDELLED
CASE nMessage == HB_GTE_CTLCOLOR
hDC := aNM[ 1 ]
IF hb_isNumeric( ::clr_FG )
WVG_SetTextColor( hDC, ::clr_FG )
WVG_SetTextColor( aNM[ 1 ], ::clr_FG )
ENDIF
IF hb_isNumeric( ::hBrushBG )
WVG_SetBkMode( hDC, 1 )
WVG_FillRect( hDC, { 0,0,::currentSize()[1],::currentSize()[2]}, ::hBrushBG )
WVG_SetBkMode( aNM[ 1 ], 1 )
WVG_FillRect( aNM[ 1 ], { 0,0,::currentSize()[1],::currentSize()[2]}, ::hBrushBG )
RETURN EVENT_HANDELLED
ENDIF

View File

@@ -222,7 +222,6 @@ METHOD WvgListBox:handleEvent( nMessage, aNM )
ENDIF
CASE nMessage == HB_GTE_NOTIFY
uiDebug( "listbox:notify", aNM[1], aNM[2], aNM[3] )
CASE nMessage == HB_GTE_CTLCOLOR
IF hb_isNumeric( ::clr_FG )

View File

@@ -154,7 +154,6 @@ METHOD WvgPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
METHOD WvgPushButton:handleEvent( nMessage, aNM )
DO CASE
CASE nMessage == HB_GTE_RESIZED
IF ::isParentCrt()
::rePosition()
@@ -171,7 +170,7 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM )
::oParent:setFocus()
ENDIF
eval( ::sl_lbClick, NIL, NIL, self )
IF ::isParentCrt()
IF ::pointerFocus
::setFocus()
ENDIF
ENDIF

View File

@@ -116,12 +116,6 @@ typedef struct tagRECT { ;
#endif
/*----------------------------------------------------------------------*/
#ifndef __DBG_PARTS__
#xtranslate hb_traceLog( [<x,...>] ) =>
#endif
/*----------------------------------------------------------------------*/
CLASS WvgScrollBar INHERIT WvgWindow, DataRef
DATA autoTrack INIT .t.
@@ -202,10 +196,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSc
METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar
LOCAL nScrMsg, nScrPos, nCommand
hb_traceLog( " %s:handleEvent( %i ) %i %i %i %i", __ObjGetClsName( self ), nMessage )
DO CASE
CASE nMessage == HB_GTE_RESIZED
IF ::isParentCrt()
::rePosition()
@@ -219,7 +210,11 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar
ENDIF
CASE nMessage == HB_GTE_HSCROLL
IF !hb_isBlock( ::sl_xbeSB_Scroll )
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
IF ! hb_isBlock( ::sl_xbeSB_Scroll )
RETURN EVENT_UNHANDELLED
ENDIF
@@ -227,7 +222,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar
IF nScrMsg == SB_THUMBPOSITION .or. nScrMsg == SB_THUMBTRACK
nScrPos := aNM[ 2 ]
ELSE
nScrPos := WAPI_GetScrollPos( ::pWnd, SB_CTL )
nScrPos := WAPI_GetScrollPos( ::pWnd, SB_CTL )
ENDIF
DO CASE
@@ -282,11 +277,14 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar
ENDCASE
::sl_editBuffer := nScrPos
eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, self )
eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, Self )
RETURN EVENT_HANDELLED
CASE nMessage == HB_GTE_VSCROLL
IF ::isParentCrt()
::oParent:setFocus()
ENDIF
nScrMsg := aNM[ 1 ]
IF nScrMsg == SB_THUMBPOSITION .or. nScrMsg == SB_THUMBTRACK
@@ -295,7 +293,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar
nScrPos := WAPI_GetScrollPos( ::pWnd, SB_CTL )
ENDIF
IF !hb_isBlock( ::sl_xbeSB_Scroll )
IF ! hb_isBlock( ::sl_xbeSB_Scroll )
RETURN EVENT_UNHANDELLED
ENDIF

View File

@@ -247,8 +247,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE
RETURN EVENT_HANDELLED
ENDIF
ELSEIF aNM[ 2 ] == 65
uiDebug( "edit",65 )
RETURN EVENT_HANDELLED
// RETURN EVENT_HANDELLED
ENDIF
ENDCASE

View File

@@ -188,6 +188,13 @@ HB_FUNC( WVG_SETFOCUS )
/*----------------------------------------------------------------------*/
HB_FUNC( WVG_GETFOCUS )
{
hb_retnint( ( HB_PTRDIFF ) GetFocus() );
}
/*----------------------------------------------------------------------*/
HB_FUNC( WVG_SETTEXTCOLOR )
{
hb_retnl( ( HB_ULONG ) SetTextColor( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( COLORREF ) hb_parnl( 2 ) ) );
@@ -1332,7 +1339,20 @@ HB_FUNC( WVG_SENDTOOLBARMESSAGE )
case TB_MAPACCELERATOR:
case TB_MOVEBUTTON:
case TB_GETINSERTMARK:
break;
case TB_GETCOLORSCHEME:
{
PHB_ITEM info = hb_itemArrayNew( 2 );
COLORSCHEME colorScheme;
colorScheme.dwSize = sizeof( COLORSCHEME );
SendMessage( hTB, TB_GETCOLORSCHEME, ( WPARAM ) 0, ( LPARAM ) & colorScheme );
hb_arraySetNInt( info, 1, colorScheme.clrBtnHighlight );
hb_arraySetNInt( info, 2, colorScheme.clrBtnShadow );
hb_itemReturnRelease( info );
break;
}
case TB_CUSTOMIZE:
case TB_GETANCHORHIGHLIGHT:
case TB_GETEXTENDEDSTYLE:

View File

@@ -212,7 +212,22 @@
#define TVN_FIRST (0-400)
#define HDM_FIRST 0x1200 // Header messages
#define TCM_FIRST 0x1300 // Tab control messages
#define CCM_FIRST 0x2000
#define CCM_LAST (CCM_FIRST+0x200)
#define CCM_SETBKCOLOR 8193
#define CCM_SETCOLORSCHEME 8194
#define CCM_GETCOLORSCHEME 8195
#define CCM_GETDROPTARGET 8196
#define CCM_SETUNICODEFORMAT 8197
#define CCM_GETUNICODEFORMAT 8198
#define CCM_SETVERSION 0x2007
#define CCM_GETVERSION 0x2008
#define CCM_SETNOTIFYWINDOW 0x2009
#define CCM_SETWINDOWTHEME 0x200b
#define CCM_DPISCALE 0x200c
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/