show "Table like" with wxMessageBox

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
zmau
Knows some wx things
Knows some wx things
Posts: 47
Joined: Wed Jun 15, 2016 11:41 am

show "Table like" with wxMessageBox

Post by zmau »

Hello all,
I need to display a "table" of information, and I would like it to look like a table (i.e. information in columns ).
The problem is that it looks differently, in different computes/OSes.
I could count the characters, and add spaces, but different characters have a different size on screen :-(
I wanted to "\t" in order avoid the fact that different characters have a different size on screen, but it looks as if the message box completely ignores the "\t".
Any advice as to how can I solve it ?
Is there a way to make all characters to have the same size on a specific message-box ?

I tried to search, but found nothing about this issue.

Thanks
zmau
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: show "Table like" with wxMessageBox

Post by PB »

I do not think this would possible and the only solution would be to use a custom dialog instead of wxMessageDialog / wxMessageBox().
zmau
Knows some wx things
Knows some wx things
Posts: 47
Joined: Wed Jun 15, 2016 11:41 am

Re: show "Table like" with wxMessageBox

Post by zmau »

PB wrote: Wed Mar 13, 2019 10:13 am I do not think this would possible and the only solution would be to use a custom dialog instead of wxMessageDialog / wxMessageBox().
Thanks for the quick answer.
Which custom dialog do you recommend (simplest solution) ?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: show "Table like" with wxMessageBox

Post by PB »

I meant to create one, basically mimicking wxMessageDialog but with having a grid-like control. Which one (e.g., wxListCtrl in report mode, wxGrid, grid of wxStaticTexts, ...) depends on the amount of information you need to present to the useer. Or, if you feel adventurous, you could use read-only wxTextCtrl set to look like a static text; where you obtain the "column" widths with its GetTextExtent() and set the tab stops accordingly (via wxTextAttr).
Post Reply