bgrabitmap / bgracontrols

🆗 BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications.
https://bgrabitmap.github.io/bgracontrols/
187 stars 32 forks source link

Tbgrathemesurface class inherited from #152

Closed lainz closed 1 year ago

lainz commented 1 year ago

Hi @circular17 is possible to inherit this class from TWinControl instead of Custom Control.

For example in Lazarus there is TCheckListBox and I can't use Tbgrathemesurface on its custom drawing.

circular17 commented 1 year ago

Hi Lainz. I am not sure it is possible because TBGRAThemeSurface accesses the Canvas property of the control and TWinControl doesn't have this property.

If I understand, TCheckListBox has "owner drawn" events where you would like to use TBGRAThemeSurface? Maybe, if at this point there is a canvas provided, it is possible to make an alternate constructor that takes the Canvas as well as a parameter.

lainz commented 1 year ago

Hi yes it has a canvas. Sure an alternative constructor can do.

circular17 commented 1 year ago

Ok, Lainz. Go ahead and give it a shot with the alternate constructor idea. I think it's a promising approach. If you need further discussions or face any hurdles, I'm here to help and listen.

lainz commented 1 year ago

Thank you I will try.

lainz commented 1 year ago

Done. Seems that works fine. But I don't have macOS retina to test, can you give a try, the demo is in bgracontrols\test\test_checklistbox

circular17 commented 1 year ago

Cool! I've checked it out and it works well.

I've made some adjustments by adding a scale factor and some margin. On MacOS, there's a frame rectangle that inverts the color and it was masking the square of the checkbox. With these changes, it looks good now.

Could you pull the latest and check on your end as well? Let me know if you have any further concerns.

lainz commented 1 year ago

Working well, thankyou! Now we have another working demo =)