Author Topic: (Phoenix) Masked Edit-Control  (Read 4328 times)

0 Members and 1 Guest are viewing this topic.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 919
  • User-Rate: +30/-4
    • it-berater
(Phoenix) Masked Edit-Control
« on: May 19, 2007, 03:43:06 PM »
The following Messages are from Phoenix-Controls.
To make them avaiable for Internet-Search I wanted to post them here.


Code: [Select]
'###############################################################################
' BEGIN MaskedEdit_Class32
'###############################################################################

' Masked Edit notifications
' -------------------------
'%NM_SETFOCUS                    = %NM_FIRST - 7
' Notifies the parent window of the control that the control has received the
' input focus.  NM_SETFOCUS is sent in the form of a WM_NOTIFY message.

'%NM_KILLFOCUS                   = %NM_FIRST - 8
' Notifies the parent window of the control that the control has lost the
' input focus.  NM_KILLFOCUS is sent in the form of a WM_NOTIFY message.

%MEDN_CHANGE                    = %WM_USER + &H5&
' Sent when the user has taken an action that may have altered text in the control.
' Unlike the MEDN_UPDATE notification message, this notification message is sent after
' Windows updates the screen.
' MEDN_CHANGE is sent in the form of a WM_NOTIFY message.

%MEDN_UPDATE                    = %WM_USER + &H6&
' Sent when the control is about to display altered text.  This notification message
' is sent after the control has formatted the text, but before it displays the text.
' This makes it possible TO resize the control window, if necessary.
' MEDN_UPDATE is sent in the form of a WM_NOTIFY message.

%MEDN_MAXTEXT                   = %WM_USER + &H7&
' Sent when the current text insertion has exceeded the maximum number of characters
' allowed for the control.  MEDN_MAXTEXT is sent in the form of a WM_NOTIFY message.
' This message is also sent when the control does not have the MEDS_AUTOHSCROLL style
' and the number of characters to be inserted would exceed the width of the control.
' A control with the MEDS_CENTER or MEDS_RIGHT style sends this message when no more
' characters can be inserted to the left of the insertion point.

' The MASKEDITNOTIFY structure is used by the MEDN_VALIDATIONERROR notification.
TYPE MASKEDITNOTIFY    ' medn
  hdr             AS NMHDR        ' control handle and id information
  bStartPos       AS BYTE         ' zero-based index of the first invalid character
  pszInvalidText  AS ASCIIZ PTR   ' address of invalid text
END TYPE

%MEDN_VALIDATIONERROR           = %WM_USER + &H8&
' Sent when the control receives invalid input, as determined by the input mask.
' MEDN_VALIDATIONERROR is sent in the form of a WM_NOTIFY message.

' Masked Edit messages
' --------------------
%MEDM_SETTEXTCOLOR              = %WM_USER + &H3&
' Purpose: sets the text color.
' wParam:  TRUE - set text color of literals.
' lParam:  text color.
' Return:  old text color.

%MEDM_GETTEXTCOLOR              = %WM_USER + &H4&
' Purpose: gets the current text color.
' wParam:  TRUE - get text color of literals.
' lParam:  N/A
' Return:  text color.

%MEDM_SETBACKCOLOR              = %WM_USER + &H5&
' Purpose: sets the background color.
' wParam:  TRUE - set background color of literals.
' lParam:  back color.
' Return:  old background color.

%MEDM_GETBACKCOLOR              = %WM_USER + &H6&
' Purpose: gets the current background color.
' wParam:  TRUE - get background color of literals.
' lParam:  N/A
' Return:  background color.

%MEDM_SETMASK                   = %WM_USER + &HB&
' Purpose: sets the input mask.  The contents of the text buffer may change
'          or the buffer may be set to NULL when the input mask is changed.
' wParam:  N/A
' lParam:  address of buffer with mask.
' Return:  N/A

' The input mask can consist of the following characters.
' Character   Description
' ---------   -----------
' .           Decimal placeholder.
' ,           Thousands separator.
' :           Time separator.
' /           Date separator.
'             The actual character used for the decimal, thousands, time and
'             date separators depends on your international settings.  These
'             characters are treated as literals for masking purposes.

