Hello and thanks for reading.
For my first project in Revolution (technically my second, I have made a guessing game), I figured I would try out a calculator, looking very similar to the standard Windows calculator. I figured that I would treat the output of the calculator (the field) as a string that could be converted to a real value when performing math, making it easier to make something like "4" into "40".
This being my first real project, I know very little commands (but I do know the syntax), so I have a few questions to ask.
-How do I make it so that the user cannot type into the output field? Is this possible in the inspector somewhere?
-How do I add one string value to the end of another? When trying the add command, even while using parentheses with the numbers, it treats them as integers and adds them mathematically.
-How do I convert a real/integer to a string, and vice versa?
Thanks for reading,
Patrick
String and field commands
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: String and field commands
1. Yes, in the Inspector, "Lock Text" checkbox
2. put newChar after myString
or: put oldString & newChar into newString
3. Type conservation is automatic (it happens when needed, or it can be forced with +0 or &"") but remember to filter input to avoid errors!
2. put newChar after myString
or: put oldString & newChar into newString
3. Type conservation is automatic (it happens when needed, or it can be forced with +0 or &"") but remember to filter input to avoid errors!
Best wishes,
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/
Re: String and field commands
Curry is correct on all three counts, I am just going to expand a bit:
1- Read about the "lockText" property. And yes, this is settable in the inspector.
2- Go to the dictionary and enter "&". You will be "concatenating". Check out "&&".
3- This is pretty automatic. The engine interprets numbers and strings purely based on context, typing on the fly. So if you say:
"put 2 + 2 into total", you will get a "4". If you say "put 2 + x into total" you will get an error. The only time you ever need to worry about such things is when you want to control the way output is displayed. Read about "format" and "numberFormat".
Ask anything.
Craig Newman
1- Read about the "lockText" property. And yes, this is settable in the inspector.
2- Go to the dictionary and enter "&". You will be "concatenating". Check out "&&".
3- This is pretty automatic. The engine interprets numbers and strings purely based on context, typing on the fly. So if you say:
"put 2 + 2 into total", you will get a "4". If you say "put 2 + x into total" you will get an error. The only time you ever need to worry about such things is when you want to control the way output is displayed. Read about "format" and "numberFormat".
Ask anything.
Craig Newman