2010-01-23 13:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/idefindreplace.prg
    ! Fixed: error when find operation was unsuccessful.

  * contrib/hbxbp/xbp.ch
    + Added HBXBP_DBG( HB_TR_ALWAYS,... )

  * contrib/hbxbp/xbppushbutton.prg
    + Behavior: if focus is set on the object, then its property is 
      changed to autodefault() which means the button will be highlighted
      with additional border to indicate that it can be activated
      with "Return" press. However this property does not work in
      buttons if XbpDialog() is the parent. 

  * contrib/hbxbp/xbpgeneric.prg
  * contrib/hbxbp/xbpwindow.prg
  * contrib/hbxbp/xbpdialog.prg
    + Implemented: XbpDialog():maxButton, :minButton 
      QUESTION: which instance variable controls the resizing behavior?

  * contrib/hbxbp/xbpsle.prg
    + Added: callback slot :returnPressed.
        oSle1:returnPressed := {|| SetAppFocus( oSle2 ) }
      This facilitates the TAB behavior which navigating the SLE's.
      This effectively also means you can control the SLE's like
      ReadModal(). Just validate the SLE (oGet) and move to 
      another SLE or any other part. 

      Angel, your observation will matter.
This commit is contained in:
Pritpal Bedi
2010-01-23 22:57:04 +00:00
parent 4b7dad32fe
commit dee1085796
8 changed files with 153 additions and 100 deletions

View File

@@ -17,6 +17,36 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-23 13:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/idefindreplace.prg
! Fixed: error when find operation was unsuccessful.
* contrib/hbxbp/xbp.ch
+ Added HBXBP_DBG( HB_TR_ALWAYS,... )
* contrib/hbxbp/xbppushbutton.prg
+ Behavior: if focus is set on the object, then its property is
changed to autodefault() which means the button will be highlighted
with additional border to indicate that it can be activated
with "Return" press. However this property does not work in
buttons if XbpDialog() is the parent.
* contrib/hbxbp/xbpgeneric.prg
* contrib/hbxbp/xbpwindow.prg
* contrib/hbxbp/xbpdialog.prg
+ Implemented: XbpDialog():maxButton, :minButton
QUESTION: which instance variable controls the resizing behavior?
* contrib/hbxbp/xbpsle.prg
+ Added: callback slot :returnPressed.
oSle1:returnPressed := {|| SetAppFocus( oSle2 ) }
This facilitates the TAB behavior which navigating the SLE's.
This effectively also means you can control the SLE's like
ReadModal(). Just validate the SLE (oGet) and move to
another SLE or any other part.
Angel, your observation will matter.
2010-01-23 14:05 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/hbwapi.h
* contrib/hbwin/wapi_alloc.c

View File

@@ -236,7 +236,7 @@ METHOD IdeFindReplace:onClickFind()
qCursor:setPosition( 0 )
::qCurEdit:setTextCursor( qCursor )
IF !( lFound := ::find() )
::qCursor:setPosition( nPos )
qCursor:setPosition( nPos )
::qCurEdit:setTextCursor( qCursor )
ENDIF
ELSE

View File

@@ -9,6 +9,7 @@
#include "hbtrace.ch"
#xtranslate HBXBP_DEBUG( [<x,...>] ) => HB_TRACE( HB_TR_DEBUG, <x> )
#xtranslate HBXBP_DBG( [<x,...>] ) => HB_TRACE( HB_TR_ALWAYS, <x> )
/*----------------------------------------------------------------------*/

View File

