INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Developer Tools

A MESSAGEBOX Wizard by Neil Toulouse
Posted: 5 Jan 05 (Edited 19 Jan 05)

Some years ago I attended a VFP training course and one of the excercises was to create a MESSAGEBOX wizard, as in a form to simplify the creation of the MESSAGEBOX command.

I have since modified the code (to get it to work!!) and find it quite a useful tool as in my old age(!) I can no longer keep the parameters in my head.

The form should be self-explanatory - enter the message, title, select an icon, set of buttons, a default button and a timeout parameter if your version of VFP allows it.  The code appears in the edit box.

Click on the 'Try' button to test the MESSAGEBOX command, the 'Copy' button to copy the command to the clipboard (ready for pasting into your code) or the 'Exit' button to, err..., exit!

Cut and paste the following code into a program (eg MSGBXWIZ.PRG):


CODE

**********************************************
*  MESSAGE BOX WIZARD                        *
*                                            *
*  Submitted by Neil Toulouse, 18th Jan 2005 *
*                                            *
* Now checks for Version of VFP and          *
* allows for timeout parameter if            *
* VFP7 or above                              *
**********************************************    

*** Create instance of form
oMsgWiz = CREATEOBJECT('msgwiz')
oMsgWiz.SHOW()
***

**************
* CLASS CODE *
**************

