scrolling images

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

scrolling images

Post by Scott Richardson » Mon May 08, 2006 7:11 pm

I'm new to this, so I imagine my question will sound dumb, but here goes. I need an image field on a card that holds an image much larger than the card--that is, the field needs to have vertical as well as horizontal scroll bars to "move around' the image within the field that is on the card. I have tried several things and always end up with the image being resized inside the field and/or the scroll bars not doing anything. What am i missing? Also, is it possible to embed an image with the text inside of a scrolling text field? Thanks.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon May 08, 2006 7:39 pm

Group the image (yes, you can group single objects) and give the group a vertical and horizontal scrollbar. Set the lockloc of the group to true.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Tue May 09, 2006 10:48 pm

Thanks for the help with the firstt part of the question. It turns out I was doing things in the wrong order. Any help on the second question, anybody? I'm still having trouble with the imageSource property to display a small image in a scrolling text field. I'm probably doing something backwards here, too.

Thanks.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue May 09, 2006 11:08 pm

Hi Scott,

I don't think I understand your question. Could you elaborate a bit and post your script?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Wed May 10, 2006 5:11 pm

Sorry, I'm not very clear. I may not be using the correct terms. What I need to do is to have a small image (a diagram) to be included in a scrolling text field with the text. In other words, I need the image to act like a text character and to scroll with the text inside the text field. I noticed from the documentation that this was possible setting the imageSource property of a character in the text field. I'm just not sure how to accomplish it.

Thanks,
Scott

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Wed May 10, 2006 5:40 pm

Hi Scott,

try this:

set the imageSource of char 1 of fld "myField" to the ID of img "myImage"

The field needs to contain a char for it to work. I am assuming that the image is on the same card as the field in the upper script. It could be hidden though.

Hope that helps,

malte

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed May 10, 2006 6:33 pm

Hi Scott,

Malte is right and I thought you were trying what he proposes and somehow couldn't get it to work. You probably will want to set the fixedLineheight of the field to false, in case the image is slightly larger than the text.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Wed May 10, 2006 8:06 pm

Thanks again for the help, but I still must be doing something wrong. This is the script I had used:

set the imageSource of char 1 of field "sample" to 1003
(sample is the name of my scrolling field and 1003 is the imageID)

I had also tried:

set the imageSource of char 1 of field "sample" to "test.jpg"
(sample is the name of my scrolling field and test.jpg is the imageName)

I tried it with the image on the same card, the image on a different card in the same stack, and even using a path name to the image on the hard drive. I assume I can just use the script editor to apply this script to the field. There are plentty of characters in the field, but the image never replaces the character. What am I missing?

Thanks,
Scott

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed May 10, 2006 8:15 pm

Scott,

What exactly are you doing? Did you put your syntax into the field script? Could you post your complete script? Did you import that image as a control or is it referenced?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Wed May 10, 2006 8:29 pm

I just started from "scratch."

1. new main stack, saved as "untitled"
2. drag scrolling text field to card, named "sample"
3. typed test text into "contents" in inspector
4. imported as control onto same card "lamp2.jpg"
5. selected field "sample"
6. opened script editor and typed:
set the imageSource of char 1 of field "sample" to "lamp2.jpg"
7. clicked "apply" and closed script editor

Nothing happened. I'm missing something.

Thanks,
Scott

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Wed May 10, 2006 8:38 pm

Hi scott,

a script is only executed if it is a) in a handler and called by a message

e.g.

on mouseUp
-- do something
end mouseUp

or if you execute it from the messagebox.

try your line of script in the messagebox and it will work.

Hope that helps,

Malte

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed May 10, 2006 8:46 pm

Scott,

Probably it is best to try this from the message box, first. What are you going to use it for? My guess is that you need a way to set the imagesource automatically, if the text in the field is going to change.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Wed May 10, 2006 8:50 pm

[blow my own horn mode]
And if you are interested, I have a chapter on working with the imageSource property in my free ebook you can find here:

http://www.derbrill.de/tutorials_e.html

[/toot toot]

All the best,

Malte

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Post by Scott Richardson » Thu May 11, 2006 8:04 pm

Mark, Malte,

Thanks. You've been a great help. As I said, I'm new at this, and some might say dumb. Maybe not dumb, but at least non-observant. I didn't even notice I wasn't executing the command and I didn't even think about the message box. I have used the message box now, and everything works fine. Hopefully, little things like this won't escape me as I work with it more.

What I'm working on is a simple interactive study guide for a history lesson that will be provided on CD. It has a timeline-based interface with windows that come up when items are clicked. On these windows are scrolling text fields with information, maps, etc. and also buttons to move to other areas of information.

Thanks again.

Scott

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu May 11, 2006 8:25 pm

Hi Scott,

An interactive study guide sounds cool. What exactly do you want to do with those images in the field? I'd like to know whether you need a dynamic solution, which allows for changing the text, or a static solution. If it is static, you could just execute the syntax from the message box, but if it is dynamic, you might want to explain how it is supposed to work --unless you have figured it all out by now.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”