Jump to content

[SOLVED] GUICtrlCreateInput converting numbers to scientific notation


Recommended Posts

Hi!

I feel a bit stupid asking this, I'm sure I'm missing something obvious.

I want to update a GUICtrlCreateInput control with a number from a variable containing a decimal point e.g. 0.0000001 using GUICtrlSetData

When I do this, the input automatically converts it to 1e-007

Converting it to string doesn't stop this either.

Reproducer:

GUICreate("", 271, 100)
$Input1 = GUICtrlCreateInput("Input1", 32, 10, 201, 21)
$Input2 = GUICtrlCreateInput("Input1", 32, 40, 201, 21)
$Input3 = GUICtrlCreateInput("Input1", 32, 70, 201, 21)

$i = 0.0000001
GUICtrlSetData($Input1,$i)
GUICtrlSetData($Input2,String($i))
GUICtrlSetData($Input3,"0.0000001")

GUISetState()
Do
Until GUIGetMsg() = -3

Thankyou in advance!

[EDIT]

-clarification

Edited by andybiochem
- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
Link to comment
Share on other sites

Try this.

GUICreate("", 271, 100)
Local $Input1 = GUICtrlCreateInput("Input1", 32, 10, 201, 21)

Local $i = 0.0000001
Local $sFloat = StringRegExpReplace(StringFormat("%.15f", String($i)), "(0*$)", "")
;ConsoleWrite($sFloat & @CRLF)
GUICtrlSetData($Input1, $sFloat)

GUISetState()
Do
    Sleep(10)
Until GUIGetMsg() = -3

Edit: See BigNum.au3

Edited by Malkey
Link to comment
Share on other sites

Local $i = 0.0000001

Local $sFloat = StringRegExpReplace(StringFormat("%.15f", String($i)), "(0*$)", "")

Thanks for that! I found a way, but this is simpler.

This has caused me a really big headache. :D

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...