Hi folks.
I’m still trying to get my head around Xojo and I guess my question relates to something pretty fundamental that I’ve overlooked.
In a window I have a canvas (Canvas1) with a background colour and coloured text. I have been playing around with the ColorPicker exemple here :
https://documentation.xojo.com/topics/custom_controls/creating_a_color_selector_control.html
I have implemented it pretty much to the letter and added two instances of the ColorSelector to my window, one for the font colour, the other for the background… no problem up to there… I can pick colours in either of these. The problem is to apply them to the canvas.
As a temporary solution, I created a method “RefreshCanvas” and call it from a “MouseDown” event in the canvas. This works just fine too, but I’d like the canvas to be updated as soon as the colour is chosen in the ColorSelector. Ideally, the ColorPicker would be closed automatically as well (I can always dream!). On Macs running Big Sur, the ColorPicker has no close button, just a tiny close box in the top lefthand corner of the window.
My RefreshWall method code is simply :
BgCol = SelBgCol.SelectedColor
FontCol = SelFontCol.SelectedColor
Canvas1.Refresh(False)
BgCol and FontCol are variables in the Paint event of my canvas.SelBgCol and SelFontCol are my two instances of ColorSelector.
Can this be triggered automatically from some sort of event in the ColorSelector or elsewhere ?
Thanks for any help you can give a beginner