@@ -80,6 +80,8 @@ CLASS XbpDialog FROM XbpWindow
DATA oMenu
DATA aRect
DATA maxbutton INIT .t.
DATA minbutton INIT .t.
DATA drawingArea
DATA tasklist INIT .t.
DATA oEventLoop
@@ -119,6 +121,7 @@ METHOD XbpDialog:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
/*----------------------------------------------------------------------*/
METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
LOCAL nFlags, nnFlags
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
@@ -159,6 +162,31 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget:setCentralWidget( ::drawingArea:oWidget )
ENDIF
nFlags := ::oWidget:windowFlags()
nnFlags := nFlags
IF !( ::maxButton )
IF hb_bitAnd( nFlags, Qt_WindowMaximizeButtonHint ) == Qt_WindowMaximizeButtonHint
nFlags -= Qt_WindowMaximizeButtonHint
ENDIF
ENDIF
IF !( ::minButton )
IF hb_bitAnd( nFlags, Qt_WindowMinimizeButtonHint ) == Qt_WindowMinimizeButtonHint
nFlags -= Qt_WindowMinimizeButtonHint
ENDIF
ENDIF
#if 0
IF !( ::taskList )
IF hb_bitAnd( nFlags, Qt_Window ) == Qt_Window
nFlags -= Qt_Window
ENDIF
/* This hides the taskbar entry but title bar is not visible */
nFlags += Qt_ToolTip + Qt_WindowTitleHint
ENDIF
#endif
IF nnFlags != nFlags
::oWidget:setWindowFlags( nFlags )
ENDIF
//::setQtProperty()
::setPosAndSize()
IF ::visible
@@ -237,6 +265,8 @@ METHOD XbpDialog:showModal()
::hide()
::oWidget:setWindowModality( 2 )
::show()
::is_hidden := .f.
::lHasInputFocus := .t.
RETURN .t.

View File

@@ -175,9 +175,19 @@ FUNCTION hbxbp_SetEventLoop( oELoop )
/*----------------------------------------------------------------------*/
FUNCTION PostAppEvent( nEvent, mp1, mp2, oXbp )
LOCAL qEvent
HB_SYMBOL_UNUSED( mp2 )
SetAppEvent( nEvent, mp1, mp2, oXbp )
IF nEvent == xbeP_Keyboard
IF mp1 == xbeK_TAB
qEvent := QEvent():new( QEvent_KeyPress )
s_oApp:postEvent( oXbp:oWidget, qEvent )
ENDIF
ENDIF
RETURN .T.
/*----------------------------------------------------------------------*/
@@ -251,7 +261,7 @@ FUNCTION SetAppFocus( oXbp )
IF hb_isObject( oXbp )
t_oXbpInFocus := oXbp
oXbp:oWidget:setFocus()
oXbp:setFocus()
ENDIF
RETURN oldXbpInFocus

View File

