Building a Mac desktop control set of crossword cells

I want to build a custom desktop control set representing a single small crossword cell so I can build up crossword grids of any shape and size programatically to compile crosswords on my Mac. (I am returning to Xojo after a long break so any pointers to help me get started would be appreciated.)

Each cell must be able to display (when appropriate) a very small integer top left and set left (the across and/or down clue number) and a relatively large single capital letter centred in the cell for solutions. Also it must be possible to paint the whole cell black or give it a black background for when the cell contains no letter or number at all.

I might want to create a 15x15 grid or a 12x12 grid, or whatever, when the top-left integers in each cell will be dictated by where the black cells fall in the grid. The position of the black cells will be allocated by me clicking on cells after the app has drawn the grid. I want to refer to the elements of each cell programatically using a single index number per cell. The letters will be filled in programatically some way as I write clues and solutions and enter the solutions into the grid. After the crossword has been compiled I will need to save the data in some format I shall have to devise.

My first thought was to create a control container with overlapping text fields but I find I can’t have a control set of control containers.

Thanks for any suggestions anyone can make. - Steve

I did a similar thing with a Sudoku grid. I used container controls and put them in an array. The project was posted in the 2018 Just Code Challenge, Week 12 entries: Just Code Challenge Week 12 Projects

Project file is here: Sudoku Solver Project

Refer to the “CellDisplay” container control, and the MakeGrid method in Window1.

1 Like

You could also do this with a single canvas and an array of cell classes. To make it really simple, add a PaintInto(g as Graphics) method on the class and then in the canvas that draws the overall grid, you loop through the cells, make a Clip of the area each cell will render into and pass that the each cell’s PaintInto method. It makes the management very easy.

Thanks for both those suggestions - will make a start on the project now