Page 2 of 2

Re: TELEPHONE INPUTMASK IN A GRID

Posted: Fri Nov 05, 2010 9:15 am
by gfilatov
l3whmg wrote:Hi Rathi,
I'm sorry but I don't understand your replay or I write a bad English.
When I ask to you "What do you think" I'm referring to my contribute not to me :lol:
In too many forum I find people who answer without give a good contribute and when I writed
"you don't have solution with standard HMG (rel. 3) properties" I hope don't write a mistake :roll:
Hi Luigi,

Please be so kind to revise your updated sample below (especially mixed mask for field4):

Code: Select all

#include "minigui.ch"

/*.....................................................................
main function
.....................................................................*/
FUNCTION main()

SET CENTURY ON
SET DATE FORMAT "yyyy/mm/dd"

SET NAVIGATION EXTENDED

DefineForm()

ACTIVATE WINDOW MaiFrm

RETURN NIL

/*.....................................................................
define form
.....................................................................*/
STATIC FUNCTION DefineForm()

LOCAL aCol1 := {"TEXTBOX", "CHARACTER"}
LOCAL aCol2 := {"TEXTBOX", "NUMERIC", "999,999.99", "999,999.99"}
LOCAL aCol3 := {"TEXTBOX", "CHARACTER"}
LOCAL aCol4 := {"TEXTBOX", "DATE"}
LOCAL aCol5 := {"TEXTBOX", "CHARACTER", "(999) 999-9999"}
LOCAL aCol6 := {"TEXTBOX", "CHARACTER", "(999) 999-9999"}
LOCAL aGridHdr := { "Alphabetic", "Numeric", "AlphaNum", "Date", "NumForm", "NumForm2" }
LOCAL aGridWdt := { 100, 100, 100, 100, 100, 100 }
LOCAL aGridCls := { aCol1, aCol2, aCol3, aCol4, aCol5, aCol6 }
LOCAL aGridJst := { GRID_JTFY_LEFT, GRID_JTFY_RIGHT, GRID_JTFY_LEFT, GRID_JTFY_CENTER, GRID_JTFY_LEFT, GRID_JTFY_LEFT }
LOCAL aGridOrd := { { || ChgOrd(1)}, { || ChgOrd(2)}, { || ChgOrd(3)}, { || ChgOrd(4)}, { || ChgOrd(5)}, { || ChgOrd(6)} }

DEFINE WINDOW MaiFrm ;
  ROW 0 ;
  COL 0 ;
  WIDTH 750 ;
  HEIGHT 555 ;
  WINDOWTYPE MAIN ;
  TITLE "Input test" ;
  ON INIT MaiFrm_OnInit() ;
  FONT "Arial" SIZE 10

  DEFINE TEXTBOX Field1
   ROW 30
   COL 20
   HEIGHT 25
   WIDTH 150
   INPUTMASK "999,999.999"
   TOOLTIP "Numeric"
   ONENTER DsplInfo(1)
   DATATYPE NUMERIC
  END TEXTBOX
  DEFINE LABEL lb1
   ROW 30
   COL 200
   VALUE "Mask '999,999.999', DATATYPE NUMERIC declared. Without this you can't digit '.'"
   WIDTH 500
   HEIGHT 30
  END LABEL

  DEFINE TEXTBOX Field2
   ROW 90
   COL 20
   HEIGHT 25
   WIDTH 150
   INPUTMASK "(999) 999-9999"
   TOOLTIP "Numeric U.S. phone number"
   ONENTER DsplInfo(2)
  END TEXTBOX
  DEFINE LABEL lb2
   ROW 90
   COL 200
   VALUE "Mask '(999) 999-9999', no DATATYPE declared."
   WIDTH 500
   HEIGHT 30
  END LABEL

  DEFINE TEXTBOX Field3
   ROW 150
   COL 20
   HEIGHT 25
   WIDTH 150
   INPUTMASK "(AAA) AAA-AAAA"
   TOOLTIP "Character U.S. phone number"
   ONENTER DsplInfo(3)
  END TEXTBOX
  DEFINE LABEL lb3
   ROW 150
   COL 200
   VALUE "Mask '(AAA) AAA-AAAA', no DATATYPE declared."
   WIDTH 500
   HEIGHT 30
  END LABEL

  DEFINE TEXTBOX Field4
   ROW 210
   COL 20
   HEIGHT 25
   WIDTH 150
   INPUTMASK "(AAA) 999-9999"
   TOOLTIP "Mixed phone number"
   ONENTER DsplInfo(4)
  END TEXTBOX
  DEFINE LABEL lb4
   ROW 210
   COL 200
   VALUE "Mask '(AAA) 999-9999', no DATATYPE declared."
   WIDTH 500
   HEIGHT 30
  END LABEL

  DEFINE TEXTBOX Field5
   ROW 270
   COL 20
   HEIGHT 25
   WIDTH 150
   TOOLTIP "Free textbox"
   ONENTER DsplInfo(5)
   DATATYPE CHARACTER
  END TEXTBOX
  DEFINE LABEL lb5
   ROW 270
   COL 200
   VALUE "No Mask, DATATYPE CHARACTER declared."
   WIDTH 500
   HEIGHT 30
  END LABEL

  DEFINE GRID grid1
   ROW 330
   COL 20
   WIDTH 650
   HEIGHT 100
   HEADERS aGridHdr
   WIDTHS aGridWdt
   VALUE 1
   COLUMNCONTROLS aGridCls
   JUSTIFY aGridJst
   ONHEADCLICK aGridOrd
  END GRID

