Just starting out? Need help? Post your questions and find answers here.
Stefan
 
Posts: 24
Joined: Mon Feb 05, 2018 9:44 pm

Smiley in Chat

by Stefan Wed Feb 21, 2018 10:48 pm

I try to put smileys in my chat.
The chatbox is a textbox
I try this:

TextGadget(#edi,10,10,500,300,"")



smile$="This is a text <img src='smile.png' >"
SetGadgetText(#edi,smile)

But the picture is on the left side and the text on the right side.

Then I try this:
smile="This is a text <img src='smile.png' style='float:right ;width:12x;height:12px;'>"

Here the text is left, but the picture is far away on the right side.

I want it like a whats app chat. Text and after text the smily.

Any ideas?
Stefan
 
Posts: 24
Joined: Mon Feb 05, 2018 9:44 pm

Re: Smiley in Chat

by Stefan Sun Feb 25, 2018 6:30 am

I have found a solution in the german purebasic forum:
"<img src='smile.png' style='float: none;margin: 0;padding: 0;vertical-align: middle;' />"

Thanks a lot to RSBasic!

But now I see unfortunately the image is not transparent. Do anyone know a solution?
falsam
 
Posts: 259
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Smiley in Chat

by falsam Thu Mar 01, 2018 1:24 pm

Another solution: Emoji

https://unicode.org/emoji/charts/full-emoji-list.html

Code: Select all
Procedure Emoji(Code.s)
  !return String.fromCodePoint(v_code)
EndProcedure


Define font = LoadFont(#PB_Any, "Arial", 25)
OpenWindow(#PB_Any, 0, 0, 0, 0, "Test Smiley unicode", #PB_Window_Background)

TextGadget(0, 20, 20, 400, 30, "")
SetGadgetFont(0, FontID(font))

;Emoji = "0xYourCode" Example 0x1F61C
SetGadgetText(0, "Hello i'm an emoji " + Emoji("0x1F61C"))

➽ Windows 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
Stefan
 
Posts: 24
Joined: Mon Feb 05, 2018 9:44 pm

Re: Smiley in Chat

by Stefan Thu Mar 01, 2018 9:29 pm

Very nice! :)
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 1 guest