@@ -92,9 +92,11 @@ CLASS XbpPushButton INHERIT XbpWindow
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD destroy()
METHOD handleEvent( nEvent, mp1, mp2 )
METHOD exeBlock()
METHOD exeBlock( nMode, p )
METHOD setStyle() VIRTUAL
METHOD setFocus()
METHOD setCaption( xCaption, cDll )
METHOD activate( xParam ) SETGET
@@ -117,6 +119,7 @@ METHOD XbpPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget := QPushButton():new( ::oParent:oWidget )
::oWidget:setFocusPolicy( Qt_StrongFocus )
::setPosAndSize()
IF ::visible
@@ -129,7 +132,8 @@ METHOD XbpPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::oWidget:setDefault( .t. )
ENDIF
::Connect( ::pWidget, "clicked()", {|| ::exeBlock() } )
::Connect( ::pWidget, "clicked()", {|| ::exeBlock( 1 ) } )
::Connect( ::pWidget, "pressed()", {|| ::exeBlock( 1 ) } )
::oParent:AddChild( SELF )
RETURN Self
@@ -166,11 +170,18 @@ METHOD XbpPushButton:hbCreateFromQtPtr( oParent, oOwner, aPos, aSize, aPresParam
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:exeBlock()
METHOD XbpPushButton:exeBlock( nMode, p )
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
ENDIF
DO CASE
CASE nMode == 1
IF hb_isBlock( ::sl_lbClick )
eval( ::sl_lbClick, NIL, NIL, self )
ENDIF
CASE nMode == 201 /* QEvent_KeyPressed */
IF XbpQKeyEventToAppEvent( p ) == xbeK_ENTER
::oWidget:click()
ENDIF
ENDCASE
RETURN nil
@@ -202,6 +213,17 @@ METHOD XbpPushButton:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisi
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:setFocus()
IF !( ::oWidget:isDefault() )
::oWidget:setDefault( .t. )
ENDIF
::oWidget:setFocus_1()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpPushButton:setCaption( xCaption, cDll )
HB_SYMBOL_UNUSED( cDll )

View File

@@ -115,6 +115,11 @@ CLASS XbpSLE INHERIT XbpWindow, XbpDataRef
ACCESS typeOut INLINE ::sl_typeOut
ASSIGN typeOut( bBlock ) INLINE ::sl_typeOut := bBlock
/* Harbour Extension */
DATA sl_returnPressed
ACCESS returnPressed INLINE ::sl_returnPressed
ASSIGN returnPressed( bBlock ) INLINE ::sl_returnPressed := bBlock
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -133,6 +138,7 @@ METHOD XbpSLE:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget := QLineEdit():new( ::pParent )
::oWidget:setFocusPolicy( Qt_StrongFocus )
::oWidget:setAlignment( es_[ ::align ] )
IF !::editable
@@ -155,7 +161,7 @@ METHOD XbpSLE:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::connect( ::pWidget, "cursorPositionChanged(int,int)" , {|o,i,ii| ::exeBlock( 1, i, ii, o ) } )
// ::connect( ::pWidget, "editingFinished()" , {| | ::exeBlock( 2 ) } )
// ::connect( ::pWidget, "returnPressed()" , {| | ::exeBlock( 3 ) } )
::connect( ::pWidget, "returnPressed()" , {| | ::exeBlock( 3 ) } )
// ::connect( ::pWidget, "selectionChanged()" , {| | ::exeBlock( 4 ) } )
::connect( ::pWidget, "textChanged(QString)" , {|o,s | ::exeBlock( 5, s, o ) } )
::connect( ::pWidget, "textEdited(QString)" , {|o,s | ::exeBlock( 6, s, o ) } )
@@ -209,6 +215,13 @@ METHOD XbpSLE:exeBlock( nMsg, p1, p2 )
CASE nMsg == 3 // "returnPressed()"
::sl_editBuffer := ::oWidget:text()
#if 0
PostAppEvent( xbeP_Keyboard, xbeK_TAB, , Self )
#else
IF hb_isBlock( ::sl_returnPressed )
eval( ::sl_returnPressed, NIL, NIL, Self )
ENDIF
#endif
CASE nMsg == 4 // "selectionChanged()"

View File

@@ -130,9 +130,39 @@ CLASS XbpWindow INHERIT XbpPartHandler
METHOD dragMotion( xParam ) SETGET
METHOD dragLeave( xParam ) SETGET
METHOD dragDrop( xParam, xParam1 ) SETGET
METHOD hbContextMenu( xParam ) SETGET
METHOD Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD isEnabled() INLINE ::is_enabled
METHOD isVisible() INLINE !( ::is_hidden )
METHOD hbCreateFromQtPtr() VIRTUAL
METHOD destroy()
METHOD disable()
METHOD enable()
METHOD hide()
METHOD lockPS()
METHOD lockUpdate()
METHOD show()
METHOD toBack()
METHOD toFront()
METHOD unlockPS()
METHOD winDevice()
METHOD setColorBG( nRGB )
METHOD setColorFG( nRGB )
METHOD currentPos()
METHOD currentSize()
METHOD getHWND()
METHOD getModalState()
METHOD hasInputFocus()
METHOD setFocus()
METHOD sendMessage()
METHOD connectWindowEvents()
METHOD disConnect()
METHOD clearSlots()
CLASSDATA nProperty INIT 0
DATA qtProperty INIT ""
DATA qtObject
@@ -201,7 +231,7 @@ CLASS XbpWindow INHERIT XbpPartHandler
DATA title INIT " "
DATA icon INIT 0
DATA closable INIT .T.
DATA resizable INIT .t.
DATA resizable INIT .T.
DATA resizeMode INIT 0
DATA lModal INIT .f.
DATA hWnd
@@ -234,89 +264,7 @@ CLASS XbpWindow INHERIT XbpPartHandler
ACCESS pSlots INLINE hbxbp_getSlotsPtr()
ACCESS pEvents INLINE hbxbp_GetEventsPtr()
METHOD isEnabled() INLINE ::is_enabled
METHOD isVisible() INLINE !( ::is_hidden )
* METHOD init()
* METHOD create()
METHOD hbCreateFromQtPtr() VIRTUAL
* METHOD configure()
METHOD destroy()
* METHOD captureMouse()
METHOD disable()
METHOD enable()
METHOD hide()
* METHOD invalidateRect()
METHOD lockPS()
METHOD lockUpdate()
* METHOD setModalState()
* METHOD setPointer()
* METHOD setTrackPointer()
* METHOD setPos()
* METHOD setPosAndSize()
* METHOD setSize()
METHOD show()
METHOD toBack()
METHOD toFront()
METHOD unlockPS()
METHOD winDevice()
METHOD setColorBG( nRGB )
METHOD setColorFG( nRGB )
* METHOD setFont()
* METHOD setFontCompoundName()
* METHOD setPresParam()
METHOD currentPos()
METHOD currentSize()
METHOD getHWND()
METHOD getModalState()
METHOD hasInputFocus()
* METHOD enter() SETGET
* METHOD leave() SETGET
* METHOD lbClick() SETGET
* METHOD lbDblClick() SETGET
* METHOD lbDown() SETGET
* METHOD lbUp() SETGET
* METHOD mbClick() SETGET
* METHOD mbDblClick() SETGET
* METHOD mbDown() SETGET
* METHOD mbUp() SETGET
* METHOD motion() SETGET
* METHOD rbClick() SETGET
* METHOD rbDblClick() SETGET
* METHOD rbDown() SETGET
* METHOD rbUp() SETGET
* METHOD wheel() SETGET
* METHOD helpRequest() SETGET
* METHOD keyboard() SETGET
* METHOD killInputFocus() SETGET
* METHOD move() SETGET
* METHOD paint() SETGET
* METHOD quit() SETGET
* METHOD resize() SETGET
* METHOD setInputFocus() SETGET
* METHOD dragEnter() SETGET
* METHOD dragMotion() SETGET
* METHOD dragLeave() SETGET
* METHOD dragDrop() SETGET
* METHOD close() SETGET
* METHOD setDisplayFocus() SETGET
* METHOD killDisplayFocus() SETGET
METHOD hbContextMenu( xParam ) SETGET
METHOD setFocus()
METHOD sendMessage()
* METHOD Initialize()
* METHOD handleEvent()
* METHOD grabEvent()
* METHOD isDerivedFrom()
* METHOD connect()
* METHOD connectEvent()
METHOD connectWindowEvents()
METHOD disConnect()
METHOD clearSlots()
METHOD className() INLINE __objGetClsName( Self )
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -457,6 +405,9 @@ METHOD XbpWindow:connectEvent( pWidget, nEvent, bBlock )
IF ( lSuccess := Qt_Events_Connect( ::pEvents, pWidget, nEvent, bBlock ) )
aadd( ::aEConnections, { pWidget, nEvent } )
// HBXBP_DBG( "XbpWindow:connectEvent", nEvent, "Succeeded" )
ELSE
HBXBP_DBG( "XbpWindow:connectEvent", nEvent, "Failed" )
ENDIF
RETURN lSuccess
@@ -1301,7 +1252,7 @@ METHOD XbpWindow:show()
METHOD XbpWindow:toBack()
// TODO:
::oWidget:lower()
RETURN self
@@ -1309,7 +1260,7 @@ METHOD XbpWindow:toBack()
METHOD XbpWindow:toFront()
// TODO:
::oWidget:raise()
RETURN self
@@ -1333,9 +1284,6 @@ METHOD XbpWindow:winDevice()
METHOD XbpWindow:setPresParam( aPPNew )
LOCAL i
//LOCAL aPP
//aPP := aclone( ::aPresParams )
IF hb_isArray( aPPNew )
FOR i := 1 TO len( aPPNew )
@@ -1343,7 +1291,6 @@ METHOD XbpWindow:setPresParam( aPPNew )
NEXT
ENDIF
//RETURN aPP
RETURN ::aPresParams
/*----------------------------------------------------------------------*/
@@ -1894,7 +1841,7 @@ METHOD XbpWindow:Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible
METHOD XbpWindow:setFocus()
::oWidget:setFocus()
::oWidget:setFocus_1()
RETURN Self