HMG Samples

About HMG Samples

Language Related

 Arrays

Array Arithmetic

Load / Save ANY array

Conversion

DOS -> Windows Character Conversion

National Issues

National Alternate Collating Sequence

National Change Case

 Windows

Tracking Mouse

Controls

Browse

Quick Search    

Combo box

Dynamic ComboBox

Edit Box

Word wrap in EditBox

 Grid

Get Data Into Grid via IDE

Text Box

Auto fill in text box

Search in and Fill Box (SFilBox) 

Tree

Tree Menu

Two Methods for Tree

Functions

 Drives, Directories and Files

Drives and Directories

Directory List

Fill Directory List

PutFile() with default file name

Messages

HMG Message Functions

Message for multiple values

Message Extended

Where Is It ?

Improvements in Message functions

Miscellaneous

Is application running ?

Get Process ID

Simple Error Handling

Funny

Cuckoo Clock

Untouchable window

Warn Lazy User

Pegs Game

Drawing

Play Draw

Draw Border

Printing

 Text Mode

Using printer under Windows 

Obsolete ways

Send to File

Print File

GUI Mode

HMG Print

 HMG Print ( Mini Print ) for beginners in 10 easy steps

Print a plain text file by HMG Print – 1

HMG Report

HMG HPDF

HMG_HPDF — Bill

Unicode

HMG Unicode

Utilities

Color Codes

DB Validate 

Hex View

Mini Agenda

DBA : Data Base Assistant

Low-Level DBU

x-Base Modul List

Mini Search Machine (2014) 

Word wrap in EditBox

EDITBOX control doesn’t have a WORD-WRAP property but has this feature via HSCROLLBAR property.

Look at the sample :

/*
*  HMG – Harbour Win32 GUI library Demo
*
*  Copyright 2010 Roberto Lopez
*
HMG official EDITBOX demo slightly modified to demonstrate effect of HSCROLLBAR property.

*/

#include "hmg.ch"
Function Main
   LOCAL cTestText := STRTRAN( TestText(), CRLF, '' ) 

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 640 HEIGHT 480 ;
      TITLE 'HMG EditBox!! Demo' ;
      MAIN 

      ON KEY ESCAPE ACTION Form_1.Release
      DEFINE STATUSBAR
         STATUSITEM 'HMG Power Ready!' 
      END STATUSBAR
      @ 30,10 EDITBOX Edit_1 ;
        WIDTH 600 ;
        HEIGHT 170 ;
        VALUE cTestText ;
        TOOLTIP 'EDITBOX with HSCROLLBAR is .T.'
      @ 230,10 EDITBOX Edit_2 ;
        WIDTH 600 ;
        HEIGHT 170 ;
        VALUE cTestText ;
        TOOLTIP 'EDITBOX with HSCROLLBAR is .F.' ;
        NOHSCROLL
  END WINDOW
  Form_1.Center()
  Form_1.Activate()

Return Nil
FUNCTION TestText()
    RETURN "HMG 2.0 ALPHA BUILD 004 Changelog: "+;
           "- New: Cell ( nRow , nCol ) property for GRID control (read(write). "+;
           "- New: Edit routines for GRID control. Editing is now 'in-cell'. "+;
           "- New: 'DynamicForeColor' / 'DynamicBackColor' properties for GRID "+;
           "control. Codeblock array (one element per column) evaluated "+;
           "for each cell at any grid change. "+;
           "This.CellRowIndex, This.CellColIndex and This.CellValue variables are "+;
           "available at codeblock evaluation. "+;
           "Sample: "+;
           "bColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , ; "+;
           "RGB (128,128,128) , RGB (192,192,192) ) } "+;
           "DYNAMICBACKCOLOR { bColor , bColor, bColor, bColor, bColor, bColor } "+;
           "See \hmg\samples\grid\grid_10 "+;
           "\hmg\samples\grid\grid_11 "+;
           "\hmg\samples\grid\grid_12 "

SplitBox Control

HMG Tutor 22

More Organization II (SPLITBOX Control)

Controls defined as part of this container can be arranged by users, using a gripper-bar located at control’s left side. You must omit ‘@,’ in control definition.

#include "hmg.ch"

Function Main

   DEFINE WINDOW Win_1 ; 
      AT 0,0 ;
      WIDTH 640  HEIGHT 450 ;
      TITLE 'Tutor 22: SplitBox Test' ;
      MAIN

      DEFINE SPLITBOX

         LISTBOX List_1 ;
            WIDTH 200 ;
            HEIGHT 400 ;
            ITEMS {'Item 1','Item 2','Item 3','Item 4','Item 5'} ;
            VALUE 3 ;
            TOOLTIP 'ListBox 1'

         EDITBOX Edit_1 ;
            WIDTH 200 ;
            HEIGHT 400 ;
            VALUE 'EditBox!!' ;
            TOOLTIP 'EditBox' ;
            MAXLENGTH 255

      END SPLITBOX

   END WINDOW

   CENTER WINDOW Win_1

   ACTIVATE WINDOW Win_1

Return Nil


EditBox Control

HMG Tutor 13

Getting Large Text (The EditBox Control)

 

The EditBox control allows to handle large (multiline) text data.

@ 10,10 EDITBOX Edit_1 ;
        WIDTH 300 ;
        HEIGHT 150

#include "hmg.ch"
Function Main
DEFINE WINDOW Win_1 ;
   AT 0,0 ;
   WIDTH 400 ;
   HEIGHT 300 ;
   TITLE 'Tutor 13 EditBox Test' ;
   MAIN
   DEFINE MAIN MENU
      POPUP "First Popup"
         ITEM 'Change EditBox Content' ACTION  ;
               Win_1.Edit_1.Value := 'New EditBox Value'
         ITEM 'Retrieve EditBox Content' ACTION  ;
               MsgInfo ( Win_1.Edit_1.Value)
      END POPUP
   END MENU
   @ 10,10 EDITBOX Edit_1 ;
           WIDTH 300 ;
           HEIGHT 150
END WINDOW
ACTIVATE WINDOW Win_1
Return