Hi,
I've been studying the field commands and example in the manual (5.8) but am getting a bit confused. The example runs on my iPhone, but its overly complicated for my needs.
I just need to input some text into a box, and capture the data in a string.
Can anyone point me to a simple example anywhere please?
Many thanks,
Paul
field examples
-
- Posts: 19
- Joined: Mon Jan 21, 2019 9:27 pm
- My devices: iPhone SE
- Flag:
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: field examples
Here's one I whipped up just for you.
Code: Select all
N$="test" 'name of field
GRAPHICS
GRAPHICS CLEAR 1,1,1
DRAW COLOR 0,0,0
DRAW TEXT "What is your name?" at 200,120
DRAW TEXT "Press return when ready" at 200,160
FIELD N$ TEXT "" AT 200,200 SIZE 300,50
FIELD N$ SELECT 0
DO SLOWDOWN
UNTIL FIELD_CHANGED (N$)
DRAW TEXT "Hi, "& FIELD_TEXT$(N$)&". Nice to meet you." AT 200,280
PAUSE 3
END
- Attachments
-
- F76F7C3E-0ACE-4FB1-87C7-BC19F651555B.png (79.62 KiB) Viewed 8879 times
Last edited by rbytes on Tue Mar 26, 2019 3:34 pm, edited 1 time in total.
The only thing that gets me down is gravity...
-
- Posts: 19
- Joined: Mon Jan 21, 2019 9:27 pm
- My devices: iPhone SE
- Flag:
Re: field examples
Wow!
Thanks AGAIN rbytes - and such a speedy response!
That is EXACTLY what I needed. Do you know if there are any documents with simple examples Iike these for beginners like me? I can get my head around these code snippets much more than those containing functions etc... Once I've grasped the basics, then the more complicated stuff is easier to follow.
Perhaps its just me who struggles, but your simplified examples really help! Maybe there is a gap in the current documentation that we could gradually plug with these code snippets?
Thanks again,
Paul
Thanks AGAIN rbytes - and such a speedy response!
That is EXACTLY what I needed. Do you know if there are any documents with simple examples Iike these for beginners like me? I can get my head around these code snippets much more than those containing functions etc... Once I've grasped the basics, then the more complicated stuff is easier to follow.
Perhaps its just me who struggles, but your simplified examples really help! Maybe there is a gap in the current documentation that we could gradually plug with these code snippets?
Thanks again,
Paul
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: field examples
There are a couple of places to look for examples. Have you tried the Libraries folder in Basic Programs? Many of the posts are about one single command or function. We could also use the Basic Docs and Books section to post some examples.
The only thing that gets me down is gravity...
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: field examples
Mr. K, the example I gave in this thread should probably be move to For Beginners
The only thing that gets me down is gravity...
Re: field examples
Can anyone explain to me what the do slowdown is for?
Is it anything to do with why In my very very simple first program (a useless program just trying to get to grips with this language) the button press is glitchy, doesn't always seem to "take".
36 BUTTON "again" Title "GO" AT 100,50
37 IF BUTTON_PRESSED ("again") THEN GOTO 15
38 GOTO 37
Does this artless loop happen so fast that the input isn't always registered ?
Is it anything to do with why In my very very simple first program (a useless program just trying to get to grips with this language) the button press is glitchy, doesn't always seem to "take".
36 BUTTON "again" Title "GO" AT 100,50
37 IF BUTTON_PRESSED ("again") THEN GOTO 15
38 GOTO 37
Does this artless loop happen so fast that the input isn't always registered ?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: field examples
That's fine, but about 1 time in 4 nothing happens on pressing the button even when the button changes colour on being touched.
I figure it must be something I'm doing wrong but there is no apparent pattern to it that would be a clue
I figure it must be something I'm doing wrong but there is no apparent pattern to it that would be a clue
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: field examples
There are many examples of buttons usage in Examples folder in the smart BASIC app.
You can check them to see how they work.
- GeorgeMcGinn
- Posts: 435
- Joined: Sat Sep 10, 2016 6:37 am
- My devices: IPad Pro 10.5in
IMac
Linux i386
Windows 7 & 10 - Location: Venice, FL
- Flag:
- Contact:
Re: field examples
I think if you put SLOWDOWN in your code, it should work.
SLOWDOWN does what it says, slows down the CPU and is used exactly for code like keystroke captures or button presses.
Here is the HELP on it:
SLOWDOWN
makes CPU idle for a short time period, thus reducing power consumption. This command can be used in waiting cycles, for example when waiting for button press, and also in looping places where execution speed is not as important as low power consumption. For example, this program uses CPU at 100% while performing simple looping:
1 GOTO 1
and this program leaves CPU almost idle although looping much slower because of short CPU pause in SLOWDOWN command:
1 SLOWDOWN
GOTO 1
George
SLOWDOWN does what it says, slows down the CPU and is used exactly for code like keystroke captures or button presses.
Here is the HELP on it:
SLOWDOWN
makes CPU idle for a short time period, thus reducing power consumption. This command can be used in waiting cycles, for example when waiting for button press, and also in looping places where execution speed is not as important as low power consumption. For example, this program uses CPU at 100% while performing simple looping:
1 GOTO 1
and this program leaves CPU almost idle although looping much slower because of short CPU pause in SLOWDOWN command:
1 SLOWDOWN
GOTO 1
George
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)