Page command

User avatar
greycheek
Posts: 34
Joined: Sun Mar 15, 2015 3:14 pm
My devices: MacBook Air, Iphone 6+, Ipad 2

Page command

Post by greycheek »

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?

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

Re: Page command

Post by Mr. Kibernetik »

DRAW TEXT does not draw on a page, it draws on a graphics screen.

User avatar
greycheek
Posts: 34
Joined: Sun Mar 15, 2015 3:14 pm
My devices: MacBook Air, Iphone 6+, Ipad 2

Re: Page command

Post by greycheek »

so there can only be one graphics screen to a program?

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

Re: Page command

Post by Mr. Kibernetik »

greycheek wrote:so there can only be one graphics screen to a program?
Yes.

User avatar
greycheek
Posts: 34
Joined: Sun Mar 15, 2015 3:14 pm
My devices: MacBook Air, Iphone 6+, Ipad 2

Re: Page command

Post by greycheek »

ok, so how can I get text and a button on a separate page and at the same time?

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

Re: Page command

Post by Mr. Kibernetik »

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

User avatar
greycheek
Posts: 34
Joined: Sun Mar 15, 2015 3:14 pm
My devices: MacBook Air, Iphone 6+, Ipad 2

Re: Page command

Post by greycheek »

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.

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

Re: Page command

Post by Mr. Kibernetik »

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.
It will be good if you post a simple example code to demonstrate the problem.

User avatar
greycheek
Posts: 34
Joined: Sun Mar 15, 2015 3:14 pm
My devices: MacBook Air, Iphone 6+, Ipad 2

Re: Page command

Post by greycheek »

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

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

Re: Page command

Post by Mr. Kibernetik »

greycheek wrote:Note how the first text field disappears after hitting the back button.
Because it goes to page "1" after executing the command

Code: Select all

FIELD 0 TEXT "Text goes here . . ." AT 10,10 SIZE W,H ML RO

Post Reply