Page 1 of 1

Simple Tutorial - 3: TextBox

Posted: Fri Aug 01, 2008 1:01 am
by esgici
Simple tutorial based upon HMG Offical Tutorial for beginners.

Getting data from the user : The TextBox Control

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

Code: Select all

@ 40 , 120 TEXTBOX Text_1
If you want to get numeric data, just add NUMERIC clause:

Code: Select all

@ 80 , 120 TEXTBOX Text_2 NUMERIC
If you want to indicate an editing mask, you can use the INPUTMASK clause.

Code: Select all

@ 120 , 120 TEXTBOX Text_2 NUMERIC INPUTMASK '9999.99
'

Code: Select all

#include "minigui.ch"

Function Main

  DEFINE WINDOW Win_1 ;
    AT 0,0 ;
    WIDTH 400 ;
    HEIGHT 300 ;
    TITLE 'TextBox' ;
    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

  CENTER   WINDOW Win_1
  ACTIVATE WINDOW Win_1

Return
Image

Regards

esgici