Graphics into fields & limiting lines

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

Post Reply
penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Graphics into fields & limiting lines

Post by penyo311 » Thu Aug 21, 2014 7:44 am

Any help is really appreciated!

So I have:

Code: Select all

on mouseUp
   
  set the HTMLText of char 2 of fld 1 to "<img src=Happy.png>"
            if char 2 of fld 1 is empty
   then put char 2 of fld 1 into ChatBox 
else set the HTMLText of char 9 of fld 1 to "<img src=Happy.png>"
end mouseUp
I feel there has to be an easier way. I just need the images, when clicked/pushed to go into the field, next to one another and for there only to be a max of 4 per line before moving on to the next line.

Thank you so much in advance!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Graphics into fields & limiting lines

Post by dunbarx » Thu Aug 21, 2014 3:11 pm

Hi.
Are you sure you do not want this instead:

set the imageSource of char 2 of fld 1 to "<img src=Happy.png>"

Has the image in question been imported into the stack, or other stack in use?

All that said, is this what you intended? I sort of think you want four images set side-by-side, but this ought not to involve a field, necessarily. Perhaps a dataGrid?

Craig Newman

penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Re: Graphics into fields & limiting lines

Post by penyo311 » Thu Aug 21, 2014 6:20 pm

Well I want them to be able to be "sent" like a message, So how would I get them to send as such, in whatever order the user wants to select.. As it is now if you select a different order the "image" gets replaced.

I am developing this after being in the hospital for 8 days and noticing people that couldn't talk or write it's a long process to communicate how you're feeling and what you want.. So select how you're feeling etc and then send it as a message to your family via text or however but my hurdle is getting the images to insert into the field in whatever order they are "clicked" on.

Anyways, I am very excited and appreciate your help so, so, so much!

Kyle, with a smile.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Graphics into fields & limiting lines

Post by Simon » Thu Aug 21, 2014 7:05 pm

Hi Kyle,
Admirable and FUN project!
How about this, look up the keyword "Last"

Code: Select all

set the imageSource of the last char of fld 1 to img "happy.png"
err looks like you have to use the image ID, but play around with that.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Re: Graphics into fields & limiting lines

Post by penyo311 » Thu Aug 21, 2014 7:17 pm

Thank you Simon! I have

Code: Select all

  set the imageSource of the last char of fld ChatBox to img "1004"
cause you said I have to use the ID but nothing happens when that is plugged in, I may have the resources messed up, somehow but wanted to make sure my code was "sound" :)

Thank you everyone~!

Kyle, with a smile.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Graphics into fields & limiting lines

Post by Simon » Thu Aug 21, 2014 7:19 pm

Good start.
But please look in the Dictionary for proper use of imageSource, you'll see that I (we) made a little error.

Simon
Edit; and you have your quotes in the wrong place :)
Craig won't let me spell it out for you as you should learn how to use the resources available to you. I agree :) but sometimes it's just too much fun solving questions.
Last edited by Simon on Thu Aug 21, 2014 7:22 pm, edited 1 time in total.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Re: Graphics into fields & limiting lines

Post by penyo311 » Thu Aug 21, 2014 7:20 pm

oh and sorry to be a nuisance..

Code: Select all

set the HTMLText of last char of fld ChatBox to "<img src=Angry.png>"
replaces the last character, instead of setting it next to it.

penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Re: Graphics into fields & limiting lines

Post by penyo311 » Thu Aug 21, 2014 7:21 pm

Thanks Simon, I have looked up till 4:30 going what am I doing wrong ahaha, I appreciate it so much!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Graphics into fields & limiting lines

Post by Simon » Thu Aug 21, 2014 7:24 pm

Ok good... Now how would you go about adding a new character to the end of the field then replace it?
It would happen so fast you needn't worry about it looking funny.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Re: Graphics into fields & limiting lines

Post by penyo311 » Thu Aug 21, 2014 7:38 pm

That's what has been rattling my brain.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Graphics into fields & limiting lines

Post by Simon » Thu Aug 21, 2014 8:12 pm

Ok so as I imagine it you have a bunch of images that the users clicks on to add to the fld.

Code: Select all

on mouseUp
put "a" _____ field "ChatBox" -- see if you can figure out what word goes there
set the imageSource of the last char of field "ChatBox" to 1004
end mouseUp
Just take a wild guess at what word could be used there :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Re: Graphics into fields & limiting lines

Post by penyo311 » Thu Aug 21, 2014 8:37 pm

I love fill in the blanks :P Can we play hangman? HAha

thank you :) I am working on it now

"a" is part of the code? my first thought was blank and then empty

Kyle, with a smile.
Last edited by penyo311 on Thu Aug 21, 2014 8:41 pm, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Graphics into fields & limiting lines

Post by Simon » Thu Aug 21, 2014 8:48 pm

Hint: it has 2 vowels in it
Rhymes with Laughter

Ohh lets play Jeopardy!
In the stock market there is Pre-Market trading (4:00-9:30 a.m. ET) and... What?


You get hints because I don't think it is "readily" apparent.

Simon
edit; "a" is part of the code but it could be any character e.g. "3"
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

penyo311
Posts: 12
Joined: Thu Aug 21, 2014 7:20 am

Re: Graphics into fields & limiting lines

Post by penyo311 » Fri Aug 22, 2014 8:06 pm

Thank you so much, AFTER a nap I finally was able to complete it :)

Kyle, with a smile.
Simon wrote:Hint: it has 2 vowels in it
Rhymes with Laughter

Ohh lets play Jeopardy!
In the stock market there is Pre-Market trading (4:00-9:30 a.m. ET) and... What?


You get hints because I don't think it is "readily" apparent.

Simon
edit; "a" is part of the code but it could be any character e.g. "3"

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Graphics into fields & limiting lines

Post by Klaus » Sat Aug 23, 2014 11:23 am

Hi Kyle,

you may want to work through these stacks to get the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus

Post Reply