numeric textbox with decimals

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

numeric textbox with decimals

Post by ROBROS »

Hi friends,
I know there are a lot of posts concerning textbox-control with numeric inputmask. I have not really found a solution to satisfy me. In my textbox the monthly wage of an employee is to be entered, of course with 2 decimals.
My approach is: I don't give the user one numeric textbox with 2 decimals, but 2 numeric textboxes without decimals,one for the euros (€) and one for the cents.

Regards
Robert
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: numeric textbox with decimals

Post by dragancesu »

Why not one textbox?

Code: Select all

  @ 290, 100 TEXTBOX mSalary      WIDTH 120 NUMERIC INPUTMASK "999,999.99" ON ENTER valid_sal()  ON LOSTFOCUS valid_sal() 
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: numeric textbox with decimals

Post by esgici »

ROBROS wrote: Sun Feb 09, 2020 9:30 pm Hi friends,
I know there are a lot of posts concerning textbox-control with numeric inputmask. I have not really found a solution to satisfy me. In my textbox the monthly wage of an employee is to be entered, of course with 2 decimals.
My approach is: I don't give the user one numeric textbox with 2 decimals, but 2 numeric textboxes without decimals,one for the euros (€) and one for the cents.

Regards
Robert
Hi Robert

You can find additional info and samples at https://vivaclipper.wordpress.com/2011/ ... x-control/

Happy HMG'ing
Viva INTERNATIONAL HMG :D
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: numeric textbox with decimals

Post by mustafa »

Hi friend ROBROS

For EURO decimals ---> € I am using TRANSFORM
sample:
BnValue: = 1,542.25
BComa: = TRANSFORM (BnValue , "@ E 9,999,999.99")
BComa: = 1.542,25 €
Look at the Sample

  "Invoice_HPDPRINT_New.zip"

   viewtopic.php?f=5&t=3706&start=10

look at this one

"Button_Bases_Up-Down.zip"
  viewtopic.php?f=12&t=5748&p=55943&hilit=euro#p55943

Regards /Saludos :idea:

Mustafa
Last edited by mustafa on Wed Feb 12, 2020 8:35 am, edited 1 time in total.
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: numeric textbox with decimals

Post by ROBROS »

Hi friends,
thx for all your replies, but the issue is the user interface (the user must type in the value):
the format clause has one drawback: eg the picture clause accepts 4 digits, but only 3 digits are to be entered, the user would have to type a leading zero to go to the decimals ore use the arrow key.
numeric without format drawback: in Germany and in many continental european countries the decimal separator is comma ',' , data entry with comma for decimals are ignored.

Former user raumi had a post concerning this problem.

OT: for nostalgic reasons, please allow me to show you photos of a quick and dirty dos-program (I found no way to make screenshots of Dosbox for Linux). In 2002 the € was introduced. In the company I was employed until I retired in October 2018, customers came to buy and payed cash. So we had 3 currencies: Old German "DM und Pfennig", Old Austrian "Schilling and Groschen" and New "€ und Cents".
The invoice was in new €. But the old currencies still were valid and we were obliged to accept them. My program, written in Dbase 5.1 for Dos had those features:
You typed in the € value.
The program told you how much you had to pay in € ,DM or AT. Every time you typed in how much you got cash in either DM, ATS or € the missing value (if any) changed in €, DM or ATS. You could even overpay, the change was calculated in €.
I was very proud of my prog and the workmates were very happy with that tool.

3 weeks later, the program was no longer needed, the € had taken over. But my workmates never forgot this helpful program.

Long live HMG
Robert

EDIT: I just see, some LF's are not performed in DOSBOX for Linux :(
Attachments
currency_02.jpg
currency_02.jpg (1.07 MiB) Viewed 1850 times
currency_01.jpg
currency_01.jpg (1.03 MiB) Viewed 1850 times
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

Re: numeric textbox with decimals

Post by jairpinho »

ROBROS wrote: Tue Feb 11, 2020 9:24 pm Hi friends,
thx for all your replies, but the issue is the user interface (the user must type in the value):
the format clause has one drawback: eg the picture clause accepts 4 digits, but only 3 digits are to be entered, the user would have to type a leading zero to go to the decimals ore use the arrow key.
numeric without format drawback: in Germany and in many continental european countries the decimal separator is comma ',' , data entry with comma for decimals are ignored.

Former user raumi had a post concerning this problem.

OT: for nostalgic reasons, please allow me to show you photos of a quick and dirty dos-program (I found no way to make screenshots of Dosbox for Linux). In 2002 the € was introduced. In the company I was employed until I retired in October 2018, customers came to buy and payed cash. So we had 3 currencies: Old German "DM und Pfennig", Old Austrian "Schilling and Groschen" and New "€ und Cents".
The invoice was in new €. But the old currencies still were valid and we were obliged to accept them. My program, written in Dbase 5.1 for Dos had those features:
You typed in the € value.
The program told you how much you had to pay in € ,DM or AT. Every time you typed in how much you got cash in either DM, ATS or € the missing value (if any) changed in €, DM or ATS. You could even overpay, the change was calculated in €.
I was very proud of my prog and the workmates were very happy with that tool.

3 weeks later, the program was no longer needed, the € had taken over. But my workmates never forgot this helpful program.

Long live HMG
Robert

EDIT: I just see, some LF's are not performed in DOSBOX for Linux :(

hello, try this function should help

Code: Select all

*************************************************************************************************************************************
Function Moeda_VAR(nVar)
*************************************************************************************************************************************
  
  cTotal := ALLTRIM(TransForm( nVar , "9999,999.99"))
 //Msginfo("nVar Entrada " + cTotal ) 
 
  IF LEN(cTotal) <= 6 
    cTotal := Alltrim(StrTran( cTotal , ",", "." ,1,1 ))
  ENDIF
  
  IF LEN(cTotal) >= 7
    cTotal := Alltrim(StrTran( cTotal , ",", "." ,1,1 ))
    cTotal := Alltrim(StrTran( cTotal , ".", "," ,1,1 ))
  ENDIF
     // Msginfo("nVar saida " + cTotal )
Return(Val(cTotal))
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: numeric textbox with decimals

Post by mustafa »

Hello friends:
The solution provided by Jair Pinho
I tried it and it came out perfect

viewtopic.php?f=37&t=5612&p=58697&hilit ... nho#p58697

Regards /Obrigado /Saludos :idea:
Post Reply