2011-05-06 11:46 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbxbp/xbp.ch
* contrib/hbxbp/xbpdialog.prg
* contrib/hbxbp/xbppushbutton.prg
+ Implemented: XbpDialog():showModal() functionality.
This commit is contained in:
@@ -16,6 +16,12 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-05-06 11:46 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbxbp/xbp.ch
|
||||
* contrib/hbxbp/xbpdialog.prg
|
||||
* contrib/hbxbp/xbppushbutton.prg
|
||||
+ Implemented: XbpDialog():showModal() functionality.
|
||||
|
||||
2011-05-06 11:46 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbxbp/xbpdialog.prg
|
||||
* contrib/hbxbp/xbpwindow.prg
|
||||
|
||||
@@ -445,6 +445,13 @@
|
||||
|
||||
#define APPTYPE_PM 3
|
||||
|
||||
#define XBP_MRESULT_NONE 0
|
||||
#define XBP_MRESULT_OK 1
|
||||
#define XBP_MRESULT_CANCEL 2
|
||||
#define XBP_MRESULT_RETRY 4
|
||||
#define XBP_MRESULT_YESTOALL 8
|
||||
#define XBP_MRESULT_ERROR ( -1 )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* Harbour Parts Constants */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -93,6 +93,10 @@ CLASS XbpDialog FROM XbpWindow
|
||||
DATA origin INIT XBPDLG_ORIGIN_OWNER
|
||||
DATA sysMenu INIT .T.
|
||||
|
||||
DATA modalResult INIT XBP_MRESULT_NONE
|
||||
DATA l_modalState INIT .f.
|
||||
METHOD setModalResult( nResult ) INLINE ::modalResult := nResult
|
||||
|
||||
METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
|
||||
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
|
||||
METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
|
||||
@@ -251,6 +255,10 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
|
||||
|
||||
::oWidget:setAttribute( Qt_WA_DeleteOnClose, .f. )
|
||||
|
||||
IF empty( SetAppWindow() )
|
||||
SetAppWindow( Self )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -332,14 +340,33 @@ METHOD XbpDialog:minSize( aSize )
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD XbpDialog:showModal()
|
||||
LOCAL nEvent, mp1, mp2, oXbp
|
||||
|
||||
::hide()
|
||||
::oWidget:setWindowModality( 2 )
|
||||
::oWidget:setWindowModality( XBP_DISP_APPMODAL )
|
||||
::show()
|
||||
::is_hidden := .f.
|
||||
::lHasInputFocus := .t.
|
||||
::l_modalState := .t.
|
||||
|
||||
RETURN .t.
|
||||
nEvent := 0
|
||||
DO WHILE nEvent != xbeP_Close
|
||||
nEvent := AppEvent( @mp1, @mp2, @oXbp )
|
||||
IF ::modalResult != XBP_MRESULT_NONE
|
||||
EXIT
|
||||
ENDIF
|
||||
oXbp:handleEvent( nEvent, mp1, mp2 )
|
||||
ENDDO
|
||||
IF nEvent == xbeP_Close
|
||||
::modalResult := XBP_MRESULT_CANCEL
|
||||
ENDIF
|
||||
|
||||
::l_modalState := .f.
|
||||
::hide()
|
||||
::oWidget:setWindowModality( XBP_DISP_MODELESS )
|
||||
::show()
|
||||
|
||||
RETURN ::modalResult
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -145,10 +145,22 @@ METHOD XbpPushButton:execSlot( cSlot, p )
|
||||
DO CASE
|
||||
CASE cSlot == "clicked()"
|
||||
::activate()
|
||||
IF ::oParent:className() == "XBPDRAWINGAREA"
|
||||
IF ::oParent:oParent:l_modalState
|
||||
IF ::default
|
||||
::oParent:oParent:setModalResult( XBP_MRESULT_OK )
|
||||
ENDIF
|
||||
IF ::cancel
|
||||
::oParent:oParent:setModalResult( XBP_MRESULT_CANCEL )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
CASE cSlot == "QEvent_KeyPress"
|
||||
IF hbxbp_QKeyEventToAppEvent( p ) == xbeK_ENTER
|
||||
::oWidget:click()
|
||||
ENDIF
|
||||
|
||||
ENDCASE
|
||||
|
||||
RETURN nil
|
||||
|
||||
Reference in New Issue
Block a user