dimanche 27 septembre 2020

What is the easiest way to emulate a 'has focus' box around a wxButton?

I have a dialog and at the bottom a normal box sizer with 3 buttons in it. When I do

m_buttonCancel->SetDefault();

the code works in the sense that pressing enter does cancel, but there is no visual clue that this is the default button. I would like the button to have a rectangle around it, similar to when I say

m_buttonCancel->SetFocus();

Problem is: other widgets often have the focus, like wxTextCtrl widgets in the dialog. Then this focus border around the button disappears, but I would like it to stay. Of course, I could put this button in a panel and set the border style, but then the size of this button would be different from the others or I must put these in separate panels also (but without border).

There must be an easier way to draw a border around a button, without changing the size of any button and without affecting the layout?

OS: CentOS, so wxWidgets uses Gtk.

Aucun commentaire:

Enregistrer un commentaire