2011-01-03 16:58 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbxbp/hbxbp.hbx
* Auto-regenerated.
* contrib/hbxbp/xbp.ch
+ Added: XBPMB_* constants.
* contrib/hbxbp/xbpdialog.prg
- Removed: :cargo being populated with hb_threadId().
* contrib/hbxbp/xbpstatic.prg
! Default: :type == XBPSTATIC_TYPE_TEXT
* contrib/hbxbp/xbpgeneric.prg
+ Added: ConfirmBox( oOwner, cMessage, cTitle, nButtons, nStyle, nStartBtn )
The function behaves exactly like Xbase++ except that
dialog cannot be honoured for nStyle += XBPMB_SYSMODAL.
It is always XBPMB_APPMODAL. No code change is required
on the part of the user, though.
All above points brought to light by Shum, thanks.
* contrib/hbxbp/tests/demoxbp.prg
+ Added: <Miscellaneous><ConfirmBox()> menu option.
This commit is contained in:
@@ -16,6 +16,27 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-01-03 16:58 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbxbp/hbxbp.hbx
|
||||
* Auto-regenerated.
|
||||
* contrib/hbxbp/xbp.ch
|
||||
+ Added: XBPMB_* constants.
|
||||
* contrib/hbxbp/xbpdialog.prg
|
||||
- Removed: :cargo being populated with hb_threadId().
|
||||
* contrib/hbxbp/xbpstatic.prg
|
||||
! Default: :type == XBPSTATIC_TYPE_TEXT
|
||||
* contrib/hbxbp/xbpgeneric.prg
|
||||
+ Added: ConfirmBox( oOwner, cMessage, cTitle, nButtons, nStyle, nStartBtn )
|
||||
The function behaves exactly like Xbase++ except that
|
||||
dialog cannot be honoured for nStyle += XBPMB_SYSMODAL.
|
||||
It is always XBPMB_APPMODAL. No code change is required
|
||||
on the part of the user, though.
|
||||
|
||||
All above points brought to light by Shum, thanks.
|
||||
|
||||
* contrib/hbxbp/tests/demoxbp.prg
|
||||
+ Added: <Miscellaneous><ConfirmBox()> menu option.
|
||||
|
||||
2011-01-03 13:01 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbide/findinfilesex.ui
|
||||
! .rc => .txt
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
DYNAMIC APPDESKTOP
|
||||
DYNAMIC APPEVENT
|
||||
DYNAMIC APPTYPE
|
||||
DYNAMIC CONFIRMBOX
|
||||
DYNAMIC GRAARC
|
||||
DYNAMIC GRABITBLT
|
||||
DYNAMIC GRABOX
|
||||
|
||||
@@ -380,6 +380,7 @@ STATIC FUNCTION Build_MenuBar( oDlg )
|
||||
oSubMenu := XbpMenu():new( oMenuBar ):create()
|
||||
oSubMenu:title := "~Miscellaneous"
|
||||
oSubMenu:addItem( { "Convert Images - XbpBitmap()", {|| Build_Bitmap( oDlg ) } } )
|
||||
oSubMenu:addItem( { "ConfirmBox()" , {|| Build_ConfirmBox( oDlg ) } } )
|
||||
oMenuBar:addItem( { oSubMenu, NIL } )
|
||||
|
||||
Return nil
|
||||
@@ -1977,3 +1978,11 @@ STATIC FUNCTION TBPrev()
|
||||
RETURN lMoved
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
STATIC FUNCTION Build_ConfirmBox( oWnd )
|
||||
|
||||
RETURN MsgBox( "Return Value is = " + ;
|
||||
str( ConfirmBox( oWnd, "What do you want ?", "Confirm Status", XBPMB_YESNOCANCEL, XBPMB_WARNING, 2 ) ) )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -485,5 +485,45 @@
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#define XBPMB_OK 0
|
||||
#define XBPMB_OKCANCEL 1
|
||||
#define XBPMB_RETRYCANCEL 5
|
||||
#define XBPMB_ABORTRETRYIGNORE 2
|
||||
#define XBPMB_YESNO 4
|
||||
#define XBPMB_YESNOCANCEL 3
|
||||
#define XBPMB_CANCEL 0
|
||||
#define XBPMB_ENTER 0
|
||||
#define XBPMB_ENTERCANCEL 1
|
||||
#define XBPMB_HELP 16384
|
||||
|
||||
// Defines for the style
|
||||
#define XBPMB_NOICON 0
|
||||
#define XBPMB_QUESTION 32
|
||||
#define XBPMB_WARNING 48
|
||||
#define XBPMB_INFORMATION 64
|
||||
#define XBPMB_CRITICAL 16
|
||||
|
||||
#define XBPMB_APPMODAL (0 + 65536)
|
||||
#define XBPMB_SYSMODAL (4096 + 65536)
|
||||
#define XBPMB_MOVEABLE 65536
|
||||
|
||||
// Defbutton
|
||||
#define XBPMB_DEFBUTTON1 0
|
||||
#define XBPMB_DEFBUTTON2 256
|
||||
#define XBPMB_DEFBUTTON3 512
|
||||
|
||||
// Confirm box return codes
|
||||
#define XBPMB_RET_OK 1
|
||||
#define XBPMB_RET_CANCEL 2
|
||||
#define XBPMB_RET_ABORT 3
|
||||
#define XBPMB_RET_RETRY 4
|
||||
#define XBPMB_RET_IGNORE 5
|
||||
#define XBPMB_RET_YES 6
|
||||
#define XBPMB_RET_NO 7
|
||||
#define XBPMB_RET_ENTER 9
|
||||
#define XBPMB_RET_ERROR 65535
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#define _XBP_CH
|
||||
#endif
|
||||
|
||||
@@ -140,8 +140,6 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
|
||||
|
||||
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
|
||||
|
||||
::cargo := hb_threadId() /* To Be Removed */
|
||||
|
||||
/* Thread specific event buffer */
|
||||
hbxbp_InitializeEventBuffer()
|
||||
|
||||
|
||||
@@ -404,3 +404,135 @@ FUNCTION hbxbp_getNextID( cString )
|
||||
RETURN cString + "_" + hb_ntos( ++hIDs[ cString ] )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
ConfirmBox( [<oOwner>], <cMessage>, [<cTitle>], ;
|
||||
[<nButtons>],[<nStyle>],[<nStartBtn>] ) --> nAction
|
||||
*/
|
||||
FUNCTION ConfirmBox( oOwner, cMessage, cTitle, nButtons, nStyle, nStartBtn )
|
||||
LOCAL oMB, nRet
|
||||
LOCAL qEnter, qCancel, qYes, qNo, qRetry, qIgnore, qAbort, qHelp, qClk, qOk
|
||||
|
||||
DEFAULT oOwner TO SetAppWindow()
|
||||
DEFAULT cTitle TO ""
|
||||
DEFAULT nButtons TO XBPMB_OKCANCEL
|
||||
DEFAULT nStyle TO XBPMB_NOICON
|
||||
DEFAULT nStartBtn TO XBPMB_DEFBUTTON1
|
||||
|
||||
cMessage := strtran( cMessage, chr( 13 ) + chr( 10 ), "<br />" )
|
||||
cMessage := strtran( cMessage, chr( 13 ), "<br />" )
|
||||
cMessage := strtran( cMessage, chr( 10 ), "<br />" )
|
||||
|
||||
oMB := QMessageBox()
|
||||
//
|
||||
oMB:setText( /* "<b>" + */ cMessage /* + "</b>" */ )
|
||||
|
||||
SWITCH nButtons
|
||||
CASE XBPMB_OK
|
||||
qOk := oMB:addButton( "Ok", QMessageBox_AcceptRole )
|
||||
EXIT
|
||||
CASE XBPMB_OKCANCEL
|
||||
qOk := oMB:addButton( "Ok" , QMessageBox_AcceptRole )
|
||||
qCancel := oMB:addButton( "Cancel", QMessageBox_AcceptRole )
|
||||
oMB:setDefaultButton( iif( nStartBtn == XBPMB_DEFBUTTON1, qOk, qCancel ) )
|
||||
EXIT
|
||||
CASE XBPMB_RETRYCANCEL
|
||||
qRetry := oMB:addButton( "Retry" , QMessageBox_AcceptRole )
|
||||
qCancel := oMB:addButton( "Cancel", QMessageBox_AcceptRole )
|
||||
oMB:setDefaultButton( iif( nStartBtn == XBPMB_DEFBUTTON1, qRetry, qCancel ) )
|
||||
EXIT
|
||||
CASE XBPMB_ABORTRETRYIGNORE
|
||||
qAbort := oMB:addButton( "Abort" , QMessageBox_AcceptRole )
|
||||
qRetry := oMB:addButton( "Retry" , QMessageBox_AcceptRole )
|
||||
qIgnore := oMB:addButton( "Ignore", QMessageBox_AcceptRole )
|
||||
oMB:setDefaultButton( iif( nStartBtn == XBPMB_DEFBUTTON1, qAbort, ;
|
||||
iif( nStartBtn == XBPMB_DEFBUTTON2, qRetry, qIgnore ) ) )
|
||||
EXIT
|
||||
CASE XBPMB_YESNO
|
||||
qYes := oMB:addButton( "Yes" , QMessageBox_AcceptRole )
|
||||
qNo := oMB:addButton( "No" , QMessageBox_AcceptRole )
|
||||
oMB:setDefaultButton( iif( nStartBtn == XBPMB_DEFBUTTON1, qYes, qNo ) )
|
||||
EXIT
|
||||
CASE XBPMB_YESNOCANCEL
|
||||
qYes := oMB:addButton( "Yes" , QMessageBox_AcceptRole )
|
||||
qNo := oMB:addButton( "No" , QMessageBox_AcceptRole )
|
||||
qCancel := oMB:addButton( "Cancel", QMessageBox_AcceptRole )
|
||||
oMB:setDefaultButton( iif( nStartBtn == XBPMB_DEFBUTTON1, qYes, ;
|
||||
iif( nStartBtn == XBPMB_DEFBUTTON2, qNo, qCancel ) ) )
|
||||
EXIT
|
||||
CASE XBPMB_CANCEL
|
||||
qCancel := oMB:addButton( "Cancel", QMessageBox_AcceptRole )
|
||||
EXIT
|
||||
CASE XBPMB_ENTER
|
||||
qEnter := oMB:addButton( "Enter", QMessageBox_AcceptRole )
|
||||
EXIT
|
||||
CASE XBPMB_ENTERCANCEL
|
||||
qEnter := oMB:addButton( "Enter" , QMessageBox_AcceptRole )
|
||||
qCancel := oMB:addButton( "Cancel", QMessageBox_AcceptRole )
|
||||
oMB:setDefaultButton( iif( nStartBtn == XBPMB_DEFBUTTON1, qEnter, qCancel ) )
|
||||
EXIT
|
||||
CASE XBPMB_HELP
|
||||
qHelp := oMB:addButton( "Help", QMessageBox_AcceptRole )
|
||||
EXIT
|
||||
OTHERWISE
|
||||
oMB:setStandardButtons( QMessageBox_Ok )
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
|
||||
IF hb_bitAnd( nStyle, XBPMB_INFORMATION ) == XBPMB_INFORMATION
|
||||
oMB:setIcon( QMessageBox_Information )
|
||||
ELSEIF hb_bitAnd( nStyle, XBPMB_QUESTION ) == XBPMB_QUESTION
|
||||
oMB:setIcon( QMessageBox_Question )
|
||||
ELSEIF hb_bitAnd( nStyle, XBPMB_WARNING ) == XBPMB_WARNING
|
||||
oMB:setIcon( QMessageBox_Warning )
|
||||
ELSEIF hb_bitAnd( nStyle, XBPMB_CRITICAL ) == XBPMB_CRITICAL
|
||||
oMB:setIcon( QMessageBox_Critical )
|
||||
ENDIF
|
||||
|
||||
IF hb_isObject( oOwner )
|
||||
oMB:setParent( oOwner:oWidget )
|
||||
ENDIF
|
||||
oMB:setWindowFlags( Qt_Dialog )
|
||||
oMB:setWindowTitle( cTitle )
|
||||
|
||||
nRet := oMB:exec()
|
||||
qClk := oMB:clickedButton()
|
||||
|
||||
SWITCH nButtons
|
||||
CASE XBPMB_OK
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qOk ), XBPMB_RET_OK, -1 )
|
||||
EXIT
|
||||
CASE XBPMB_OKCANCEL
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qOk ), XBPMB_RET_OK, XBPMB_RET_CANCEL )
|
||||
EXIT
|
||||
CASE XBPMB_RETRYCANCEL
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qRetry ), XBPMB_RET_RETRY, XBPMB_RET_CANCEL )
|
||||
EXIT
|
||||
CASE XBPMB_ABORTRETRYIGNORE
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qAbort ), XBPMB_RET_ABORT, ;
|
||||
iif( hbqt_IsEqualGcQtPointer( qClk, qRetry ), XBPMB_RET_RETRY, XBPMB_RET_CANCEL ) )
|
||||
EXIT
|
||||
CASE XBPMB_YESNO
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qYes ), XBPMB_RET_YES, XBPMB_RET_NO )
|
||||
EXIT
|
||||
CASE XBPMB_YESNOCANCEL
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qYes ), XBPMB_RET_YES, ;
|
||||
iif( hbqt_IsEqualGcQtPointer( qClk, qNo ), XBPMB_RET_NO, XBPMB_RET_CANCEL ) )
|
||||
EXIT
|
||||
CASE XBPMB_CANCEL
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qCancel ), XBPMB_RET_CANCEL, -1 )
|
||||
EXIT
|
||||
CASE XBPMB_ENTER
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qEnter ), XBPMB_RET_ENTER, -1 )
|
||||
EXIT
|
||||
CASE XBPMB_ENTERCANCEL
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qEnter ), XBPMB_RET_ENTER, XBPMB_RET_CANCEL )
|
||||
EXIT
|
||||
CASE XBPMB_HELP
|
||||
nRet := iif( hbqt_IsEqualGcQtPointer( qClk, qHelp ), XBPMB_RET_OK, -1 )
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
|
||||
RETURN nRet
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ CLASS XbpStatic INHERIT XbpWindow
|
||||
DATA clipParent INIT .T.
|
||||
DATA clipSiblings INIT .F.
|
||||
DATA options INIT 0
|
||||
DATA type INIT -1
|
||||
DATA type INIT XBPSTATIC_TYPE_TEXT
|
||||
|
||||
DATA hBitmap
|
||||
|
||||
|
||||
Reference in New Issue
Block a user