Code:
#PBFORMS CREATED V1.51
#COMPILE EXE
#DIM ALL
 
'------------------------------------------------------------------------------
'   ** Includes **
'------------------------------------------------------------------------------
#PBFORMS BEGIN INCLUDES
#IF NOT %DEF(%WINAPI)
    #INCLUDE "WIN32API.INC"
#ENDIF
#PBFORMS END INCLUDES
'------------------------------------------------------------------------------
 
'mVerifyEdit: Example of using a quick and easy to use MACRO to limit input characters.
'Main advantage of this approach is that it only requires one line of code in the callback to make it work
'Placed into the Public Domain by Colin Schmidt on 2007-12-19 - use at your own risk.
MACRO mVerifyEdit(phCtls)
    MACROTEMP lsVerifyEditText, llVerifyEditPos
    LOCAL lsVerifyEditText AS STRING, llVerifyEditPos AS LONG
    IF (CBMSG = %WM_COMMAND) AND (CBCTLMSG = %EN_CHANGE) AND (CBCTL = phCtls) THEN
        CONTROL GET TEXT CBHNDL, CBCTL TO lsVerifyEditText
        IF VERIFY(lsVerifyEditText, "0123456789.,-$") THEN
            CONTROL SEND CBHNDL, CBCTL, %EM_GETSEL, VARPTR(llVerifyEditPos), 0
            lsVerifyEditText = RETAIN$(lsVerifyEditText, ANY "0123456789.,-$")
            CONTROL SET TEXT CBHNDL, CBCTL, lsVerifyEditText
            llVerifyEditPos = MAX(1, llVerifyEditPos - 1)
            CONTROL SEND CBHNDL, CBCTL, %EM_SETSEL, llVerifyEditPos, llVerifyEditPos
        END IF
    END IF
END MACRO
 
'------------------------------------------------------------------------------
'   ** Constants **
'------------------------------------------------------------------------------
#PBFORMS BEGIN CONSTANTS
%IDOK         =   1
%IDC_LABEL1   =   2
%IDC_TEXTBOX1 =   3
%IDC_LABEL2   =   4
%IDC_TEXTBOX2 =   5
%IDC_LABEL3   =   6
%IDC_TEXTBOX3 =   7
%IDC_LABEL4   =   8
%IDC_TEXTBOX4 =   9
%IDD_DIALOG1  = 101
#PBFORMS END CONSTANTS
'------------------------------------------------------------------------------
 
'------------------------------------------------------------------------------
'   ** Declarations **
'------------------------------------------------------------------------------
DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
#PBFORMS DECLARATIONS
'------------------------------------------------------------------------------
 
'------------------------------------------------------------------------------
'   ** Main Application Entry Point **
'------------------------------------------------------------------------------
FUNCTION PBMAIN()
    ShowDIALOG1 %HWND_DESKTOP
END FUNCTION
'------------------------------------------------------------------------------
 
'------------------------------------------------------------------------------
'   ** CallBacks **
'------------------------------------------------------------------------------
CALLBACK FUNCTION ShowDIALOG1Proc()
 
    mVerifyEdit(%IDC_TEXTBOX2)
    mVerifyEdit(%IDC_TEXTBOX3)
    mVerifyEdit(%IDC_TEXTBOX4)
 
    SELECT CASE AS LONG CBMSG
        CASE %WM_INITDIALOG
            ' Initialization handler
 
        CASE %WM_NCACTIVATE
            STATIC hWndSaveFocus AS DWORD
            IF ISFALSE CBWPARAM THEN
                ' Save control focus
                hWndSaveFocus = GetFocus()
            ELSEIF hWndSaveFocus THEN
                ' Restore control focus
                SetFocus(hWndSaveFocus)
                hWndSaveFocus = 0
            END IF
 
        CASE %WM_COMMAND
            ' Process control notifications
            SELECT CASE AS LONG CBCTL
                CASE %IDOK
                    IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                        DIALOG END CBHNDL, %IDOK
                    END IF
 
            END SELECT
    END SELECT
END FUNCTION
'------------------------------------------------------------------------------
 
'------------------------------------------------------------------------------
'   ** Dialogs **
'------------------------------------------------------------------------------
FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    LOCAL lRslt AS LONG
 
#PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
    LOCAL hDlg  AS DWORD
 
    DIALOG NEW hParent, "Verify Edit Example", 223, 103, 161, 106, %WS_POPUP _
        OR %WS_BORDER OR %WS_DLGFRAME OR %WS_SYSMENU OR %WS_MINIMIZEBOX OR _
        %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_CENTER OR _
        %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT _
        OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO _
        hDlg
    CONTROL ADD LABEL,   hDlg, %IDC_LABEL1, "Any Char:", 5, 10, 40, 10
    CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX1, "", 50, 10, 100, 13
    CONTROL ADD LABEL,   hDlg, %IDC_LABEL2, "Num Only:", 5, 25, 40, 10
    CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX2, "", 50, 25, 100, 13
    CONTROL ADD LABEL,   hDlg, %IDC_LABEL3, "Num Only:", 5, 40, 40, 10
    CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX3, "", 50, 40, 100, 13
    CONTROL ADD LABEL,   hDlg, %IDC_LABEL4, "Num Only:", 5, 55, 40, 10
    CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX4, "", 50, 55, 100, 13
    CONTROL ADD BUTTON,  hDlg, %IDOK, "&OK", 100, 80, 50, 15
    DIALOG  SEND         hDlg, %DM_SETDEFID, %IDOK, 0
#PBFORMS END DIALOG
 
    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
 
#PBFORMS BEGIN CLEANUP %IDD_DIALOG1
#PBFORMS END CLEANUP
 
    FUNCTION = lRslt
END FUNCTION
'------------------------------------------------------------------------------