DEFINE CLASS msgwiz AS form

    Top = 7
    Left = 10
    Height = 459
    Width = 552
    DoCreate = .T.
    BorderStyle = 1
    Caption = "Messagebox Wizard"
    ControlBox = .F.
    Name = "MSGWIZ"
    WindowType = 1
    nicon = .F.
    nbutton = .F.
    ndefault = .F.
    ltimeout = .F.
    ntimeout = .F.


    ADD OBJECT shpexit AS shape WITH ;
        Top = 408, ;
        Left = 7, ;
        Height = 46, ;
        Width = 537, ;
        SpecialEffect = 0, ;
        Name = "shpExit"


    ADD OBJECT shpcode AS shape WITH ;
        Top = 263, ;
        Left = 7, ;
        Height = 134, ;
        Width = 537, ;
        SpecialEffect = 0, ;
        Name = "shpCode"


    ADD OBJECT shape3 AS shape WITH ;
        Top = 113, ;
        Left = 339, ;
        Height = 134, ;
        Width = 98, ;
        SpecialEffect = 0, ;
        Name = "Shape3"


    ADD OBJECT shape2 AS shape WITH ;
        Top = 113, ;
        Left = 8, ;
        Height = 134, ;
        Width = 135, ;
        SpecialEffect = 0, ;
        Name = "Shape2"


    ADD OBJECT shape1 AS shape WITH ;
        Top = 113, ;
        Left = 167, ;
        Height = 134, ;
        Width = 145, ;
        SpecialEffect = 0, ;
        Name = "Shape1"


    ADD OBJECT txttitle AS textbox WITH ;
        FontSize = 8, ;
        Height = 23, ;
        Left = 7, ;
        SelectOnEntry = .T., ;
        TabIndex = 2, ;
        Top = 64, ;
        Width = 537, ;
        Name = "txtTitle"


    ADD OBJECT label1 AS label WITH ;
        FontBold = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Title", ;
        Height = 17, ;
        Left = 7, ;
        Top = 48, ;
        Width = 40, ;
        TabIndex = 16, ;
        Name = "Label1"


    ADD OBJECT txtmessage AS textbox WITH ;
        FontSize = 8, ;
        Height = 23, ;
        Left = 7, ;
        SelectOnEntry = .T., ;
        TabIndex = 1, ;
        Top = 20, ;
        Width = 537, ;
        Name = "txtMessage"


    ADD OBJECT label2 AS label WITH ;
        AutoSize = .T., ;
        FontBold = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Message", ;
        Height = 16, ;
        Left = 7, ;
        Top = 5, ;
        Width = 53, ;
        TabIndex = 22, ;
        Name = "Label2"


    ADD OBJECT opgbuttons AS optiongroup WITH ;
        ButtonCount = 6, ;
        BorderStyle = 0, ;
        Value = 1, ;
        Height = 119, ;
        Left = 174, ;
        Top = 118, ;
        Width = 127, ;
        TabIndex = 7, ;
        Name = "opgButtons", ;
        Option1.Caption = "OK", ;
        Option1.Value = 1, ;
        Option1.Height = 17, ;
        Option1.Left = 5, ;
        Option1.Top = 5, ;
        Option1.Width = 61, ;
        Option1.Name = "Option1", ;
        Option2.Caption = "OK, Cancel", ;
        Option2.Height = 17, ;
        Option2.Left = 5, ;
        Option2.Top = 24, ;
        Option2.Width = 80, ;
        Option2.AutoSize = .T., ;
        Option2.Name = "Option2", ;
        Option3.Caption = "Abort, Retry, Ignore", ;
        Option3.Height = 17, ;
        Option3.Left = 5, ;
        Option3.Top = 43, ;
        Option3.Width = 121, ;
        Option3.AutoSize = .T., ;
        Option3.Name = "Option3", ;
        Option4.Caption = "Yes, No, Cancel", ;
        Option4.Height = 17, ;
        Option4.Left = 5, ;
        Option4.Top = 62, ;
        Option4.Width = 106, ;
        Option4.AutoSize = .T., ;
        Option4.Name = "Option4", ;
        Option5.Caption = "Yes, No", ;
        Option5.Height = 17, ;
        Option5.Left = 5, ;
        Option5.Top = 81, ;
        Option5.Width = 61, ;
        Option5.Name = "Option5", ;
        Option6.Caption = "Retry, Cancel", ;
        Option6.Height = 17, ;
        Option6.Left = 5, ;
        Option6.Top = 100, ;
        Option6.Width = 91, ;
        Option6.AutoSize = .T., ;
        Option6.Name = "Option6"


    ADD OBJECT chkstop AS checkbox WITH ;
        Top = 118, ;
        Left = 13, ;
        Height = 61, ;
        Width = 61, ;
        FontBold = .T., ;
        FontSize = 30, ;
        Caption = "X", ;
        Style = 1, ;
        TabIndex = 3, ;
        ForeColor = RGB(255,0,0), ;
        Name = "chkStop"


    ADD OBJECT chkquestion AS checkbox WITH ;
        Top = 118, ;
        Left = 77, ;
        Height = 61, ;
        Width = 61, ;
        FontBold = .T., ;
        FontSize = 30, ;
        Caption = "?", ;
        Style = 1, ;
        TabIndex = 4, ;
        ForeColor = RGB(0,0,255), ;
        Name = "chkQuestion"


    ADD OBJECT chkexclamation AS checkbox WITH ;
        Top = 181, ;
        Left = 13, ;
        Height = 61, ;
        Width = 61, ;
        FontBold = .T., ;
        FontSize = 30, ;
        Caption = "!", ;
        Style = 1, ;
        TabIndex = 5, ;
        ForeColor = RGB(217,194,117), ;
        Name = "chkExclamation"


    ADD OBJECT chkinformation AS checkbox WITH ;
        Top = 181, ;
        Left = 77, ;
        Height = 61, ;
        Width = 61, ;
        FontSize = 30, ;
        Caption = "i", ;
        Style = 1, ;
        TabIndex = 6, ;
        ForeColor = RGB(0,0,255), ;
        Name = "chkInformation"


    ADD OBJECT cmdexit AS commandbutton WITH ;
        Top = 418, ;
        Left = 451, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Exit", ;
        TabIndex = 15, ;
        Name = "cmdExit"


    ADD OBJECT edtcode AS editbox WITH ;
        FontBold = .T., ;
        Height = 116, ;
        Left = 15, ;
        ReadOnly = .T., ;
        TabIndex = 12, ;
        Top = 272, ;
        Width = 520, ;
        DisabledBackColor = RGB(255,255,255), ;
        Name = "edtCode"


    ADD OBJECT label3 AS label WITH ;
        FontBold = .T., ;
        FontSize = 8, ;
        Caption = "Code", ;
        Height = 17, ;
        Left = 15, ;
        Top = 255, ;
        Width = 40, ;
        TabIndex = 23, ;
        Name = "Label3"


    ADD OBJECT cmdgenerate AS commandbutton WITH ;
        Top = 418, ;
        Left = 231, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Copy", ;
        TabIndex = 14, ;
        Name = "cmdGenerate"


    ADD OBJECT cmdtry AS commandbutton WITH ;
        Top = 418, ;
        Left = 15, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Try", ;
        TabIndex = 13, ;
        Name = "cmdTry"


    ADD OBJECT opgdefault AS optiongroup WITH ;
        ButtonCount = 3, ;
        BorderStyle = 0, ;
        Value = 1, ;
        Height = 121, ;
        Left = 346, ;
        Top = 117, ;
        Width = 83, ;
        TabIndex = 8, ;
        Name = "opgDefault", ;
        Option1.Caption = "Button 1", ;
        Option1.Value = 1, ;
        Option1.Height = 35, ;
        Option1.Left = 1, ;
        Option1.Style = 1, ;
        Option1.Top = 5, ;
        Option1.Width = 80, ;
        Option1.Name = "Button1", ;
        Option2.Caption = "Button 2", ;
        Option2.Height = 35, ;
        Option2.Left = 1, ;
        Option2.Style = 1, ;
        Option2.Top = 46, ;
        Option2.Width = 80, ;
        Option2.Name = "Button2", ;
        Option3.Caption = "Button 3", ;
        Option3.Height = 35, ;
        Option3.Left = 1, ;
        Option3.Style = 1, ;
        Option3.Top = 87, ;
        Option3.Width = 80, ;
        Option3.Name = "Button3"


    ADD OBJECT label4 AS label WITH ;
        FontBold = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Icon", ;
        Height = 17, ;
        Left = 8, ;
        Top = 96, ;
        Width = 40, ;
        TabIndex = 19, ;
        Name = "Label4"


    ADD OBJECT label5 AS label WITH ;
        FontBold = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Buttons", ;
        Height = 17, ;
        Left = 167, ;
        Top = 96, ;
        Width = 52, ;
        TabIndex = 17, ;
        Name = "Label5"


    ADD OBJECT label6 AS label WITH ;
        AutoSize = .F., ;
        FontBold = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Default Button", ;
        Height = 16, ;
        Left = 339, ;
        Top = 96, ;
        Width = 79, ;
        TabIndex = 21, ;
        Name = "Label6"


    ADD OBJECT shptimeout AS shape WITH ;
        Top = 113, ;
        Left = 464, ;
        Height = 134, ;
        Width = 80, ;
        SpecialEffect = 0, ;
        Name = "shpTimeout"


    ADD OBJECT lbltimeout AS label WITH ;
        AutoSize = .T., ;
        FontBold = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Timeout (sec)", ;
        Height = 16, ;
        Left = 464, ;
        Top = 96, ;
        Width = 79, ;
        TabIndex = 20, ;
        Name = "lblTimeout"


    ADD OBJECT opgtimeout AS optiongroup WITH ;
        AutoSize = .T., ;
        ButtonCount = 4, ;
        BorderStyle = 0, ;
        Value = 1, ;
        Height = 83, ;
        Left = 480, ;
        Top = 114, ;
        Width = 53, ;
        TabIndex = 9, ;
        Name = "opgTimeOut", ;
        Option1.FontSize = 8, ;
        Option1.Caption = "None", ;
        Option1.Value = 1, ;
        Option1.Height = 16, ;
        Option1.Left = 5, ;
        Option1.Top = 5, ;
        Option1.Width = 43, ;
        Option1.AutoSize = .F., ;
        Option1.Name = "Option1", ;
        Option2.FontSize = 8, ;
        Option2.Caption = "1", ;
        Option2.Height = 16, ;
        Option2.Left = 5, ;
        Option2.Top = 24, ;
        Option2.Width = 24, ;
        Option2.AutoSize = .F., ;
        Option2.Name = "Option2", ;
        Option3.FontSize = 8, ;
        Option3.Caption = "2", ;
        Option3.Height = 16, ;
        Option3.Left = 5, ;
        Option3.Top = 43, ;
        Option3.Width = 24, ;
        Option3.AutoSize = .F., ;
        Option3.Name = "Option3", ;
        Option4.FontSize = 8, ;
        Option4.Caption = "5", ;
        Option4.Height = 16, ;
        Option4.Left = 5, ;
        Option4.Top = 62, ;
        Option4.Width = 24, ;
        Option4.AutoSize = .F., ;
        Option4.Name = "Option4"


    ADD OBJECT txttimeout AS textbox WITH ;
        FontSize = 8, ;
        ControlSource = "ThisForm.nTimeOut", ;
        Height = 23, ;
        InputMask = "99.99", ;
        Left = 494, ;
        SelectOnEntry = .T., ;
        TabIndex = 11, ;
        Top = 217, ;
        Width = 38, ;
        Name = "txtTimeOut"


    ADD OBJECT lblother AS label WITH ;
        AutoSize = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Other", ;
        Height = 16, ;
        Left = 498, ;
        Top = 202, ;
        Width = 29, ;
        TabIndex = 18, ;
        Name = "lblOther"


    ADD OBJECT chktimeout AS checkbox WITH ;
        Top = 219, ;
        Left = 476, ;
        Height = 17, ;
        Width = 18, ;
        AutoSize = .T., ;
        Caption = "", ;
        TabIndex = 10, ;
        Name = "chkTimeOut"


    PROCEDURE setform


        WITH THISFORM

            *** Get VFP Version
            IF INT(VAL(RIGHT(SUBSTR(VERSION(), 1, 16),2))) < 7  && No timeout parameter prior to VFP7
                .lTimeOut = .F.
            ELSE
                IF INT(VAL(RIGHT(SUBSTR(VERSION(), 1, 16),2))) >= 7  && Timeout parameter VFP7 onwards
                    .lTimeOut = .T.
                ENDIF
            ENDIF

            *** Hide TIMEOUT parameter dependent on VFP version
            IF .lTimeOut = .F.
                .WIDTH = 444
                .txtMessage.WIDTH = 430
                .txtTitle.WIDTH = 430
                .shpCode.WIDTH = 430
                .edtcode.WIDTH = 412
                .shpExit.WIDTH = 430
                .cmdExit.LEFT = 343
                .cmdGenerate.LEFT = 178
                .lblTimeOut.Visible = .F.
                .shpTimeOut.Visible = .F.
                .opgTimeOut.Visible = .F.
                .chkTimeOut.Visible = .F.
                .txtTimeOut.Visible = .F.
                .lblOther.Visible = .F.
            ENDIF

            *** Default for an Icon
            .chkStop.VALUE = 1
            .chkQuestion.VALUE = 0
            .chkInformation.VALUE = 0
            .chkExclamation.VALUE = 0

            *** Default for a set of buttons
            .opgButtons.VALUE = 1

            *** Default for a default button
            .opgDefault.VALUE = 1
            .opgDefault.Button1.CAPTION = 'OK'
            .opgDefault.Button2.VISIBLE = .F.
            .opgDefault.Button3.VISIBLE = .F.

            .txtTitle.VALUE = 'Title'
            .txtMessage.VALUE = 'Message'

            .CreateCode()

            .REFRESH()


        ENDWITH
    ENDPROC


    PROCEDURE retval
        LOCAL lcRetVal

        lcRetVal = ""

        WITH THISFORM

            DO CASE

                CASE .nButton = 0
                    lcRetVal = "OK = 1"

                CASE .nButton = 1
                    lcRetVal = "OK = 1, Cancel = 2"

                CASE .nButton = 2
                    lcRetVal = "Abort = 3, Retry = 4, Ignore = 5"

                CASE .nButton = 3
                    lcRetVal = "Yes = 6, No = 7, Cancel = 2"

                CASE .nButton = 4
                    lcRetVal = "Yes = 6, No = 7"

                CASE .nButton = 5
                    lcRetVal = "Retry = 4, Cancel = 2"

            ENDCASE

        ENDWITH

