Simple Tutorial - 3: TextBox

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 245 times
Been thanked: 91 times
Contact:

Simple Tutorial - 3: TextBox

Post by esgici » Fri Aug 01, 2008 1:01 am

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
Viva INTERNATIONAL HMG :D

Post Reply