I would like to be able to create single line wxTextCtrls so their width is
set to the maximum number of characters they need to hold.
I came across wxDLG_SZE() but it's not clear to me how I should use it to
create, for example, a wxTextCtrl to hold a maximum of 10 characters.
Is there another function I need to call?
regards
Richard Townsend
Richard Townsend wrote:
I would like to be able to create single line wxTextCtrls so their width is
set to the maximum number of characters they need to hold.
I came across wxDLG_SZE() but it's not clear to me how I should use it to
create, for example, a wxTextCtrl to hold a maximum of 10 characters.
I doubt that that will work properly, unless you force the control to use a fixed width font and even then I'm not sure you'll get it to work properly.
In non fixed width fonts the characters have different sizes i.e.
10 x i is not as wide as 10 x A so you can't set one size.
If you use a fixed width font then you could play around with a wxClientDC and it's method DC.SetPointSize(size), DC.SetFont(f) and DC.GetTextExtent(string) but, as I said, I'm not sure if that will work.
Regards
Adi