FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MsgYesNoCancel
Posts: 175
Joined: Tue Nov 10, 2009 10:56 AM
MsgYesNoCancel
Posted: Mon Dec 05, 2011 12:42 PM

Hi

How do I change the MsgYesNo() to something like MsgYesNoCancel() to accept 3 choices instead of 2 choices.

Thanks

Regards
ACWoo

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: MsgYesNoCancel
Posted: Mon Dec 05, 2011 01:13 PM
ACWoo,

have a look at Sample TESTRTF.prg
Function MsgYesNoCancel is included there.

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 175
Joined: Tue Nov 10, 2009 10:56 AM
Re: MsgYesNoCancel
Posted: Mon Dec 05, 2011 01:49 PM

Thanks For Your Help

     MENUITEM   "&End..."  ;
        ACTION  If( MsgYesNoCancel( "Want to end ?","Please Choose" ),  Exitpro(cDirect1,oWnd:End()),Relaunch()) ;
        MESSAGE "End this application"


static function MsgYesNoCancel( cMsg, cTitle )

return MessageBox( GetActiveWindow(), cMsg, cTitle, ;
nOR( MB_ICONQUESTION, MB_YESNOCANCEL ) )
*******
The options appear in the MsgYesNoCancel() dislog box is "Yes", "No","Cancel", how do I change it to "Yes", "Relaunch", "Cancel".

