Page 1 of 3
Create a page
Posted: Sun Feb 17, 2019 10:13 pm
by Ken
I want to divide the screen into three pages vertically so rhe middle one can scroll up and down under the top and bottom pages.
I am having trouble with creating a page of a particular colour say red. I am guessing the alpha value is for transparency.
I tried this to create a thin strip on the top of the page:
Graphics
Graphics clear 1,1,1
n$ = "title area"
PAGE n$ color 1,0,0,1
Page n$ Frame 0,0,30,30
It doesn't seem to work.
Cheers
Re: Create a page
Posted: Sun Feb 17, 2019 10:34 pm
by rbytes
You are off to a good start. Some of the page commands only work after the page has been created. Check the order of this code. It will do what you want.
Code: Select all
Graphics
Graphics clear 1,1,1
n$ = "title area"
page n$ set
page n$ show
PAGE n$ color 1,0,0,1
Page n$ Frame 100,100,300,200
pause 3
Re: Create a page
Posted: Sun Feb 17, 2019 10:39 pm
by rbytes
Here is a page you can drag around the screen. If you only want it to move on the x axis, make the y axis a constant. Or vice versa.
Code: Select all
Graphics
Graphics clear 1,1,1
n$ = "title area"
page n$ set
page n$ show
PAGE n$ color 1,0,0,1
Page n$ Frame 100,100,300,200
do
get touch 0 as tx,ty
get touch 1 as dx,dy
if tx>-1 then page n$ at tx-150,ty-100
until dx>-1
pause 3
Re: Create a page
Posted: Sun Feb 17, 2019 10:49 pm
by Ken
Ok the first one works well.
I will try the other bit of coding later. It seems straightforward.
Also
Does the alpha value determine which page is on top?
Cheers and thanks
Re: Create a page
Posted: Sun Feb 17, 2019 11:55 pm
by rbytes
No, the active page is effectively the top page. You make a page active with the SET command and visible with the SHOW command.
Re: Create a page
Posted: Mon Feb 18, 2019 1:37 am
by Ken
So I want the middle page to scroll under the top and bottom page while they stay visible. Can this be done.
Also what is the alpha value for?
Cheers
Re: Create a page
Posted: Mon Feb 18, 2019 1:53 am
by rbytes
Alpha refers to transparency. So an alpha value of 0 makes something invisible, and an alpha value of 1 makes it fully visible. Any value in between will create a ghosted effect, where objects underneath can partially show through. I will create a three page sample, and let's see if it fills your need.
Re: Create a page
Posted: Mon Feb 18, 2019 1:58 am
by Ken
Ok thanks. I should've able to work it out from here.Don't go to any trouble.Ken
Re: Create a page
Posted: Mon Feb 18, 2019 2:14 am
by rbytes
No trouble. Here is a small sample of three pages. All are visible. The middle red page can be dragged sideways in either direction. To have the other pages cover it, I would define it first and them afterward. But in this code, I defined the middle page last, so it is on top of the blue and magenta pages. Because the red page has an alpha of .5, the pages behind it show through it.
Code: Select all
'Three-page example
Get screen size sw,sh
Graphics
Graphics clear 1,1,1
l$ = "above page"
m$ = "below page"
n$ = "title area"
' page at top of screen
PAGE l$ set
PAGE l$ show
PAGE l$ color 0,0,1,1
PAGE l$ Frame 0,0,sw,sh/3
' page at bottom of screen
PAGE m$ set
PAGE m$ show
PAGE m$ color 1,0,1,1
PAGE m$ Frame 0,2*sh/3,sw,sh/3
page n$ set
page n$ show
PAGE n$ color 1,0,0,1
PAGE n$ alpha .5
Page n$ Frame sw/2,sh/4,sw,sh/2
do
get touch 0 as tx,ty
get touch 1 as dx,dy
if tx>-1 then page n$ at tx-sw/2,sh/4
until dx>-1
end
Re: Create a page
Posted: Mon Feb 18, 2019 3:04 am
by Ken
Ok I have pasted the code in and checked it out. It works well and is nice and brief. I will try and fit it in with what I want.
However:
It looks like I may have been wasting my time( and yours) since I can't use a created page as a container for graphic objects such as recrtangles and lines.
It seems they can only be drawn on the original page/background.
Is this true?