From c1c3baa7f0761cab72c65955d28d4043731ed900 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 12 Dec 2011 20:02:01 +0000 Subject: [PATCH] 2011-12-12 11:54 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/wvggenrc.prg * contrib/gtwvg/wvglistb.prg * contrib/gtwvg/wvgphdlr.prg * contrib/gtwvg/wvgsle.prg * contrib/gtwvg/wvgwnd.prg * Changed: SetAppWindow() => WvgSetAppWindow() To facilitate simultaneous use of GTWVG with HBXBP. * Fixed: the way an indivisual child was being destroyed. It was causing flicker and GUI loss when clicking inside a control. Thanks Zoran for pointer and code example. * contrib/gtwvg/tests/demowvg.prg * contrib/gtwvg/tests/wvgtbrowser.prg * Refined: to accomodate above issues. --- harbour/ChangeLog | 16 +++++++ harbour/contrib/gtwvg/tests/demowvg.prg | 2 +- harbour/contrib/gtwvg/tests/wvgtbrowser.prg | 4 ++ harbour/contrib/gtwvg/wvggenrc.prg | 11 ++--- harbour/contrib/gtwvg/wvglistb.prg | 1 - harbour/contrib/gtwvg/wvgphdlr.prg | 12 +++++ harbour/contrib/gtwvg/wvgsle.prg | 53 ++++++++++----------- harbour/contrib/gtwvg/wvgwnd.prg | 13 ++--- 8 files changed, 66 insertions(+), 46 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 68e3bb3328..b3622b64bc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,22 @@ The license applies to all entries newer than 2009-04-28. */ +2011-12-12 11:54 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/gtwvg/wvggenrc.prg + * contrib/gtwvg/wvglistb.prg + * contrib/gtwvg/wvgphdlr.prg + * contrib/gtwvg/wvgsle.prg + * contrib/gtwvg/wvgwnd.prg + * Changed: SetAppWindow() => WvgSetAppWindow() + To facilitate simultaneous use of GTWVG with HBXBP. + * Fixed: the way an indivisual child was being destroyed. + It was causing flicker and GUI loss when clicking + inside a control. Thanks Zoran for pointer and code example. + + * contrib/gtwvg/tests/demowvg.prg + * contrib/gtwvg/tests/wvgtbrowser.prg + * Refined: to accomodate above issues. + 2011-12-10 13:52 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/tests/wvgtbrowser.prg + Extended: the way to anchor tree-view control's row-to to diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index 21dbb9f82e..1227d15877 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -454,7 +454,7 @@ function WvtLines() FUNCTION BuildMainMenu() LOCAL oMenu - LOCAL g_oMenuBar := SetAppWindow():menuBar() + LOCAL g_oMenuBar := WvgSetAppWindow():menuBar() oMenu := WvgMenu():new( g_oMenuBar, , .t. ):create() oMenu:Caption:= "Wvt*Classes" diff --git a/harbour/contrib/gtwvg/tests/wvgtbrowser.prg b/harbour/contrib/gtwvg/tests/wvgtbrowser.prg index c5b072bc60..c492ef3d18 100644 --- a/harbour/contrib/gtwvg/tests/wvgtbrowser.prg +++ b/harbour/contrib/gtwvg/tests/wvgtbrowser.prg @@ -411,6 +411,10 @@ STATIC FUNCTION BrwBuildButtons( oCrt, oBrw ) oPB:tooltipText := aPmt[ i ] nOff += aW[ i ] + nG + + IF i == len( aPmt ) + oPB:destroy() + ENDIF NEXT RETURN NIL diff --git a/harbour/contrib/gtwvg/wvggenrc.prg b/harbour/contrib/gtwvg/wvggenrc.prg index d4a1ddb3f2..d18ba96521 100644 --- a/harbour/contrib/gtwvg/wvggenrc.prg +++ b/harbour/contrib/gtwvg/wvggenrc.prg @@ -81,22 +81,17 @@ /*----------------------------------------------------------------------*/ EXIT PROCEDURE KillGTChildren() - LOCAL aChilds, oXbp IF hb_isObject( s_oCrt ) .AND. __objGetClsName( s_oCrt ) == "WVGCRT" .AND. s_oCrt:isGT - IF ! empty( aChilds := s_oCrt:childList() ) - FOR EACH oXbp IN aChilds - oXbp:destroy() - oXbp := NIL - NEXT - ENDIF + s_oCrt:destroy() + s_oCrt := NIL ENDIF RETURN /*----------------------------------------------------------------------*/ -FUNCTION SetAppWindow( oCrt ) +FUNCTION WvgSetAppWindow( oCrt ) LOCAL ooCrt := s_oCrt IF empty( oCrt ) diff --git a/harbour/contrib/gtwvg/wvglistb.prg b/harbour/contrib/gtwvg/wvglistb.prg index aaaeb6edf8..d78cf084ae 100644 --- a/harbour/contrib/gtwvg/wvglistb.prg +++ b/harbour/contrib/gtwvg/wvglistb.prg @@ -194,7 +194,6 @@ METHOD WvgListBox:handleEvent( nMessage, aNM ) ::sendMessage( WM_SIZE, 0, 0 ) CASE nMessage == HB_GTE_COMMAND -uiDebug( "listbox:command", aNM[1], aNM[2], aNM[3], LBN_SELCHANGE, LBN_DBLCLK ) IF aNM[ 1 ] == LBN_SELCHANGE ::nCurSelected := WVG_LBGetCurSel( ::hWnd )+ 1 IF hb_isBlock( ::sl_itemMarked ) diff --git a/harbour/contrib/gtwvg/wvgphdlr.prg b/harbour/contrib/gtwvg/wvgphdlr.prg index 8a48ef4195..e19b668d79 100644 --- a/harbour/contrib/gtwvg/wvgphdlr.prg +++ b/harbour/contrib/gtwvg/wvgphdlr.prg @@ -87,6 +87,7 @@ CLASS WvgPartHandler METHOD handleEvent( hEvent, mp1, mp2 ) METHOD status() + METHOD removeChild( oChild ) METHOD addChild( oWvg ) METHOD childFromName( nNameId ) METHOD childList() @@ -196,6 +197,17 @@ METHOD WvgPartHandler:childList() /*----------------------------------------------------------------------*/ +METHOD WvgPartHandler:removeChild( oChild ) + LOCAL n + + IF ( n := ascan( ::aChildren, {|o| o == oChild } ) ) > 0 + hb_aDel( ::aChildren, n, .t. ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD WvgPartHandler:delChild( oWvg ) LOCAL n diff --git a/harbour/contrib/gtwvg/wvgsle.prg b/harbour/contrib/gtwvg/wvgsle.prg index 3209fca003..3c9792ac50 100644 --- a/harbour/contrib/gtwvg/wvgsle.prg +++ b/harbour/contrib/gtwvg/wvgsle.prg @@ -76,12 +76,6 @@ /*----------------------------------------------------------------------*/ -#ifndef __DBG_PARTS__ -#xtranslate hb_traceLog( [] ) => -#endif - -/*----------------------------------------------------------------------*/ - CLASS WvgSLE INHERIT WvgWindow, DataRef DATA align INIT WVGSLE_LEFT @@ -155,7 +149,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSL IF ::autoSize ENDIF - IF !::editable + IF ! ::editable ::style += ES_READONLY ENDIF IF ::unReadable @@ -188,13 +182,11 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSL METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE - hb_traceLog( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage ) - DO CASE CASE nMessage == HB_GTE_RESIZED IF ::isParentCrt() + ::oParent:setFocus() ::rePosition() - ::oParent:sendMessage( WM_SETFOCUS, 0, 0 ) ENDIF ::sendMessage( WM_SIZE, 0, 0 ) @@ -230,31 +222,36 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE ENDIF CASE nMessage == HB_GTE_ANY - IF ::IsParentCrt() - DO CASE - CASE aNM[ NMH_code ] == WM_KILLFOCUS - IF hb_isBlock( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) - ENDIF + DO CASE + CASE aNM[ NMH_code ] == WM_KILLFOCUS + IF hb_isBlock( ::sl_killInputFocus ) + eval( ::sl_killInputFocus, NIL, NIL, Self ) + ENDIF - CASE aNM[ NMH_code ] == WM_SETFOCUS - IF hb_isBlock( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) - ENDIF + CASE aNM[ NMH_code ] == WM_SETFOCUS + IF hb_isBlock( ::sl_setInputFocus ) + eval( ::sl_setInputFocus, NIL, NIL, Self ) + ENDIF - CASE aNM[ NMH_code ] == WM_KEYDOWN - IF aNM[ 2 ] == K_ENTER + CASE aNM[ NMH_code ] == WM_KEYDOWN + IF aNM[ 2 ] == K_ENTER + IF ::isParentCrt() ::oParent:setFocus() - IF hb_isBlock( ::sl_returnPressed ) - eval( ::sl_returnPressed, NIL, NIL, Self ) - ENDIF - ELSEIF aNM[ 2 ] == VK_TAB + ENDIF + IF hb_isBlock( ::sl_returnPressed ) + eval( ::sl_returnPressed, NIL, NIL, Self ) + ENDIF + ELSEIF aNM[ 2 ] == VK_TAB + IF ::isParentCrt() ::oParent:setFocus() RETURN EVENT_HANDELLED ENDIF + ELSEIF aNM[ 2 ] == 65 +uiDebug( "edit",65 ) + RETURN EVENT_HANDELLED + ENDIF - ENDCASE - ENDIF + ENDCASE ENDCASE diff --git a/harbour/contrib/gtwvg/wvgwnd.prg b/harbour/contrib/gtwvg/wvgwnd.prg index c2f92a628b..fd917a9539 100644 --- a/harbour/contrib/gtwvg/wvgwnd.prg +++ b/harbour/contrib/gtwvg/wvgwnd.prg @@ -83,10 +83,6 @@ #define __BYSETPROP__ #endif -#ifndef __DBG_PARTS__ - #xtranslate hb_traceLog( [] ) => -#endif - /*----------------------------------------------------------------------*/ CLASS WvgWindow INHERIT WvgPartHandler @@ -314,7 +310,7 @@ METHOD WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) IF empty( ::oParent ) IF ! ( __objGetClsName( Self ) $ "WVGCRT,WVGDIALOG" ) - ::oParent := SetAppWindow() + ::oParent := WvgSetAppWindow() ENDIF ENDIF @@ -338,9 +334,10 @@ METHOD WvgWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible /*----------------------------------------------------------------------*/ METHOD WvgWindow:destroy() - #if 0 - hb_traceLog( " %s:destroy() WvgWindow()", __objGetClsName( self ) ) - #endif + + IF ! empty( ::oParent ) + ::oParent:removeChild( Self ) + ENDIF IF Len( ::aChildren ) > 0 aeval( ::aChildren, {|o| o:destroy() } )