From 2460540c6fa5e4f1daa8fe9b0050afeab160dbd1 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Thu, 5 May 2011 01:46:52 +0000 Subject: [PATCH] 2011-05-04 18:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbpappevent.prg * contrib/hbxbp/xbpdialog.prg * contrib/hbxbp/xbpgeneric.prg * contrib/hbxbp/xbppushbutton.prg * contrib/hbxbp/xbpsle.prg + Implemented: XbpPushButton() now understands pressed. : XbpSLe() now responds to key which simulates windows equivalent TAB key. ! Rationalized: event loop, now no delays in processing. With this commit, you can experiment with real applications. Angel, can you re-visit the application you had sent to the list almost an year back ? --- harbour/ChangeLog | 15 +++++++++++++ harbour/contrib/hbxbp/xbpappevent.prg | 1 + harbour/contrib/hbxbp/xbpdialog.prg | 1 - harbour/contrib/hbxbp/xbpgeneric.prg | 28 +++++++++++++------------ harbour/contrib/hbxbp/xbppushbutton.prg | 8 ++++--- harbour/contrib/hbxbp/xbpsle.prg | 2 +- 6 files changed, 37 insertions(+), 18 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5c72737825..f5bba1b74e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-04 18:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbxbp/xbpappevent.prg + * contrib/hbxbp/xbpdialog.prg + * contrib/hbxbp/xbpgeneric.prg + * contrib/hbxbp/xbppushbutton.prg + * contrib/hbxbp/xbpsle.prg + + Implemented: XbpPushButton() now understands pressed. + : XbpSLe() now responds to key which simulates + windows equivalent TAB key. + ! Rationalized: event loop, now no delays in processing. + + With this commit, you can experiment with real applications. + Angel, can you re-visit the application you had sent to the + list almost an year back ? + 2011-05-04 12:39 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbpdialog.prg * contrib/hbxbp/xbpwindow.prg diff --git a/harbour/contrib/hbxbp/xbpappevent.prg b/harbour/contrib/hbxbp/xbpappevent.prg index bd1f98ea91..eda4e7b5fc 100644 --- a/harbour/contrib/hbxbp/xbpappevent.prg +++ b/harbour/contrib/hbxbp/xbpappevent.prg @@ -530,6 +530,7 @@ FUNCTION hbxbp_appEventToQKeyEvent( key ) CASE xbeK_CTRL_ENTER RETURN Qt_Key_Enter CASE xbeK_TAB + RETURN Qt_Key_Tab CASE xbeK_SH_TAB RETURN Qt_Key_Backtab CASE xbeK_CTRL_TAB diff --git a/harbour/contrib/hbxbp/xbpdialog.prg b/harbour/contrib/hbxbp/xbpdialog.prg index 182fb1a4ac..ee8c217a45 100644 --- a/harbour/contrib/hbxbp/xbpdialog.prg +++ b/harbour/contrib/hbxbp/xbpdialog.prg @@ -279,7 +279,6 @@ METHOD XbpDialog:destroy() METHOD XbpDialog:execEvent( nEvent, pEvent ) - HB_SYMBOL_UNUSED( pEvent ) DO CASE CASE nEvent == QEvent_WindowActivate diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index 65ddd5dfdd..3ec3e19e0f 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -221,24 +221,26 @@ FUNCTION AppEvent( mp1, mp2, oXbp, nTimeout ) HB_SYMBOL_UNUSED( nTimeOut ) - DO WHILE ! empty( t_oEventLoop ) - t_oEventLoop:processEvents( QEventLoop_AllEvents ) + t_oEventLoop:processEvents( QEventLoop_AllEvents ) - IF ! empty( t_events ) - nEvent := t_events[ 1, 1 ] - mp1 := t_events[ 1, 2 ] - mp2 := t_events[ 1, 3 ] - oXbp := t_events[ 1, 4 ] + IF ! empty( t_events ) + nEvent := t_events[ 1, 1 ] + mp1 := t_events[ 1, 2 ] + mp2 := t_events[ 1, 3 ] + oXbp := t_events[ 1, 4 ] - hb_adel( t_events, 1, .t. ) + hb_adel( t_events, 1, .t. ) - EXIT - ENDIF + ELSE + oXbp := SetAppWindow() - hb_releaseCPU() - ENDDO + ENDIF - s_hLastEvent[ hb_threadID() ] := { nEvent, mp1, mp2, oXbp } + hb_releaseCPU() + + IF nEvent != 0 + s_hLastEvent[ hb_threadID() ] := { nEvent, mp1, mp2, oXbp } + ENDIF RETURN nEvent diff --git a/harbour/contrib/hbxbp/xbppushbutton.prg b/harbour/contrib/hbxbp/xbppushbutton.prg index 22722468f1..10576ef21b 100644 --- a/harbour/contrib/hbxbp/xbppushbutton.prg +++ b/harbour/contrib/hbxbp/xbppushbutton.prg @@ -143,9 +143,9 @@ METHOD XbpPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible METHOD XbpPushButton:execSlot( cSlot, p ) DO CASE - CASE cSlot == "clicked()" // .OR. cSlot == "pressed()" + CASE cSlot == "clicked()" ::activate() - CASE cSlot == "keyPressed()" + CASE cSlot == "QEvent_KeyPress" IF hbxbp_QKeyEventToAppEvent( p ) == xbeK_ENTER ::oWidget:click() ENDIF @@ -166,13 +166,15 @@ METHOD XbpPushButton:handleEvent( nEvent, mp1, mp2 ) /*----------------------------------------------------------------------*/ METHOD XbpPushButton:connect() - ::oWidget:connect( "clicked()", {|| ::execSlot( "clicked()" ) } ) + ::oWidget:connect( "clicked()" , {|| ::execSlot( "clicked()" ) } ) + ::oWidget:connect( QEvent_KeyPress, {|e| ::execSlot( "QEvent_KeyPress", e ) } ) RETURN Self /*----------------------------------------------------------------------*/ METHOD XbpPushButton:disconnect() ::oWidget:disconnect( "clicked()" ) + ::oWidget:disconnect( QEvent_KeyPress ) RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpsle.prg b/harbour/contrib/hbxbp/xbpsle.prg index d26990fba2..b7248aa531 100644 --- a/harbour/contrib/hbxbp/xbpsle.prg +++ b/harbour/contrib/hbxbp/xbpsle.prg @@ -219,7 +219,7 @@ METHOD XbpSLE:execSlot( cSlot, p, p2 ) CASE cSlot == "returnPressed()" ::sl_editBuffer := ::oWidget:text() - ::returnPressed() + PostAppEvent( xbeP_Keyboard, xbeK_TAB, NIL, Self ) CASE cSlot == "selectionChanged()"