Page 1 of 2
Page command
Posted: Sat Jun 20, 2015 6:16 pm
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?
Re: Page command
Posted: Sat Jun 20, 2015 6:22 pm
by Mr. Kibernetik
DRAW TEXT does not draw on a page, it draws on a graphics screen.
Re: Page command
Posted: Sat Jun 20, 2015 7:56 pm
by greycheek
so there can only be one graphics screen to a program?
Re: Page command
Posted: Sat Jun 20, 2015 8:53 pm
by Mr. Kibernetik
greycheek wrote:so there can only be one graphics screen to a program?
Yes.
Re: Page command
Posted: Sat Jun 20, 2015 10:44 pm
by greycheek
ok, so how can I get text and a button on a separate page and at the same time?
Re: Page command
Posted: Sun Jun 21, 2015 2:57 am
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
Re: Page command
Posted: Sun Jun 21, 2015 3:07 pm
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.
Re: Page command
Posted: Sun Jun 21, 2015 5:39 pm
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.
Re: Page command
Posted: Sun Jun 21, 2015 9:09 pm
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
Re: Page command
Posted: Sun Jun 21, 2015 11:08 pm
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