Computer Science Canada How to Limit a String? for a calculator |
Author: | Sceyef [ Sat Dec 27, 2014 1:00 pm ] |
Post subject: | How to Limit a String? for a calculator |
I am making a calculator. It's the basic Windows Calculator. With +-*/ so like, calculators have limits to how large numbers can be in terms of length how do i make that limit? I use Draw.Font to show the calculator's screen. GUI buttons run a procedure to add a character to the string in Draw.Font, for example clicking button with 2 will add "2". |
Author: | Insectoid [ Sun Dec 28, 2014 1:08 am ] |
Post subject: | RE:How to Limit a String? for a calculator |
You're going to have to get the length of the string. You don't need any special commands to do this (an integer that increments every time a number button is pushed will work) but you can use the Length() function as well. Now that you can get the length, you can figure out how to stop the buttons from working if the string is too long. |
Author: | Sceyef [ Sun Dec 28, 2014 4:19 pm ] |
Post subject: | RE:How to Limit a String? for a calculator |
Thanks a lot. |