' 0           Digit, 0-9.  Entry is required.
' 9           Digit, 0-9 or space.  Entry is optional.
' #           Digit or space.  Plus or minus (+-) signs are allowed.  Entry is optional.

' L           Letter, A-Z or a-z.  Entry is required.
' ?           Letter or space.  Entry is optional.

' A           Letter or digit.  Entry is required.
' a           Letter, digit or space.  Entry is optional.

' &           Any character or space. Entry is required.
' C           Any character or space. Entry is optional.

' >           Convert characters that follow to uppercase.
' <           Convert characters that follow to lowercase.

' |           Stop converting characters to upper or lower case.

' []          Allow only the specified characters.  Entry is required.
' {}          Allow only the specified characters.  Entry is optional.
'             Also, stops the conversion of characters to uppercase or lowercase.
'             Examples,
'             [abcde]  allows a, b, c, d or e to be entered.
'             [a-e]    allows a, b, c, d or e to be entered.
'             [a-e0-3] allows a, b, c, d, 0, 1, 2 or 3 to be entered.

' ()          Allow only values within the specified numeric range.
'             This must be the first non-input characters in a field.
'
'             A field is one one more input characters delimited by literals.
'
'             A field with a numeric range, supports the following keyboard navigation.
'             Up Arrow key   - increases the value in the field.
'             Down Arrow key - decreases the value in the field.
'             Home key       - selects the minimum value.
'             End key        - selects the maximum value.

'             Minimum number supported = -999999999
'             Maximum number supported = 999999999
'
'             Examples,
'             (15,35)
'             (-100,75)

' !           Changes the default placement of spaces representing optional characters
'             in text retrieved from the control.  By default, optional characters are
'             represented as trailing blanks when the MEDS_LEFT style is set, and as
'             leading blanks when the MEDS_CENTER or MEDS_RIGHT style is set.  The
'             presence of this character causes optional characters to be represented as
'             leading blanks when MEDS_LEFT is set and as trailing blanks when MEDS_RIGHT
'             or MEDS_CENTER is set.

' \           Characters are displayed as themselves(literals).

'             Characters that are not input mask characters are treated as literals.

'             Examples,

'             Internet address
'             (0,255)###-(0,255)###-(100,255)###-(0,255)###

'             Phone number
'             \(000\)-000-0000 Ext.999

'             ISBN number
'             ISBN-(100,200)###-???->AAAA-[a-e1-5][789][wxyz]{aeiou1-4}

%MEDM_GETMASK                   = %WM_USER + &HC&
' Purpose: gets the current mask.  Set wParam or lParam to zero, to
'          have the message return the size of the buffer needed to
'          hold the text including the terminating NULL.
' wParam:  count of characters to copy including the terminating NULL.
' lParam:  address of buffer to receive the text.
' Return:  count of characters copied to the buffer.

%MEDM_SETPROMPTCHAR             = %WM_USER + &HD&
' Purpose: sets the character used to prompt the user for input.  If
'          lParam equals zero, the prompt character is set to the
'          default.  The underscore character "_" is the default.
' wParam:  new prompt character.
' lParam:  N/A
' Return:  previous prompt character

%MEDM_GETPROMPTCHAR             = %WM_USER + &HE&
' Purpose: gets the prompt character used to prompt the user for input.
' wParam:  N/A
' lParam:  N/A
' Return:  current prompt character.

%MEDM_SETSELTEXT                = %WM_USER + &HF&
' Purpose: sets the text contained in the control.  The text is inserted
'          at the location of the caret.  Any selected text in the control
'          is replaced with the new text.
'          The WM_SETTEXT or MEDM_SETTEXT messages can be used to replace the
'          entire contents of the control whether or not there is selected text
'          in the control.
' wParam:  N/A
' lParam:  address of null-terminated text or NULL.
' Return:  N/A

