Sign in to follow this  
Followers 0
huldu

GUICtrlRead, turns stuff into a string?

4 posts in this topic

I just found out that using GUICtrlRead, for example in GUICtrlCreateInput will turn what was typed in into a string. Ok nothing wrong with that!. What i was wondering how do i turn a string into a number.

I have a small script that waits for user to input a number. The user writes a number and press "accept" (everything works sofar). Now the problems starts, i made a check to see if the user wrote anything but numbers as a safety switch. The problem is this safety switch isnt letting the string thru, even tho its only numbers in it. I havent "programed" in years and dont remember anything, but i do recall something in C++ that could "convert" a string to int?.

So i was just wondering if there is any way to check a "string" for bogus letters, if any were found it would stop and error would pop up. However if only letters were found in the string it would turn the string into a "number" that IntNumber would let thru.

This maybe was a bit complicated, but im pulling my hair out trying to figure this one out and i dont have much hair left now lol.


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites



StringIsInt() and Number() sound like what you want.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Wait i maybe found the solution myself!

If i turned GUICtrlCreateInput("", 56, 176, 49, 21, -1, $WS_EX_CLIENTEDGE) into:

GUICtrlCreateInput("", 56, 176, 49, 21, -1, $ES_NUMBER)

It would only allow digits to be typed in? but it would still be a string of course, but if nothing but letters can be typed i guess thats good enough :P

Another thing, is it possible to add more then 1 "edit styles" to a control? like...

GUICtrlCreateInput("", 56, 176, 49, 21, -1, $ES_NUMBER, $WS_EX_CLIENTEDGE) ?

-- Wow you guys got the best reply speed ive ever seen on a forum!

Edited by huldu

"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
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
Sign in to follow this  
Followers 0