Hex View

Hexadecimal file viewer.

This is a experimental project with first intend of point out the power of Harbour and HMG. So, HexView is considerably slow on large files, please be patient.

Download here ( source only ).

Message multiple values

MsgMulti ( aka MsM) is a message function accept multiple and any type of data.

Download here ( source only ).

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


Data entry boxes

HMG Tutor 21 — Data-Controls II:

TEXTBOX, DATEPICKER, CHECKBOX, EDITBOX

The ‘data-version’ of these controls required the use of the following properties / methods to bound them to a database field:

Field Property: Stablishes the field that control is bounded to.
Refresh Method: Updates control content based on current field content.
Save method: Updates database file according control content.

#include "hmg.ch"

Function Main
DEFINE WINDOW Win_1 ;
   AT 0,0 ;
   WIDTH 640 ;
   HEIGHT 480 ;
   TITLE 'Tutor 21: Data-Bound Controls Test' ;
   MAIN ;
   ON INIT OpenTables() ;
   ON RELEASE CloseTables()

   DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 100,30 FLAT RIGHTTEXT BORDER

      BUTTON TOP ;
         CAPTION '&Top' ;
         PICTURE 'primero.bmp' ;
         ACTION ( DbGoTop() , Refresh() )

      BUTTON PREVIOUS ;
         CAPTION '&Previous';
         PICTURE 'anterior.bmp' ;
         ACTION ( DbSkip(-1) , Refresh() )

      BUTTON NEXT ;
         CAPTION '&Next';
         PICTURE 'siguiente.bmp' ;
         ACTION ( DbSkip(1) , if ( eof() , DbGoBottom() , Nil ) , Refresh() )

      BUTTON BOTTOM ;
         CAPTION '&Bottom' ;
         PICTURE 'ultimo.bmp' ;
         ACTION ( DbGoBottom() , Refresh() )

      BUTTON SAVE ;
         CAPTION '&Save' ;
         PICTURE 'guardar.bmp' ;
         ACTION ( Save() , Refresh() )

      BUTTON UNDO ;
         CAPTION '&Undo' ;
         PICTURE 'deshacer.bmp' ;
         ACTION ( Refresh() )

   END TOOLBAR

   @  50,10 LABEL LABEL_1 VALUE 'Code:'
   @  80,10 LABEL LABEL_2 VALUE 'First Name'
   @ 110,10 LABEL LABEL_3 VALUE 'Last Name'
   @ 140,10 LABEL LABEL_4 VALUE 'Birth Date:'
   @ 170,10 LABEL LABEL_5 VALUE 'Married:'
   @ 200,10 LABEL LABEL_6 VALUE 'Bio:'

   @ 50,200 TEXTBOX TEXT_1;
            FIELD TEST->CODE ;
            NUMERIC ;
            MAXLENGTH 10

   @ 80,200 TEXTBOX TEXT_2;
            FIELD TEST->FIRST ;
            MAXLENGTH 30

   @ 110,200 TEXTBOX TEXT_3;
             FIELD TEST->LAST ;
             MAXLENGTH 30

   @ 140,200 DATEPICKER DATE_4 ;
             FIELD Test->Birth

   @ 170,200 CHECKBOX CHECK_5 ;
             CAPTION '' ;
             FIELD Test->Married

   @ 200,200 EDITBOX EDIT_6 ;
             FIELD Test->Bio ;
             HEIGHT 100

END WINDOW

Win_1.Text_1.SetFocus

ACTIVATE WINDOW Win_1

Return Nil

Procedure Refresh
   Win_1.Text_1.Refresh
   Win_1.Text_2.Refresh
   Win_1.Text_3.Refresh
   Win_1.Date_4.Refresh
   Win_1.Check_5.Refresh
   Win_1.Edit_6.Refresh
   Win_1.Text_1.SetFocus
Return

Procedure Save
   Win_1.Text_1.Save
   Win_1.Text_2.Save
   Win_1.Text_3.Save
   Win_1.Date_4.Save
   Win_1.Check_5.Save
   Win_1.Edit_6.Save
Return

Procedure OpenTables
   USE TEST
Return
Procedure CloseTables
   USE
Return

Data-Bound GRID

HMG Tutor 20

Data-Controls I: DATA-BOUND GRID

Data controls are designed to handle data in .dbf files directly.

Grid control allows to show / edit database records in tabular format.
‘RecNo’ property is use to set / get the selected record number (recno()).