%MEDM_GETSELTEXT                = %WM_USER + &H10&
' Purpose: gets the selected text contained in the control.
'          The WM_GETTEXT or MEDM_GETTEXT messages can be used to retrieve the
'          entire contents of the control whether or not there is selected text
'          in the control.  The text retrieved by MEDM_GETSELTEXT and MEDM_GETTEXT
'          does not contain literal characters when the MEDS_CLIPLITERALS style is set.
'          WM_GETTEXT is not affected by the MEDS_CLIPLITERALS style and always returns
'          literal and prompt characters.
'          Set wParam or lParam to zero, to have the message return the size of
'          the buffer needed to hold the text including the terminating NULL.
' wParam:  count of characters to copy including the terminating NULL.
' lParam:  address of buffer to receive the text.
' Return:  count of characters copied to the buffer.

%MEDM_SETTEXT                   = %WM_USER + &H11&
' Purpose: replaces the entire contents of the control or the specified field whether
'          or not there is selected text in the control.  Literals are not affected.
' wParam:  loword = zero-based index of field.  Set to 0xff to replace all text in the
'          control.
' lParam:  address of null-terminated text or NULL.
' Return:  N/A

%MEDM_GETTEXT                   = %WM_USER + &H12&
' Purpose: retrieves the entire contents of the control or the specified field whether
'          or not there is selected text in the control.  The text retrieved does not
'          contain literal characters when the MEDS_CLIPLITERALS style is set.
'          Set lParam or the hiword of wParam to zero, to have the message return the
'          size of the buffer needed to hold the text including the terminating NULL.
'          Because the hiword of wParam is used to specify the buffer size, this message
'          cannot be used to retrieve more than 64K characters from the control.
' wParam:  loword = zero-based index of field.  Set to 0xff to retrieve all text in the
'                   control.
'          hiword = count of characters to copy including the terminating NULL.
' lParam:  address of buffer to receive the text.
' Return:  count of characters copied to the buffer.

%MEDM_SETPASSWORDCHAR           = %WM_USER + &H13&
' Purpose: sets the character that is displayed for each character typed into
'          the control when the control has the MEDS_PASSWORD style.
'          If lParam equals zero, the password character is set to the default.
'          The asterisk character "*" is the default.
' wParam:  new password character.
' lParam:  N/A
' Return:  previous password character.

%MEDM_GETPASSWORDCHAR           = %WM_USER + &H14&
' Purpose: gets the password character that is displayed for each character typed
'          into the control.
' wParam:  N/A
' lParam:  N/A
' Return:  current password character.

%MEDM_SETLIMITTEXT              = %WM_USER + &H15&
' Purpose: sets the text limit for the control.  The text limit is the maximum amount
'          of text, in bytes, that the control can contain.
' wParam:  new text limit in bytes.
' lParam:  N/A
' Return:  previous text limit.

%MEDM_GETLIMITTEXT              = %WM_USER + &H16&
' Purpose: gets the current text limit, in bytes.
' wParam:  N/A
' lParam:  N/A
' Return:  current text limit.

%MEDM_SETSEL                    = %WM_USER + &H17&
' Purpose: selects a range of characters.
'          If the start position is 0 and the end position is -1, all the text
'          in the control is selected.  If the start position is -1, any current
'          selection is removed.  The caret is placed at the end of the selection
'          indicated by the greater of the two values wParam and lParam.
' wParam:  starting position.
' lParam:  ending position.
' Return:  N/A

%MEDM_GETSEL                    = %WM_USER + &H18&
' Purpose: retrieves the starting and ending character positions of the current selection.
' wParam:  address of variable to receive the starting position.
' lParam:  address of variable to receive the ending position.
' Return:  N/A

%MEDM_SETCURFIELD               = %WM_USER + &H19&
' Purpose: moves the caret to the specified field.  All text in the field is selected
'          if the control has the MEDS_AUTOSELECTFIELD style.
'          A field is one one more input characters delimited by literals.
' wParam:  zero-based index of field.
' lParam:  N/A
' Return:  N/A

%MEDM_GETCURFIELD               = %WM_USER + &H1A&
' Purpose: gets the index of the field the caret is currently in.
'          A field is one one more input characters delimited by literals.
' wParam:  N/A
' lParam:  N/A
' Return:  zero-based index of field or 0xff if the caret is not in a field.

%MEDM_SETVALUE                  = %WM_USER + &H1B&
' Purpose: sets the value of the specified field.
'          A field is one one more input characters delimited by literals.
' wParam:  zero-based index of field.
' lParam:  new value of field.
' Return:  N/A

