How do I display circled letters and blink them?

I’d like to display a grid of letters initially plain in their little grid squares. If one is clicked, I’d like to toggle a circle around it within it’s little square. At the same time, base on a calculation, I’d like to show some other letters in the grid with slashes through them and maybe darken their background (just their little individual squares) just a bit. If a slashed letter is clicked, I’d like, based on calculation, a specific circled letter to blink.

I did all this pretty easily in ZBasic/FutureBasic decades ago. For the circle and slash I just “drew” them using the calculated individual grid square’s coordinates. The circle had a transparent fill. There was also a native “Blink” command.

In Xojo, I figured I’d use a List box (built-in control or DataView by PiDog) for the grid. What’s the 2019 way to blink/slash/circle the desired letters in the cell?

Thank you.

One idea that comes to mind…
Use Unicode characters https://www.fileformat.info/info/unicode/block/enclosed_alphanumerics/list.htm
and a timer to switch the color between black and white (or what ever colors required)

or, use a canvas and as you suggested, draw them yourself… and a canvas might be a better choice that Listbox or Dataview

Use the CellBackgrounPaint event draw the letters and call Listbox.Refresh in a Timer to cause the blink?

I would do this with a Canvas. You control all the drawing but that’s sort of what it was designed for.

Thank you for the suggestions. Though I have a long background in programming in several languages, I’m been away from it for quite a while and some of the tools/objects are new to me. the Canvas is one of them. But that’s why we have introduction tutorials so I’ll check it out.

I’ve tried to make friends with OOP style and I see it as fine for large project, reusing code a lot, collaborating with others. But it looks like a lot of overhead for simple “one off” projects. And it is fine that operational code and be embedded with an object, but as one who has had to find bugs in other peoples programs, it is just one more place to hide (where did he/she put the code that does this?). Sorry for the rant - got a little off topic there.

It seems strange I’d involve a something as hardcore as a timer to blink but I’m sure that was what was behind the scenes in the language that had Blink as a primitive attribute for the text object.

Dave, I’ll look at the UniCode - I see the circled letters there.
Tim, I’ll study up on the timer object.
Bob, I’ll get up and personal with the Canvas object.

It’s a good meal to chew on.

My PopChar App shows I have ArialUniCode MS but it doesn’t display any circled characters. I’m concerned if I have to download a special font because, unless I can embed it in the compiled program, it may not be available on any random computer.

ran a simple test, works for me

Dim i As Integer
Dim s As String
g.textfont="Arial"
g.ForeColor=Color.Black
g.textsize=20
For i=0 To 9
s=s+Chr(&H2460+i)
Next i
g.drawstring s,100,100

prints 1 to 10 when placed in the Paint event of a Canvas… no special fonts required

Here’s how to do it in a ListBox:

Blink Text In ListBox

[quote=422237:@Tim Jones]Here’s how to do it in a ListBox:

Blink Text In ListBox[/quote]

Very uneven blinking. As if the 1 second timer is not enough time to draw a few cells and set their tags …

Using invalidate instead of refresh makes no difference.

@ Markus: slow computer ?

It’s supposed to be a framework and example. I’m certain it could be dramatically improved upon. I just wanted to provide the simplest demo of what I was talking about.

Just a note that I really appreciate the examples you are giving me.

As background, this is a hobby application - an aid for solving a grille cipher. That cipher type displays seemingly scrambled letters in a square grid. The key, if you had it, is a paper with holes punched in it so when laid on top of the grid, you’d only see the letters in the holes. Those are copied out left to right, top to bottom, then the the key is rotated 90 degrees and the new letters appearing in the holes are copied out. Two more rotations selected all the letters, which are now (in four string sets, one for each rotation) in the correct sequence to read the message (You may need to switch the order of the four strings because, at first, you don’t know the starting rotation). So the key selects one fourth of the message letters on each rotation.

Without the key, if a hint word is not given you start by guessing a word or letter sequence, knowing that each selection on one rotation (as if there was a hole) also designates three more letters, one with each subsequent rotation. So I want to display a letter circled when I select it and I want to slash the three letters that circle “owns” on subsequent rotations because they are now not available for the current rotation. As you go, four strings are being built, one each based on the choices and rotation. Sometimes, on the current rotation, I may want to use a letter that is slashed. So I need to know what circled letter it “belongs to” and un-circle that letter. That’s were the blink comes in. Clicking a slashed letter would blink the circled letter that caused it to be slashed.

So there is nothing exactly mandatory about the circle/slash/blink. They are just handy ways of indicating the relationship between three states (or four states adding in “neutral”). The Circle is cool because if you had the actually key, the letters would appear in the punched holes.

This worked great on my Mac PB-180 (33MHz cpu, 4MB RAM, but it had a math co-processor). So I’m hoping I can duplicate the same functionality and run it on a Mac or PC. It would be especially great if I could run it on an iPad. That’s why I chose Xojo.