Using LC for Slideshow

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 7:21 pm

"How do I script an escape from Full Screen? Since Full Screen button will still be visible, can it be scripted so that clicking again escapes Full Screen mode?"

Go and fool around with the demo stack I uploaded: you SHOULD notice that there are actually 2 buttons:

1. A button to stretch everything to fullscreen: which, when it has done that becomes invisible, and makes button 2 visible.

2. A button to unstretch everything down to a 400 x 400 stack, which, when it has doen that becomes invisible, and makes button 2 visible.

Of course you could just keep the same button with something like this in the script:

on mouseUp
if the width of stack "SlideShow" > 400 then
do something
else
do something else
end if
end mouseUp

where 'something' and 'something else' are the expand and contract scripts respectively.

The reason I used 2 buttons was because I wanted to change the word on them.

doveweed
Posts: 22
Joined: Tue Feb 03, 2015 9:26 pm

Re: Using LC for Slideshow

Post by doveweed » Wed Feb 04, 2015 7:30 pm

I've been doing plenty of experimenting, which is fine when it comes to learning what the various tools in the toolbar do, but I could experiment til kingdom come and never figure out what script should say to do what I want.
The script I have for forward/backward slides with wipe left and right didn't come from experimenting but from someone providing an example, which is as just as important a way for me to learn as experimentation.

Still looking for examples.
Hello World?!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 7:37 pm

The 'Hello World' exercise has always struck me as a complete and utter waste of time.

Better to start with something that is vaguely productive.

doveweed
Posts: 22
Joined: Tue Feb 03, 2015 9:26 pm

Re: Using LC for Slideshow

Post by doveweed » Wed Feb 04, 2015 7:46 pm

When I click on your Full Screen button, the cat pix fills my HP ZR22w monitor set at 1920x1080 and there is no escape button visible only the cat pixels.
I have to close the stack to escape.
Last edited by doveweed on Wed Feb 04, 2015 7:46 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 7:46 pm

"but I could experiment til kingdom come and never figure out what script should say to do what I want."

Well, I just don't know: something like 95% of what I have learnt with Livecode over the last 15 years has
been by expereimentation and digging in the dictionary.

I have, admittedly, got badly bogged down with some scripts which have ended up taking MINUTES
to sort out . . . LOL

But, Hey, I'm not even a computer programmer: I'm a chap with a degree in Philosophy who works
teaching English as a Foreign Language to Primary children: so don't take my word for
anything :P

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 7:56 pm

On full screening the stack there SHOULD be a button called SHRINK ME in the
top left-hand corner . . .

I am uploading 2 variant stacks "SCREENER2" and "SCREENER3".

"SCREENER2" sets the stack's top to 40 pixels below the top of the screen.

"SCREENER3" does NOT have a SHRINK button: I've moved the code into the
picture of the cat: so just click on the cat!
screener2.livecode.zip
(148.17 KiB) Downloaded 247 times
screener3.livecode.zip
(148.13 KiB) Downloaded 248 times

doveweed
Posts: 22
Joined: Tue Feb 03, 2015 9:26 pm

Re: Using LC for Slideshow

Post by doveweed » Wed Feb 04, 2015 8:28 pm

I don't understand what the following are referring to, and don't find them in the Dictionary —
item 3
item 4
—44
WIDD
WIDD / 1.78
HITE
22
70
40

If stack is named Slideshow, and I want entire card width and height to fill user's screen resolution (whatever that might be),
should Object Script for Full Screen button read like this - (please correct)
on mouseUp
set the width of stack "Slideshow" to item 3 of the working screenRect
set the height of stack "Slideshow" to item 4 of the working screenRect
set the width of stack "Slideshow" to WIDD
set the height of stack "Slideshow" to HITE
set the left of stack "Slideshow" to 0
set the top of stack "Slideshow" to 0
set the vis of btn "ss" to true
set the vis of btn "fs" to false
end mouseUp

Do my card images then need to be 1920x1080 scaled down to fit size of card, so that when put in Full Res there is no pixelating?

doveweed
Posts: 22
Joined: Tue Feb 03, 2015 9:26 pm

Re: Using LC for Slideshow

Post by doveweed » Wed Feb 04, 2015 8:41 pm

At lessons runrev, see -
How do I make my app scale to fit the screen on all devices?
and
Displaying Assets On Differing Screen Resolutions

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 8:46 pm

WIDD and HITE are just crazy names I thought up for variables :)

In Livecode one does NOT have to explicitly declare variables (although one can if one wants to), and
they can be called anything except for reserved terms.

I called mine in this example WIDD and HITE so that I remembered that I was putting items 3 and 4
(the width and the height of the screenLoc) into them, so I didn't get all mixed up more than I do
anyway.