%MEDM_GETVALUE                  = %WM_USER + &H1C&
' Purpose: gets the value of the specified field.
'          A field is one one more input characters delimited by literals.
' wParam:  zero-based index of field.
' lParam:  N/A
' Return:  value of specified field.

%MEDM_SETMARGINS                = %WM_USER + &H1D&
' Purpose: sets the widths of the left and right margins.
' wParam:  specifies the margins to set.
'          This parameter can be a combination of the following values:
'          EC_LEFTMARGIN  - sets the left margin.
'          EC_RIGHTMARGIN - sets the right margin.
'          EC_USEFONTINFO - uses information about the current font to set the margins.
' lParam:  loword = width of left margin in pixels. Ignored if EC_LEFTMARGIN is not specified.
'          hiword = width of right margin in pixels. Ignored if EC_RIGHTMARGIN is not specified.
'          lParam is ignored if EC_USEFONTINFO is specified.
' Return:  N/A

%MEDM_GETMARGINS                = %WM_USER + &H1E&
' Purpose: gets the widths of the left and right margins.
' wParam:  N/A
' lParam:  N/A
' Return:  loword = width of left margin in pixels.
'          hiword = width of right margin in pixels.

' Masked Edit styles
' ------------------
%MEDS_LEFT                                     = &H0??
' Text is aligned on the left.  The control is filled from left to
' right.  Optional characters are represented in text retrieved from
' the control as trailing blanks.

%MEDS_CENTER                                   = &H1??
' Text is centered.  The control is filled from right to left.
' Optional characters are represented in text retrieved from the
' control as leading blanks.

%MEDS_RIGHT                                    = &H2??
' Text is aligned on the right.  The control is filled from right to
' left.  Optional characters are represented in text retrieved from
' the control as leading blanks.

%MEDS_AUTOTAB                                  = &H4??
' The next control in the tab order receives the input focus as
' soon as the control is filled with valid data by the user.

%MEDS_TABADVANCE                               = &H8??
' Pressing the Tab key within the control moves the caret to the
' next field and Shift+Tab moves the caret to the previous field.

%MEDS_ALLOWPROMPT                              = &H10??
' Allows the prompt character to be a valid input character.

%MEDS_PASSWORD                                 = &H20??
' Displays an asterisk "*" for each character typed into the edit control.
' The MEDM_SETPASSWORDCHAR message can be used to change the character that
' is displayed.

%MEDS_CLIPLITERALS                             = &H40??
' Literal characters in the input mask are not included when doing
' a cut or copy command.

%MEDS_AUTOHSCROLL                              = &H80??
' Automatically scrolls text to the right when the user types a character
' at the end of the line.  When this style is not set, the amount of text
' that can be entered into the control is limited by the size of its display
' area.
' The text is always scrollable when an input mask is defined.

%MEDS_SHOWSELALWAYS                            = &H100??
' Selected text remains highlighted even when the control loses the
' input focus.

%MEDS_AUTOSELECT                               = &H200??
' All text in the control is selected when the control gains the input
' focus.  If the MEDS_TABADVANCE style is set, all text in a field is
' selected when the Tab key is used to moved to the field.

%MEDS_AUTOSELECTFIELD                          = &H400??
' All text in a field is selected when the Tab key is used to move the
' caret to the field.

%MEDS_READONLY                                 = &H800??
' Prevents the user from editing or entering text in the control.  Text
' can still be selected and copied.

%MEDS_UNDERLINE                                = &H1000??
' The underline character is used as a placeholder for user input,
' and valid characters that are entered remain underlined.  If this
' style is not set, the prompt character disappears when a valid
' character is entered.

%MEDS_SILENT                                   = &H2000??
' The control does not beep when an error occurs.  If this style is
' not set, the control beeps whenever an error occurs.

DECLARE FUNCTION InitMaskEdit LIB "MASKED32.DLL" ALIAS "InitMaskEdit" () AS LONG

'###############################################################################
' END MaskedEdit_Class32
'###############################################################################
« Last Edit: August 04, 2007, 07:07:16 PM by Theo Gottwald »