BCX_INPUT function

Purpose:

BCX_INPUT creates a single line edit text box.

Syntax:

hCtl = BCX_INPUT(Text AS STRING, _
             hwndParent AS HWND, _
              hCtlID AS INTEGER, _
                Xpos AS INTEGER, _
                Ypos AS INTEGER, _
               Width AS INTEGER, _
              Height AS INTEGER  _
         [, WinStyle AS INTEGER] _
       [, ExWinStyle AS INTEGER])

Return Value:

  • Data type: HWND
    hCtl ,Tte return value, is a handle of the new input box control if the function succeeds. If the function fails, the return value is NULL.

Parameters:

  • Data type: STRING
    Text Default string to be placed in input box control.
  • Data type: HWND
    hwndParent The handle of the parent window of the input box control being created.
  • Data type: INTEGER
    hCtlID Specifies the identifier of the input box control being created. The identifier is an integer value used by the input box control being created to notify its parent about events. The identifier must be unique for each control created with the same parent window.
  • Data type: INTEGER
    Xpos Specifies the initial horizontal x-coordinate value of the upper-left corner location of the input box control being created relative to the upper-left corner of the parent window's client area.
  • Data type: INTEGER
    Ypos Specifies the initial vertical y-coordinate value of the upper-left corner location of the input box control being created relative to the upper-left corner of the parent window's client area.
  • Data type: INTEGER
    Width Specifies the width, in device units or, if the PIXELS optional parameter was specified in the GUI statement, in pixels, of the input box control being created.
  • Data type: INTEGER
    Height Specifies the height, in device units or, if the PIXELS optional parameter was specified in the GUI statement, in pixels, of the input box control being created.
  • Data type: INTEGER
    WinStyle [OPTIONAL] If the WinStyle parameter is used, the default Window Style for a BCX_INPUT control, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT, is replaced with the value in WinStyle. For more information, visit the Microsoft Edit Control Styles webpage and the Microsoft Window Styles webpage.
  • Data type: INTEGER
    ExWinStyle [OPTIONAL] The default Extended Window Style for a BCX_INPUT control is WS_EX_CLIENTEDGE. For more information, visit the Microsoft Extended Window Styles webpage.

Remarks:

The default window Style for a BCX_INPUT control also can be changed by using the MODSTYLE function.

Example:

GUI "BCX_INPUT", PIXELS
 
GLOBAL Form1 AS HWND
GLOBAL Inpbox1 AS HWND
GLOBAL Inpbox2 AS HWND
GLOBAL Message$ AS STRING
 
SUB FORMLOAD
  Form1 = BCX_FORM("BCX_INPUT", 0, 0, 250, 120)
  Inpbox1 = BCX_INPUT("Move cursor here then press Enter", Form1, 998, 20, 20, 200, 20)
  Inpbox2 = BCX_INPUT("Or move cursor here then press Enter", Form1, 999, 20, 50,  200, 20)
  CENTER(Form1)
  SHOW(Form1)
END SUB
 
BEGIN EVENTS
  SELECT CASE CBMSG
  CASE WM_COMMAND
    IF wParam = 1 AND lParam = 0 THEN
      'If cursor has been moved to Inpbox1 and keyboard Enter pressed. 
      IF GetFocus() = Inpbox1 THEN
        Message$ = BCX_GET_TEXT$(Inpbox1)
        MSGBOX "BCX_INPUT_1 has contents: " & Message$
      END IF
      'If cursor has been moved to Inpbox2 and keyboard Enter pressed. 
      IF GetFocus() = Inpbox2 THEN
        Message$ = BCX_GET_TEXT$(Inpbox2)
        MSGBOX "BCX_INPUT_2 has contents: " & Message$
      END IF
    END IF
  END SELECT
END EVENTS

For another example of the BCX_INPUT function see Amort.bas in the BCX\Gui_Demo\Amort directory.