TextBox Control

HMG Tutor 4

Getting data from the user (TextBox Control)

The TextBox control is the main way to obtain data from the user.

@ 40 , 120 TEXTBOX Text_1

If you want to get numeric data, just add NUMERIC clause:

@ 80 , 120 TEXTBOX Text_2 NUMERIC

If you want to indicate an editing mask, you can use the INPUTMASK clause.

@ 120 , 120 TEXTBOX Text_2 NUMERIC INPUTMASK '9999.99'

#include "hmg.ch"
Function Main
DEFINE WINDOW Win_1 ;
  AT 0,0 ;
  WIDTH 400 ;
  HEIGHT 300 ;
  TITLE 'Tutor 04 TextBox Test' ;
  MAIN
  DEFINE MAIN MENU
    POPUP "First Popup"
       ITEM 'Change TextBox Content' ACTION  ;
             Win_1.Text_1.Value := 'New TextBox Value'
       ITEM 'Retrieve TextBox Content' ACTION  ;
             MsgInfo ( Win_1.Text_1.Value)
       SEPARATOR
       ITEM 'Change Numeric TextBox Content' ACTION  ;
             Win_1.Text_2.Value := 100
       ITEM 'Retrieve Numeric TextBox Content' ACTION ; 
             MsgInfo ( Str(Win_1.Text_2.Value))
       SEPARATOR
       ITEM 'Change Numeric (InputMask) TextBox Content' ACTION ;
             Win_1.Text_3.Value := 1234.12
       ITEM 'Retrieve Numeric (InputMask) TextBox Content' ACTION ;
             MsgInfo ( Str(Win_1.Text_3.Value))
    END POPUP
  END MENU
  @  40 , 120 TEXTBOX Text_1
  @  80 , 120 TEXTBOX Text_2 NUMERIC
  @ 120 , 120 TEXTBOX Text_3 NUMERIC INPUTMASK '9999.99'
END WINDOW
ACTIVATE WINDOW Win_1
Return

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.