Page command
Page command
when creating a new page from within my program, I can easily get a button to show up in it, but the DRAW TEXT command always draws to the default page, and not the new one. What do I need to do?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Page command
DRAW TEXT does not draw on a page, it draws on a graphics screen.
Re: Page command
so there can only be one graphics screen to a program?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Page command
Yes.greycheek wrote:so there can only be one graphics screen to a program?
Re: Page command
ok, so how can I get text and a button on a separate page and at the same time?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Page command
greycheek wrote:ok, so how can I get text and a button on a separate page and at the same time?
Code: Select all
PAGE 0 SET
FIELD 0 TEXT "Text" AT 10,10 RO
BUTTON 0 TEXT "Button" AT 70, 10
FOR x=0 TO SCREEN_WIDTH()
PAGE 0 AT x,0
PAUSE 0.01
NEXT x
Re: Page command
That procedure works except that I have a number of text fields set up on the default page. After switching page back to the default page from the new page, the text fields are blank.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Page command
It will be good if you post a simple example code to demonstrate the problem.greycheek wrote:That procedure works except that I have a number of text fields set up on the default page. After switching page back to the default page from the new page, the text fields are blank.
Re: Page command
See below. Note how the first text field disappears after hitting the back button.
Code: Select all
GRAPHICS
SET BUTTONS CUSTOM
SET BUTTONS FONT SIZE 9
SET BUTTONS FONT NAME "DINAlternate-Bold"
DRAW COLOR .5,.5,.5
GET SCREEN SIZE W,H
DIM butt$(2),box$(6)
butt$(0)="info"
butt$(1)="back"
FOR i = 0 TO 5
box$(i)= STR$(i)
FIELD box$(i) TEXT "Text" AT 10,10+(30*i) SIZE 100,25
FIELD box$(i) FONT NAME "DINAlternate-Bold"
FIELD box$(i) BACK COLOR .5,.5,.5
NEXT i
BUTTON butt$(0) TEXT "SEE INFO" AT 200,10 SIZE 75,25
' MAIN
loopy = 1
WHILE loopy
FOR i=0 TO 1
IF BUTTON_PRESSED(butt$(i)) THEN
IF i=0 THEN
PAGE 1 SET
PAGE 1 SHOW
PAGE 1 ALPHA 1
PAGE 1 AT 0,0
FIELD 0 TEXT "Text goes here . . ." AT 10,10 SIZE W,H ML RO
BUTTON butt$(1) TEXT "BACK" AT 20,50 SIZE 50,25
ELSE
PAGE 1 HIDE
END IF
END IF
NEXT i
END WHILE
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Page command
Because it goes to page "1" after executing the commandgreycheek wrote:Note how the first text field disappears after hitting the back button.
Code: Select all
FIELD 0 TEXT "Text goes here . . ." AT 10,10 SIZE W,H ML RO