Create a page

Ken
Posts: 29
Joined: Tue Jan 29, 2019 1:49 am
My devices: Ipad
Location: NSW, Australia

Create a page

Post 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

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Create a page

Post 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
The only thing that gets me down is gravity...

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Create a page

Post 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
The only thing that gets me down is gravity...

Ken
Posts: 29
Joined: Tue Jan 29, 2019 1:49 am
My devices: Ipad
Location: NSW, Australia

Re: Create a page

Post 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

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Create a page

Post 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.
The only thing that gets me down is gravity...

Ken
Posts: 29
Joined: Tue Jan 29, 2019 1:49 am
My devices: Ipad
Location: NSW, Australia

Re: Create a page

Post 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

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Create a page

Post 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.
The only thing that gets me down is gravity...

Ken
Posts: 29
Joined: Tue Jan 29, 2019 1:49 am
My devices: Ipad
Location: NSW, Australia

Re: Create a page

Post by Ken »

Ok thanks. I should've able to work it out from here.Don't go to any trouble.Ken

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Create a page

Post 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
Attachments
E697B99A-B486-47E9-B895-E83ADF3F8F74.png
E697B99A-B486-47E9-B895-E83ADF3F8F74.png (56.95 KiB) Viewed 3816 times
The only thing that gets me down is gravity...

Ken
Posts: 29
Joined: Tue Jan 29, 2019 1:49 am
My devices: Ipad
Location: NSW, Australia

Re: Create a page

Post 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?

Post Reply