Smiley in Chat

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

Smiley in Chat

Post by Stefan »

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: 160
Joined: Mon Feb 05, 2018 9:44 pm

Re: Smiley in Chat

Post by Stefan »

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: 280
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

Re: Smiley in Chat

Post by falsam »

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 11 - JDK 1.8 - SB 2.40 - Android 13
http://falsam.com

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

Re: Smiley in Chat

Post by Stefan »

Very nice! :)
Post Reply