How should I write for the above ACTION if(MsgYesNoCancel......

Thanks

Regards
ACWoo

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: MsgYesNoCancel
Posted: Mon Dec 05, 2011 03:27 PM
acwoo1 wrote:
The options appear in the MsgYesNoCancel() dislog box is "Yes", "No","Cancel", how do I change it to "Yes", "Relaunch", "Cancel".

How should I write for the above ACTION if(MsgYesNoCancel......


I am afraid that you may have to write your own function to display custom buttons.

As far as i Know the available buttons for the MessageBox API are

Code (fw): Select all Collapse
MB_OK   
MB_OKCANCEL     
MB_ABORTRETRYIGNORE     
MB_YESNOCANCEL  
MB_YESNO    
MB_RETRYCANCEL  
MB_CANCELTRYCONTINUE    
MB_HELP


Regards
Anser
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: MsgYesNoCancel
Posted: Tue Dec 06, 2011 03:19 PM
Hi ACwoo,

I was initially in need of the same requirement while I was converting my Clipper Application.

And I could use FWH's strong resources and write a small function to meet my requirement like this.
Pls. have a glance. Using my function you can have any number of Button Options :-)

viewtopic.php?f=3&t=22834&p=122051#p122051
" rel="noopener">
viewtopic.php?f=3&t=22834&p=122051#p122051


Regards,

- Ramesh Babu P
Posts: 175
Joined: Tue Nov 10, 2009 10:56 AM
Re: MsgYesNoCancel
Posted: Wed Dec 07, 2011 07:28 AM

Thanks Ramesh Babu

I get unresolved external "_HB_FUN_HP_LIBDO"
It also require mymsgbox.dll

Regards

ACWoo
Using FWH1111+bcc582

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: MsgYesNoCancel
Posted: Wed Dec 07, 2011 01:51 PM

I don't think you want to use hp_libdo unless you put the functions in your own mymsgbox.dll.
Just use his control straight from your own code.

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: MsgYesNoCancel
Posted: Wed Dec 07, 2011 03:24 PM
I added 2 useful Options to the Function :

1. Optional Message-position in Relation to the Window / Dialog
Setting top- and left-value = 0, means centered

2. Brush-background
A empty brush selects the Gradient



Code (fw): Select all Collapse
@ 150, 170 BTNBMP oBtn1 OF oDlg PIXEL ;
SIZE 60, 30 ;
PROMPT "&Message" FILE c_path + "\images\preview.bmp" 2007 ;                
FONT oFont LEFT ;
ACTION ;
MYMSGBOX( oDlg, ;
"There is an error and the process could not be completed."+CRLF+"Please try it once again.", ;
, ;             // aOptions
50, ;               // Top ( 0 = centered )
50, ;               // Left ( 0 = centered )
"Error Message", ;  // Title
, ;             // xIcon
, ;             // nDefault
, ;             // aGradient
"marble5.bmp", ;    // Bmp-brush
, ;             // bAction
, ;             // oFont
, ;             // cFileRes
oIcon1)         //oIcon


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: MsgYesNoCancel
Posted: Wed Dec 07, 2011 03:55 PM

Hi Uwe,

You are known for adding elegance to our Applications front end, in our Family :D .

And your additions to MyMsgBox have added more beauty to the MyMsgBox.

My best regards,

-Ramesh Babu P

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: MsgYesNoCancel
Posted: Wed Dec 07, 2011 04:04 PM
Hello Ramesh,

do You need my changes, or adding the ideas by yourself ?

Selected Gradient or BMP-brush :
Code (fw): Select all Collapse
LOCAL c_path := CURDRIVE() + ":\" + GETCURDIR()

@ 200, 15 BTNBMP oBtn1 OF oDlg PIXEL ;
SIZE 60, 30 ;
PROMPT "Msg &Error" FILE c_path + "\images\preview.bmp" 2007 ;                
FONT oFont LEFT ;
ACTION MYMSGBOX( ;
"There is an error and the process could not be completed."+CRLF+"Please try it once again.", ;
150, ;          //  2. Top ( centered Top and Left = 0 )
140, ;          //  3. Left 
{"&Close"}, ;       //  4. aOptions
{"Exit16.bmp"}, ;   //  5. aBmps
"Error Message", ;  //  6. Title
"X", ;              //  7. xIcon
, ;             //  8. nDefault
, ;             //  9. aGradient
"marble5.bmp", ;    // 10. Bmp-brush
, ;             // 11. bAction
, ;             // 12. oFont
, ;             // 13. cFileRes
oIcon1, ;           // 14. oIcon
, ;             // 15. uVar 
, ;             // 16. cPict, 
, ;             // 17. bValid
, ;             // 18. lSpinner
, ;             // 19. lMeter
, ;             // 20. oMeter
, ;             // 21. lCancel
CURDRIVE() + ":\" + GETCURDIR() )
..
..
ACTIVATE DIALOG oDlg ;
ON INIT ( DlgInit( oDlg, oFont, cMsg, nTop, nLeft, aOptions, cTitle, nDefault,;
            aGradiate, bAction, xIcon, @uVar, cPict, bValid,;
            lSpinner, lMeter, oMeter, @lCancel ), ;
            IIF( EMPTY(cBrush), Gradiate(oDlg, aGradiate), ;
                               DrawBrush(oDlg, c_path + "\images\" + cBrush ) ) )

IF oIco # nil
      RELEASE ICON oIco
ENDIF

RELEASE FONT  oFont

RETURN oDlg:Cargo

// ---- BMP-Brush-function ---------

FUNCTION DrawBrush( oDlg, cBrush )
LOCAL oBrush

IF !FILE( cBrush )
    MsgAlert( "File : " + cBrush + CRLF + ;
            "does not exist to create" + CRLF + ; 
            "Brush-Background !", "ATTENTION" ) 
ELSE
    DEFINE BRUSH oBrush FILENAME cBrush
    oDlg:SetBrush( oBrush )
    oBrush:End()
ENDIF

RETURN nil


Maybe changing the Buttonstyle ( 16x16 BMP's from defined Array ) ?



Code (fw): Select all Collapse
FOR nFor := 1 TO LEN(aOptions)
    @ nBtnHeight, nBtnOffset + ((nFor-1)*nBtnWidth) BTNBMP aBtns[nFor] OF oDlg ;
    SIZE nBtnWidth + 16, oDlg:nGetChrHeight()*2 PIXEL;
    NOBORDER ;
    PROMPT aOptions[nFor] ;
    FILENAME aBmp[nFor] ;
    FONT oFont 2007 ;
    LEFT

// old Button
//  @ nBtnHeight, nBtnOffset + ((nFor-1)*nBtnWidth) ;
//  BUTTON aBtns[nFor] PROMPT aOptions[nFor] OF oDlg ;
//  PIXEL SIZE nBtnWidth, oDlg:nGetChrHeight()*1.7 

    nBtnOffset   := nBtnOffset + 8
    aBtns[nFor]:bAction := GenBlock(oDlg, nFor)
NEXT nFor


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: MsgYesNoCancel
Posted: Thu Dec 08, 2011 02:12 AM

Hello Uwe,

You are most welcome to make your suggestions for the
better looking MyMsgBox Screens.

I am using TSButtons in my copy of MyMsgBox.
Other may prefer to use Skin Buttons or BtnBmp etc..

Regards,

-Ramesh Babu P

Continue the discussion