*** Add return value for timeout if applicable
IF .lTimeOut = .T. AND .nTimeOut > 0
    lcRetVal = lcRetVal + ", Timed out = -1"
ENDIF

        RETURN lcRetVal
    ENDPROC


    PROCEDURE createcode
        WITH THISFORM

            CREATE CURSOR curCode ( CODE M(4) )
            SELECT curCode
            APPEND BLANK

            IF .lTimeOut = .T.  && Include timeout parameter

                REPLACE CODE WITH ;
                    'MESSAGEBOX( "' + ALLTRIM(.txtMessage.VALUE) + '", ' + ;
                    ALLTRIM(STR(.nButton)) + '+' + ALLTRIM(STR(.nIcon)) + '+' + ALLTRIM(STR(.nDefault)) + ', "' + ;
                    ALLTRIM(.txtTitle.VALUE) + '", ' + ALLTRIM(STR(.nTimeOut*1000)) + " )" + '  &' + '&  ' + ALLTRIM(.RetVal()) ;
                    IN curCode

            ELSE  && Omit timeout parameter

                REPLACE CODE WITH ;
                    'MESSAGEBOX( "' + ALLTRIM(.txtMessage.VALUE) + '", ' + ;
                    ALLTRIM(STR(.nButton)) + '+' + ALLTRIM(STR(.nIcon)) + '+' + ALLTRIM(STR(.nDefault)) + ', "' + ;
                    ALLTRIM(.txtTitle.VALUE) + '" )' + '  &' + '&  ' + ALLTRIM(.RetVal()) ;
                    IN curCode

            ENDIF

            .edtCode.VALUE = ALLTRIM(curCode.CODE)

            IF USED('curCode')
                USE IN curCode
            ENDIF

        ENDWITH
    ENDPROC


    PROCEDURE Init
        WITH THISFORM

            SET CONFIRM ON

            .nIcon = 16
            .nButton = 0
            .nDefault = 0
            .nTimeOut = 00.00
            .SETFORM()

        ENDWITH
    ENDPROC


    PROCEDURE txttitle.Valid
        THISFORM.CreateCode()
    ENDPROC


    PROCEDURE txtmessage.Valid
        THISFORM.CreateCode()
    ENDPROC


    PROCEDURE opgbuttons.Valid
        WITH THISFORM

            DO CASE

                CASE THIS.VALUE = 1  && OK
                    .nButton = 0

                    WITH .opgDefault
                        .VALUE = 1
                        .Button1.CAPTION = 'OK'
                        .Button2.VISIBLE = .F.
                        .Button2.CAPTION = ""
                        .Button3.VISIBLE = .F.
                        .Button3.CAPTION = ""
                    ENDWITH

                CASE THIS.VALUE = 2  && OK, Cancel
                    .nButton = 1

                    WITH .opgDefault
                        .VALUE = 1
                        .Button1.CAPTION = 'OK'
                        .Button2.VISIBLE = .T.
                        .Button2.CAPTION = 'Cancel'
                        .Button3.VISIBLE = .F.
                        .Button3.CAPTION = ""
                    ENDWITH

                CASE THIS.VALUE = 3  && Abort, Retry, Ignore
                    .nButton = 2

                    WITH .opgDefault
                        .VALUE = 1
                        .Button1.CAPTION = 'Abort'
                        .Button2.VISIBLE = .T.
                        .Button2.CAPTION = 'Retry'
                        .Button3.VISIBLE = .T.
                        .Button3.CAPTION = 'Ignore'
                    ENDWITH

                CASE THIS.VALUE = 4  && Abort, Retry, Ignore
                    .nButton = 3

                    WITH .opgDefault
                        .VALUE = 1
                        .Button1.CAPTION = 'Yes'
                        .Button2.VISIBLE = .T.
                        .Button2.CAPTION = 'No'
                        .Button3.VISIBLE = .T.
                        .Button3.CAPTION = 'Cancel'
                    ENDWITH

                CASE THIS.VALUE = 5  && OK, Cancel
                    .nButton = 4

                    WITH .opgDefault
                        .VALUE = 1
                        .Button1.CAPTION = 'Yes'
                        .Button2.VISIBLE = .T.
                        .Button2.CAPTION = 'No'
                        .Button3.VISIBLE = .F.
                        .Button3.CAPTION = ""
                    ENDWITH

                CASE THIS.VALUE = 6  && OK, Cancel
                    .nButton = 5

                    WITH .opgDefault
                        .VALUE = 1
                        .Button1.CAPTION = 'Retry'
                        .Button2.VISIBLE = .T.
                        .Button2.CAPTION = 'Cancel'
                        .Button3.VISIBLE = .F.
                        .Button3.CAPTION = ""
                    ENDWITH

            ENDCASE

            .CreateCode()

        ENDWITH
    ENDPROC


    PROCEDURE chkstop.Valid
        WITH THISFORM

            IF THIS.VALUE = 1
                .chkExclamation.VALUE = 0
                .chkInformation.VALUE = 0
                .chkQuestion.VALUE = 0
                .nIcon = 16
            ENDIF

            .CreateCode()

        ENDWITH
    ENDPROC


    PROCEDURE chkquestion.Valid
        WITH THISFORM

            IF THIS.VALUE = 1
                .chkExclamation.VALUE = 0
                .chkInformation.VALUE = 0
                .chkStop.VALUE = 0
                .nIcon = 32
            ENDIF

            .CreateCode()

        ENDWITH
    ENDPROC


    PROCEDURE chkexclamation.Valid
        WITH THISFORM

            IF THIS.VALUE = 1
                .chkStop.VALUE = 0
                .chkInformation.VALUE = 0
                .chkQuestion.VALUE = 0
                .nIcon = 48
            ENDIF

            .CreateCode()

        ENDWITH
    ENDPROC


    PROCEDURE chkinformation.Valid
        WITH THISFORM

            IF THIS.VALUE = 1
                .chkExclamation.VALUE = 0
                .chkStop.VALUE = 0
                .chkQuestion.VALUE = 0
                .nIcon = 64
            ENDIF

            .CreateCode()

        ENDWITH
    ENDPROC


    PROCEDURE cmdexit.Click
        THISFORM.RELEASE()
    ENDPROC


    PROCEDURE cmdgenerate.Click
        WITH THISFORM

            STORE ALLTRIM(.edtCode.Value) TO _ClipText

        ENDWITH
    ENDPROC


    PROCEDURE cmdtry.Click
        LOCAL lcComm, lnValue

        WITH THISFORM

            .VISIBLE = .F.
            lcComm = ;
                'lnValue = MESSAGEBOX( "' + ALLTRIM(.txtMessage.VALUE) + '", ' + ALLTRIM(STR(.nIcon+.nButton+.nDefault)) + ', "' + ALLTRIM(.txtTitle.VALUE) + '", ' + ALLTRIM(STR(.nTimeOut*1000)) + ")"
            &lcComm
            =MESSAGEBOX( "Returned value = " + ALLTRIM(STR(lnValue)), 0+64+0, "" )
            .VISIBLE = .T.

        ENDWITH
    ENDPROC


    PROCEDURE opgdefault.Valid
        WITH THIS

            DO CASE

                CASE .VALUE = 1
                    THISFORM.nDefault = 0

                CASE .VALUE = 2
                    THISFORM.nDefault = 256

                CASE .VALUE = 3
                    THISFORM.nDefault = 512

            ENDCASE

            THISFORM.CreateCode()

        ENDWITH
    ENDPROC


    PROCEDURE opgtimeout.Valid
        WITH THISFORM

            DO CASE

                CASE THIS.VALUE = 1 && None - No timeout
                    .nTimeout = 00.00

                CASE THIS.VALUE = 2 && 1 second
                    .nTimeout = 1.00

                CASE THIS.VALUE = 3 && 2 seconds
                    .nTimeout = 2.00

                CASE THIS.VALUE = 4 && 5 seconds
                    .nTimeout = 5.00

            ENDCASE

            .CreateCode()

        ENDWITH
    ENDPROC


    PROCEDURE txttimeout.Valid
        THISFORM.CreateCode()
    ENDPROC


    PROCEDURE chktimeout.Valid
        WITH THISFORM

            IF THIS.VALUE = 1
                .opgTimeout.ENABLED = .F.
                .txtTimeOut.ENABLED = .T.
            ELSE
                .opgTimeout.ENABLED = .T.
                .txtTimeOut.ENABLED = .F.
                .opgTimeout.VALID()
            ENDIF

            .REFRESH()

        ENDWITH
    ENDPROC


ENDDEFINE
**************************************************

If you want to add this to your system menu, you need to add some code to you environment setup program, eg:

CODE

DEFINE PAD Utils OF _MSYSMENU PROMPT "\<Utilities"
ON PAD Utils OF _MSYSMENU ACTIVATE POPUP Utils
DEFINE POPUP Utils MARGIN RELATIVE
DEFINE BAR 1 OF Utils PROMPT "MessageBox Wizard"
ON SELECTION BAR 1 OF Utils DO C:\PRGS\MSGBXWIZ.PRG


...or you can define a Function key to call the program, eg:

CODE

ON KEY LABEL F9 DO C:\PRGS\MSGBXWIZ.PRG


BTW - The HTM version of 'the Hacker's Guide v6' has the parameters for MESSAGEBOX() listed incorrectly, so this utility has proved to be quite useful to me!


Neil

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close