Switch from GRAPHICS to Text Output
Re: Switch from GRAPHICS to Text Output
Hi, thank you, for the first question I cant scroll up the text output after the end of calculation, while if I try with other source code without BUTTON command I can scroll up. Please try if you want the code : after the end of calculation , if you switch to txt page you cant scroll up the txt page. Have you experienced about that?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Switch from GRAPHICS to Text Output
Yes, page with interface objects blocks the scroll.Matteo wrote: ↑Sat Feb 04, 2017 6:49 amHi, thank you, for the first question I cant scroll up the text output after the end of calculation, while if I try with other source code without BUTTON command I can scroll up. Please try if you want the code : after the end of calculation , if you switch to txt page you cant scroll up the txt page. Have you experienced about that?
You can hide it with
PAGE "" HIDE
command before you stop your program.
Please read about pages if the above advice sounds strange for you.
Re: Switch from GRAPHICS to Text Output
Hi Mr. Kibernetik, ok thanks, but after to have hidden the page, I can't to re-show the key TXT and RGB, so after the scroll operation I cant switch between graph and txt. I'm learning a bit about TOUCH_X...that command can work also in TEXT page or only in GRAPHICS environment?
Thanks
Matteo
Thanks
Matteo
Re: Switch from GRAPHICS to Text Output
Hi! the only way to reload the RGB key in text page with scrolling capability is to use GET ORIENTATION command, the code below:
Do you know if a better way exists, maybe with other commands in SB? I'd prefer avoiding to rotate by 90 degrees the phone to disable RGB key and to be able to scroll up and down the text page and re-rotate the phone to re-enable the RGB key to switch to graph view. Thanks for the help
Matteo
Code: Select all
REM --- We start in the graph page:
GRAPHICS
button_text$ = "TXT"
BUTTON "a" TEXT button_text$ AT 250,10
i=0
LOOP:
IF i<50 THEN
i=i+1
x=i
y=2*x+4
REM --- What I want to see in the text page:
PRINT x, y
REM --- and what I want to see in the graph page:
DRAW PIXEL x,y COLOR 1,0,0
DRAW CIRCLE x,y SIZE 2
PAUSE 0.05
REM calculation terminated:
ELSE
SLOWDOWN
IF button_text$="RGB" THEN
GET ORIENTATION P
IF P=4 THEN
PAGE "" HIDE
ELSE
PAGE "" SHOW
ENDIF
ENDIF
GOTO switch_page
ENDIF
switch_page:
IF button_text$ = "TXT" AND BUTTON_PRESSED("a") THEN
button_text$ = "RGB"
BUTTON "a" TEXT button_text$
TEXT
GOTO LOOP
ENDIF
IF button_text$ = "RGB" AND BUTTON_PRESSED("a") THEN
button_text$ = "TXT"
BUTTON "a" TEXT button_text$
GRAPHICS
GOTO LOOP
ENDIF
GOTO LOOP
Matteo
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Switch from GRAPHICS to Text Output
You can set exact size of a page to avoid full screen blocking.
Re: Switch from GRAPHICS to Text Output
ok! I will try thanks
Re: Switch from GRAPHICS to Text Output
Is there a simple way to INPUT on the graphics screen? I have been using INPUT x$, which automatically switches to TEXT mode, then you have to switch back to GRAPHICS to print (DRAW) x$ on the graphics screen. The FIELD commands seem to be for text fields. I can't find any graphics or interface command that does this on the existing GRAPHICS page. Can you create an INPUT field on a graphics page? I can't find anything in the examples.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Switch from GRAPHICS to Text Output
You can use FIELD command to input text in graphics screen.davey110 wrote: ↑Mon Feb 06, 2017 11:36 pmIs there a simple way to INPUT on the graphics screen? I have been using INPUT x$, which automatically switches to TEXT mode, then you have to switch back to GRAPHICS to print (DRAW) x$ on the graphics screen. The FIELD commands seem to be for text fields. I can't find any graphics or interface command that does this on the existing GRAPHICS page. Can you create an INPUT field on a graphics page? I can't find anything in the examples.
You can check sample program "Interactive Interface > sin + cos.txt" - function parameters are set using FIELD interface objects.
- 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: Switch from GRAPHICS to Text Output
I've used the techniques in the source code below with GRAPHICS ON, and it works. You may have to tinker with it, but I will see if I can find a program that Ricardo wrote where I turned his text boxes to work in GRAPHICS.davey110 wrote: ↑Mon Feb 06, 2017 11:36 pmIs there a simple way to INPUT on the graphics screen? I have been using INPUT x$, which automatically switches to TEXT mode, then you have to switch back to GRAPHICS to print (DRAW) x$ on the graphics screen. The FIELD commands seem to be for text fields. I can't find any graphics or interface command that does this on the existing GRAPHICS page. Can you create an INPUT field on a graphics page? I can't find anything in the examples.
This program was part of a post awhile back when Ricardo, Dutchman and I were trying to give the user the ability to continue scrolling from field to field until the button was pushed. You can use either the TAB or ENTER key. However, ENTER will highlight the next field where TAB leaves the lighlight in the last field ENTER was hit, but advances the cursor to the next FIELD.
The highlighting was part of what Dutchman wrote in his code. When I use it in my programs, I remove the highlight. Since TAB doesn't advance it, it makes more sense to just follow the cursor.
George.
Code: Select all
SBMain:
prompt$=""
Answer$=""
.FALSE=0
.TRUE=1
BUTTON.SELECTED=.FALSE
GOSUB GetScreen
GetFieldInput:
'*** Loop through the input fields. If the button isn't pressed and we are at
'*** the last field, go back to the top
X=1
DO
IF BUTTON_PRESSED ("updt") THEN
BUTTON.SELECTED=.TRUE
GOTO 100
ENDIF
F$=X
GET_INPUT(F$)
X+=1
IF X=6 THEN X=1
UNTIL BUTTON.SELECTED
100 GOSUB GetAnswers
SBEnd:
STOP
'Get and print out all the results
'
'
GetAnswers:
Answer$=FIELD_TEXT$("1")
PRINT "What is your name: "&Answer$
Answer$=FIELD_TEXT$("2")
PRINT "Where do you live: "&Answer$
Answer$=FIELD_TEXT$("3")
PRINT "How long have you been a forum member: "&Answer$
Answer$=FIELD_TEXT$("4")
PRINT "Yes, "&Answer$&" is a nice feature."
Answer$=FIELD_TEXT$("5")
PRINT "Interesting: "&Answer$
RETURN
GetScreen:
PRINT!PRINT TAB(14);"What is your name:"
FIELD "1" TEXT prompt$ AT 380,30 SIZE 300, 25
PRINT!PRINT TAB(14);"Where do you live:"
FIELD "2" TEXT prompt$ AT 380,75 SIZE 300, 25
PRINT!PRINT "How long a member of the Forum:"
FIELD "3" TEXT prompt$ AT 380,120 SIZE 300, 25
PRINT!PRINT " Favorite feature of the Forum:"
FIELD "4" TEXT prompt$ AT 380,165 SIZE 300, 25
PRINT!PRINT " Have you posted any programs:"
FIELD "5" TEXT prompt$ AT 380,210 SIZE 300, 25
BUTTON "updt" TEXT "Update" AT 380,270 SIZE 100,30
PRINTLINE(4)!PRINT "Results of input boxes:"!PRINT "-----------------------"
RETURN
DEF GET_INPUT(FIELD$)
FIELD FIELD$ BACK COLOR 1,1,0
FIELD FIELD$ FONT NAME "Courier"
FIELD FIELD$ SELECT
DO
IF BUTTON_PRESSED ("updt") THEN
BUTTON.SELECTED=.TRUE
ENDIF
SLOWDOWN
UNTIL FIELD_CHANGED(FIELD$) OR BUTTON.SELECTED
FIELD FIELD$ BACK COLOR 1,1,1
ENDDEF
DEF PRINTLINE (A)
N=1
DO
PRINT
N=N+1
UNTIL N > A
ENDDEF
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)
Re: Switch from GRAPHICS to Text Output
Thank you. I read the help notes, but couldn't quite get it all together. Now I see how to integrate the FIELD commands, as in the following code:
x$="Type here"
1 FIELD "name" TEXT x$ AT 200,200 SIZE 200,60 ' draw the field box
FIELD "name" FONT SIZE 50 ' optional
FIELD "name" SELECT ' selects any text already in the field, so it will delete when you start typing new input. Optional.
2 DO
3 UNTIL FIELD_CHANGED("name")=1 ' waits for input
4 x$ = FIELD_TEXT$("name") ' read the new text in the field
The numbered lines are the essential commands. The other 2 lines are "cosmetic", or optional, depending on what you need.
Thanks for getting me on the right track.
x$="Type here"
1 FIELD "name" TEXT x$ AT 200,200 SIZE 200,60 ' draw the field box
FIELD "name" FONT SIZE 50 ' optional
FIELD "name" SELECT ' selects any text already in the field, so it will delete when you start typing new input. Optional.
2 DO
3 UNTIL FIELD_CHANGED("name")=1 ' waits for input
4 x$ = FIELD_TEXT$("name") ' read the new text in the field
The numbered lines are the essential commands. The other 2 lines are "cosmetic", or optional, depending on what you need.
Thanks for getting me on the right track.