#include "hmg.ch"
Function Main
   OpenTables()
   DEFINE WINDOW Win_1 ;
      AT 0,0 ;
      WIDTH 640 HEIGHT 480 ;
      TITLE 'Tutor 20: BROWSE Test' ;
      MAIN NOMAXIMIZE
      DEFINE MAIN MENU

         POPUP 'File'
            ITEM 'Set Grid RecNo' ACTION ;
                 Win_1.Grid_1.Value := Val ( InputBox ('Set Grid RecNo','') )
            ITEM 'Get Grid RecNo' ACTION ;
                 MsgInfo ( Str ( Win_1.Grid_1.RecNo ) )
            SEPARATOR
            ITEM 'Exit' ACTION Win_1.Release
         END POPUP

         POPUP 'Help'
             ITEM 'About' ACTION MsgInfo ("Tutor 20: GRID Test")
        END POPUP
      END MENU

      @ 10,10 GRID Grid_1 ;
              WIDTH 610 ;
              HEIGHT 390 ;
              HEADERS { 'Code' , 'First Name' , 'Last Name', ;
                         'Birth Date', 'Married' , 'Biography' } ;
              WIDTHS { 150 , 150 , 150 , 150 , 150 , 150 } ;
              ROWSOURCE "Test" ;
              COLUMNFIELDS { 'Code' , 'First' , 'Last' , 'Birth' , ;
                             'Married' , 'Bio' } ;
              ALLOWDELETE ;
              ALLOWEDIT
   END WINDOW

   CENTER WINDOW Win_1

   ACTIVATE WINDOW Win_1

Return Nil

Procedure OpenTables()
   Use Test
   Win_1.Browse_1.Value := RecNo()
Return Nil

Procedure CloseTables()
   Use
Return Nil

StatusBar Control

HMG Tutor 19

Showing Status (Statusbar Control)

This control creates a bar at window’s bottom, used to show information (usually status information)

#include "hmg.ch"
Function Main
DEFINE WINDOW Win_1 ;
   AT 0,0 ;
   WIDTH 400 ;
   HEIGHT 200 ;
   TITLE 'Tutor 19 StatusBar Test' ;
   MAIN

   DEFINE MAIN MENU
      POPUP '&StatusBar Test'
         ITEM 'Set Status Item 1' ACTION ;
               Win_1.StatusBar.Item(1) := "New value 1"
         ITEM 'Set Status Item 2' ACTION ;
               Win_1.StatusBar.Item(2) := "New value 2"
      END POPUP
   END MENU

   DEFINE STATUSBAR
      STATUSITEM "Item 1" ACTION MsgInfo('Click! 1')
      STATUSITEM "Item 2" WIDTH 100 ACTION MsgInfo('Click! 2')
      CLOCK
      DATE
      STATUSITEM "Item 5" WIDTH 100
   END STATUSBAR

END WINDOW

ACTIVATE WINDOW Win_1

Return

ToolBar Control

HMG Tutor 18

More Organization (TOOLBAR Control)

Toolbars are used to group command buttons in a bar located (usually) at window top (under main menu bar).

#include "hmg.ch"
Function Main
DEFINE WINDOW Win_1 ;
   AT 0,0 ;
   WIDTH 640 HEIGHT 480 ;
   TITLE 'Tutor 18: ToolBar Test' ;
   MAIN ;
   FONT 'Arial' SIZE 10
   DEFINE MAIN MENU
      POPUP '&File'
         ITEM '&Disable ToolBar Button' ACTION ;
               Win_1. ToolBar_1.Button_1.Enabled := .F.
         ITEM '&Enable ToolBar Button' ACTION ;
               Win_1. ToolBar_1.Button_1.Enabled := .T.
         ITEM '&Exit' ACTION Win_1.Release
      END POPUP
   END MENU
   DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 80,80 FLAT BORDER
      BUTTON Button_1 ;
         CAPTION '&Button &1' ;
         PICTURE 'button1.bmp' ;
         ACTION MsgInfo('Click! 1')
      BUTTON Button_2 ;
         CAPTION '&Button 2' ;
         PICTURE 'button2.bmp' ;
         ACTION MsgInfo('Click! 2') ;
         SEPARATOR
      BUTTON Button_3 ;
         CAPTION 'Button &3' ;
         PICTURE 'button3.bmp' ;
         ACTION MsgInfo('Click! 3')
    END TOOLBAR
END WINDOW
CENTER WINDOW Win_1
ACTIVATE WINDOW Win_1
Return Nil