END WINDOW

RETURN NIL

/*.....................................................................
OnInit event
.....................................................................*/
STATIC FUNCTION MaiFrm_OnInit()

MaiFrm.Center

LoadDataIntoGrid()

MaiFrm.Field1.Value := 123456.789
MaiFrm.Field2.Value := "(123)45678909"
MaiFrm.Field3.Value := "(ABC) DEF-GHIJ"
MaiFrm.Field4.Value := "(ABC) 765-4321"

RETURN NIL

/*.....................................................................
display information about Field
.....................................................................*/
STATIC FUNCTION DsplInfo(Field)

LOCAL cField := "Field" + hb_ntos(Field)

MSGBOX( "ValType is " + VALTYPE( MaiFrm.&cField..Value ), "Type of value" )

IF VALTYPE( MaiFrm.&cField..Value )  == "C"
  MSGBOX( "Value is " + MaiFrm.&cField..Value , "Len is " + HB_VALTOEXP( LEN( MaiFrm.&cField..Value ) ) )
ELSE
  MSGBOX( "Value is " + HB_VALTOEXP( MaiFrm.&cField..Value ) )
ENDIF

RETURN NIL

/*.....................................................................
Load data into grid
.....................................................................*/
STATIC FUNCTION LoadDataIntoGrid()

MaiFrm.grid1.AddItem( {"aBcDeFgH",    123.45,  "3C7OU6",    DATE(), 1234567890, "(123) 456-7890" } )
MaiFrm.grid1.AddItem( {"d Value" ,  12354.67, "4Bc3oN3", DATE()-10, 4508123796, "(450) 812-3796" } )
MaiFrm.grid1.AddItem( {"b Value" , 543567.12, "2I5rh34", DATE()-20, 1357908642, "(135) 790-8642" } )

RETURN NIL

/*.....................................................................
Change Order
.....................................................................*/
STATIC FUNCTION ChgOrd( nOrder )

LOCAL aTemp := {}
LOCAL nX

FOR nX := 1 TO MaiFrm.grid1.ItemCount
  AADD( aTemp, MaiFrm.grid1.Item( nX ) )
NEXT nX

aTemp := ASORT( aTemp, , , { |a,b| a[nOrder] <= b[nOrder] } )

MaiFrm.grid1.DeleteAllItems

FOR nX := 1 TO LEN( aTemp )
  MaiFrm.grid1.AddItem( aTemp[nX] )
NEXT nX

MaiFrm.grid1.Value := 1

RETURN NIL
Hope that give you idea :idea:

Re: TELEPHONE INPUTMASK IN A GRID

Posted: Fri Nov 05, 2010 1:08 pm
by l3whmg
Hi Grigory,
many thank for your update and precision 8-)
It was my intention to give idea of a non formatted field; but these are not good days for my phrases and examples :mrgreen:

Ciao :D

Re: TELEPHONE INPUTMASK IN A GRID

Posted: Fri Nov 05, 2010 1:42 pm
by mrduck
I don't have code available for you since I never developed in these areas but I'd like to tell you something.
mexicanto wrote: 1.- how to capture an image from a web cam, and store it in a field in a database
There are tons of examples for other computer languages looking up in google. The problem is that you may need to write glue code... or you should look for a OLE object that you can handle from harbour...
2.- how to capture a fingerprint from a fingerprint reader and store it in a database, and later on check it
(is for a employee time card checking, lite a time clock), the example is for the employee to put the finger
in the fingerprint reader, and the program "check in" or "check out" the employee to later on print a time assistance
computing the hours worked
Fingerprint readers just don't take pictures, or, better said, they match fingerprints based on "minutiae" (vectors of the lines in the fingerprint) instead of images.
So you ask the reader to take the minutiae and store them in a database. When you have to check idendity you put the finger on the reader, the software reads and ask the "engine": who's the best match? In Italy, for example, you can have this system and you cannot store (and retrieve at will) fingerprint images.
So it is usually a "black box" and the professional software/hardware (usually is a bundle) used by law enforcement agencies costs a big BIG amount of money.
Since I saw this kind of access control used in a couple of sporting clubs in my area I think it's now a bit cheaper to have this features, but I want to warn you that I was able to be recognized only 50% of the times. I know 2 persons that are NEVER recognized by the scanner !!!(it depends on humidity on the finger)
3.- how to scan a document and store it in a data base, like id, or social security cards
You may also find references to wrapper code written by Pritpal of the EZTwain library (http://www.dosadi.com)


Anyway, I will never store images in the database, at least inside DBF files, because they are not good at this kind of data... I will probably use other storage methods, easier is a file on the file system with a pointer to it in the db.