Xojo has very good graphics support. You can drop images into a Xojo project and use them with several controls. You can use the various Paint events to draw your own graphics. And there’s another source of graphics you may not have considered: emojis. Emojis can be used anywhere that text can be used because they are Unicode characters. That means they can be used in textfields, buttons, labels, popup menus, listboxes and more.
Emojis are available on every operating system and platform that Xojo supports from desktop to mobile to web. Because they are built-in to the OS as characters, they are client-side which means that web applications don’t have to load them from the server as they are already available to the browser from the user’s OS. As characters, they are scalable to any font size. There are also a lot of them. According to Emojipedia (yes, that’s a thing), there are over 3,600 emojis as of September 2021.
Emojis can be especially useful for listboxes in web applications because unlike the DesktopListBox, the WebListBox does not have a PaintCellBackground event that can be used to draw graphics into a cell. Instead, if you can find an emoji that represents what you’d otherwise draw into a cell, you can simply assign it without having to deal with graphics at all. For example, there are a series of emojis that are just boxes in different colors that could be used to indicate the state of something: 🟩🟥🟦🟧🟨🟫⬛️⬜️. The famous web game Wordle uses these when you share your results. With over 3600 available, you can likely find an emoji to represent nearly anything you might need from the common smiling face 😀 to the less common umbrella on the ground⛱️ , banjo 🪕 or moai 🗿from Easter Island.
Again, emojis can be used in any type of application, desktop, mobile or web. Here’s an example of them in a web popup menu:
And here they are in a web list box:
The key thing is to realize that they are individual characters which means they can appear alone or mixed in with other characters. If you need them to be larger, increase the font size. Here’s the lion for example at 60 point size:
Because they are characters, you can copy and paste emojis anywhere you’d use a character, including in your code:
ListBox1.AddRow("Fox 🦊") ListBox1.AddRow("Lion 🦁") ListBox1.AddRow("Chipmunk 🐿️")
Just remember that emojis are characters, not graphics, so you should treat them as such. Notice in the code above, they are inside the quotes. You could even use them to name a variable:
Var 🌋🥥💰 As String = "Yes, you can do this!"
I’m not sure that’s useful, but it clearly demonstrates how an emoji is a characters like any other.
On Emojipedia you can search for emojis by keyword and copy them to the clipboard. Again because they are simply characters, you can then paste them into a Xojo constant, make them the default value of a property or even paste them into the Code Editor to assign them in code.
Keep emojis in mind the next time you need an image in an application.