Page 1 of 1

imagesource image disappears when adding text in line after

Posted: Mon Apr 27, 2015 5:30 pm
by tamazaraptor
Hi there,
I'm trying to create a field that looks like a chat program. I'd like to have avatars at the start of each sentence, the username, and then their message text. However, I'm finding that the imagesource image vanishes whenever I add text after it. The script I have for this is:

Code: Select all

   put "user1 is typing..." into line 5 of field "chat"
   wait 1 second with messages
   put  user1: hey :)" into line 5 of field "chat"
   set the imagesource of char 1 of line 5 of field "chat" to 1013 
   wait 1 second with messages

--second user's message
  put "user2 is typing..." into line 6 of field "chat"
   wait 1 second with messages
   put empty into line 6 of field "chat"
   put " user2: hi there." into line 6 of field "chat"

I find that after the second user's message appears, the image from user1 disappears. Can anyone shed some light on why this is happening? Is it something to do with line height? I have fixedLineHeight set to false. The image I want to use is imported as control on the same card as the chat field.

I'd also be interested in how else I could present the icons and messages. For instance, is there some way I could use the table feature to better align the icons and messages?

Cheers,
Tamara

Re: imagesource image disappears when adding text in line af

Posted: Tue Apr 28, 2015 9:13 am
by jmburnod
Hi tamazaraptor,
I think you missed a quote
Just put

Code: Select all

 put  "user1: hey :)" into line 5 of field "chat"
instead

Code: Select all

put  user1: hey :)" into line 5 of field "chat
and it should work
Best regards
Jean-Marc

Re: imagesource image disappears when adding text in line af

Posted: Wed Apr 29, 2015 12:26 pm
by tamazaraptor
Hi Jean-Marc,
Thanks for your response! The missing quote appears to have been a typo when I put the script into my original submission. I have the quotes in the correct place in my script in LiveCode. So I don't think that's the problem. Any other thoughts? :)
Cheers,
Tamara

Re: imagesource image disappears when adding text in line af

Posted: Wed Apr 29, 2015 3:58 pm
by jmburnod
Hi Tamara,
So I don't think that's the problem. Any other thoughts?
It tested it and it works for me (LC 6.7.0)
align the icons and messages?
I have changed the textShift property, the result is better but not perfect
Here is the stack
Cheers
Jean-Marc

Re: imagesource image disappears when adding text in line af

Posted: Wed Apr 29, 2015 5:01 pm
by tamazaraptor
Hi Jean-Marc,
Thanks so much for taking the time to put together that stack for me. When I tested it, the image (the smiley face) was still disappearing when the new line of text from user2 ("typing...") appeared in the field. What I'd like is for the smiley face to stay in the field when new text is added to the field. So the "chat" would have all the user's icons staying in the field as new lines of text appeared. Sorry if I didn't explain myself very well in my initial post.

I also double checked my version of LiveCode and upgraded to the latest stable release (7.0.4) just in case that was the problem, and I don't think that's it.

Anyway, thanks for your time, and I will continue trying to find a workaround!
Cheers,
Tamara

Re: imagesource image disappears when adding text in line af

Posted: Wed Apr 29, 2015 6:11 pm
by jmburnod
Hi Tamara,
Yes, You're right , I tested it with LC 7.04 and it doesn't work, but it works with LC 6.7.0
Congratulation, You have catched a LiveCode mistake
You have to choose your bug :D
Jean-Marc

Re: imagesource image disappears when adding text in line af

Posted: Thu Apr 30, 2015 11:01 am
by tamazaraptor
Hi Jean-Marc,
Wow! I always I assume it's my inexperience rather than an actual bug! I feel I should report it but I'm not sure how.
Thanks for puzzling this one out with me!
Cheers,
Tamara

Re: imagesource image disappears when adding text in line af

Posted: Fri May 01, 2015 8:34 am
by jmburnod
Hi Tamara,
Congratulation again, You have made me a user of quality report. :D
That was the first for me.
Kind regards
Jean-Marc

Bug 15308 has been added to the database
"imagesource image disappears when adding text in line after"
1. Download stack "ChatImageSourceTest670.livecode"
2. Open it with LC 6.7.0
3. Click on btn "Test. Smiley ImageSource appear and is always visible
4. Make a copy of "ChatImageSourceTest670.livecode"
5. Open it with LC 7.x
6. Click on btn "Test. Smiley ImageSource disappear

Re: imagesource image disappears when adding text in line af

Posted: Fri May 01, 2015 3:40 pm
by tamazaraptor
Excellent! Hopefully it will be fixed in the next release. Thanks again :)
Kind regards, Tamara

Re: imagesource image disappears when adding text in line af

Posted: Mon May 04, 2015 6:48 pm
by jmburnod
Hi Tamara,

I received a message from LiveCode team.
They confirm that is a bug AND they suggest one way to avoïd mistake:
Maybe this helps until we get this fixed. It seems that if the field is first filled with lines then the smiley imageSource does not disappear. Try adding the following line:
put space into line 10000 of field "chat"
after the line:
put empty into fld "chat"
in the mouseUp handler"
Kind regards
Jean-Marc

Re: imagesource image disappears when adding text in line af

Posted: Tue May 05, 2015 4:02 pm
by tamazaraptor
Hi again Jean-Marc,
Great! That works perfectly. :)
Regards, Tamara