field examples

Post Reply
PaulKnight
Posts: 19
Joined: Mon Jan 21, 2019 9:27 pm
My devices: iPhone SE
Flag: Great Britain

field examples

Post by PaulKnight » Sun Feb 17, 2019 9:35 pm

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 :-)

User avatar
rbytes
Posts: 1329
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: field examples

Post by rbytes » Sun Feb 17, 2019 9:45 pm

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
F76F7C3E-0ACE-4FB1-87C7-BC19F651555B.png (79.62 KiB) Viewed 893 times
Last edited by rbytes on Tue Mar 26, 2019 3:34 pm, edited 1 time in total.
Zzzzz

PaulKnight
Posts: 19
Joined: Mon Jan 21, 2019 9:27 pm
My devices: iPhone SE
Flag: Great Britain

Re: field examples

Post by PaulKnight » Sun Feb 17, 2019 9:56 pm

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 :-)

User avatar
rbytes
Posts: 1329
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: field examples

Post by rbytes » Sun Feb 17, 2019 10:21 pm

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.
Zzzzz

User avatar
rbytes
Posts: 1329
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: field examples

Post by rbytes » Tue Mar 26, 2019 2:45 pm

Mr. K, the example I gave in this thread should probably be move to For Beginners
Zzzzz

ZXvet
Posts: 3
Joined: Fri May 15, 2020 5:52 pm
Flag: Great Britain

Re: field examples

Post by ZXvet » Fri May 15, 2020 7:43 pm

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 ?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4526
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPad, iPhone, MacBook Pro
Location: Russia
Flag: Russia

Re: field examples

Post by Mr. Kibernetik » Fri May 15, 2020 8:18 pm

ZXvet wrote:
Fri May 15, 2020 7:43 pm
Does this artless loop happen so fast that the input isn't always registered ?
In this loop your button press is registered as soon as button is pressed.

ZXvet
Posts: 3
Joined: Fri May 15, 2020 5:52 pm
Flag: Great Britain

Re: field examples

Post by ZXvet » Fri May 15, 2020 9:55 pm

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

User avatar
Mr. Kibernetik
Site Admin
Posts: 4526
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPad, iPhone, MacBook Pro
Location: Russia
Flag: Russia

Re: field examples

Post by Mr. Kibernetik » Fri May 15, 2020 10:12 pm

ZXvet wrote:
Fri May 15, 2020 9:55 pm
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
There are many examples of buttons usage in Examples folder in the smart BASIC app.
You can check them to see how they work.

Post Reply