item 3 and item 4 are the 3rd and 4th numbers of the screenLoc respectively.

The numbers 70, 44, 20 and so are how far awy from the left of the screen and the top of the screen I want the stack left
and top to be.

I would suggest you get out a chess board, if you have one, and do a bit of messing around with it and a few pieces,
or recall if you had any map-reading and/or orienteering classes at school like I did in the Aremy cadets . . .

Personally I find messing around with something physical such as a chess board or Lego pieces helps me
get my head around twiddly abstractions:
chessboard.jpg
Here's a photo of some stuff I was doing with a few 9 year old kids who were on their first progging class ever, they
didn't seem to have any serious problems, and were able to implement moving a blob around a stack directly after we'd messed around with that chess piece
on a Polish draughts board :)
Last edited by richmond62 on Wed Feb 04, 2015 8:50 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 8:48 pm

"At lessons runrev, see -
How do I make my app scale to fit the screen on all devices?
and
Displaying Assets On Differing Screen Resolutions"

Well, if that is there, maybe you might be better reading that than what I'm writing here.

Although, frankly, there probably isn't that much difference.

doveweed
Posts: 22
Joined: Tue Feb 03, 2015 9:26 pm

Re: Using LC for Slideshow

Post by doveweed » Wed Feb 04, 2015 8:52 pm

I'm sure I can learn something from all.
Where is escape script in your Screener3 file?
I don't see a card or stack script, just object script for Full Screen Me button.
Where is script that tells Full Screen to escape when clicking on full screen image?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 9:03 pm

The image "CAT" contains what you call an ESCAPE script.

In Livecode anything can contain a script, and anything can behave as a button.

I have set things up in SCREENER3 so that when you expand the stack
you can return to 'normal' just by clicking on the cat picture.

doveweed
Posts: 22
Joined: Tue Feb 03, 2015 9:26 pm

Re: Using LC for Slideshow

Post by doveweed » Wed Feb 04, 2015 9:07 pm

So how did you set that up so clicking expanded image returns to normal?
When I inspect object script for cat pix, I don't see anything there about "return to normal".

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Using LC for Slideshow

Post by richmond62 » Wed Feb 04, 2015 9:47 pm

" I don't see anything there about "return to normal"."

Well you wouldn't, would you?

'return to normal' is English; a human language - you have to tell the computer what to do in a language the computer
understands - in this case the Livecode language.

So, the image 'Cat' contains this script:

on mouseUp
set the width of stack "SCREENER3" to 400
set the height of stack "SCREENER3" to 400
set the top of stack "SCREENER3" to 40
set the left of stack "SCREENER3" to 0
set the width of img "CAT" to 356
set the height of img "CAT" to 200
set the left of img "CAT" to 22
set the bottom of img "CAT" to 390
end mouseUp

And if you look at that you will see that first of all it resizes the stack to 400 x 400 pixels,
then it makes sure the top of the stack sits 40 pixels down from the top of your monitor, and the
left of the stack coincides with the left of your monitor.

Then the script resizes the Cat image back to 356 by 200 pixels [and if you do a bit of thinking you will realise that the proportion
of 356 to 200 is about 1.78!!!].

Finally the script drags the Cat image down to 1o pixels above the bottom of the stack so it does not
overlap either the button or my text.

----------------------------------------------------

I am very grateful that I am 53 for the very simple reason that almost exactly 40 years ago, in our Maths classes
we were introduced to the principles of computer programming via MINIFORTRAN, FORTRAN IV and BASIC rather than
the incredibly dumbed-down classes they started teaching with the advent of the Graphic User Interface where one
learnt how to type a letter in 'Word', send an e-mail to Granny and use a Paint program.

Because of those computer lessons I have never expected a computer to behave like a human being, nor understand
any human language, and do not suffer from the illusion that a computer can think.

----------------------------------------------------

One of the Lake poets (no, it wasn't Wordsworth) went to see the dissection of a human body and was extremely disappointed
to find that he could not see pictures of what the dead man had seen in the slices of his brain.

Do not be like that poet because it will not get you very far.

doveweed
Posts: 22
Joined: Tue Feb 03, 2015 9:26 pm

Re: Using LC for Slideshow

Post by doveweed » Thu Feb 05, 2015 1:26 am

I've got it working. Check out SlideShow.livecode.
SlideShow.livecode.zip
SlideShow project file
(85.01 KiB) Downloaded 248 times
Would be a lot easier if there was some code to apply to any image so I wouldn't have to edit title of image in every Object Script.
Would also be better if buttons enlarged in proportion and position so they stay at lower right of screen.
Would also like to get rid of white line along bottom of screen when expanded to full screen.
Last edited by doveweed on Thu Feb 05, 2015 1:31 am, edited 1 time in total.

Post Reply