On Sun, 7 Feb 2021 10:46:11 +0100 QuentinC wrote:
Q> For a credits/about box, I would like to have static text that can
Q> contain several links.
Q> Those links should be focusable with tab, and it should be possible to
Q> take action when clicking them. Otherwise the rest of the text shouldn't
Q> be editable, and probably not even selectable/copiable.
Q>
Q> Example of text:
Q> My wonderful program, version 1.2.3
Q> Copyright (c) 2021, My Name
Q> Contact our support at
he...@example.com or go to our website
www.example.com
Q> This program is using library XXX copyright XXX, more info at
www.test.com
Q> This program is using library YYY copyright YYY, more info at
www.test.com
The simplest solution would be to use wxHtmlWindow.
Q> The standard wxMessageBox and wxAboutBox don't seem to support it out of
Q> the box.
Q> The about box allow to set a link, but only a single one, as far as I know.
Yes.
Q> wxHyperlinkCtrl doesn't seem to support multiple links, nor having one
Q> part of the text inside and another outside the link. The hole text of
Q> the control makes the link.
You could achieve this by juxtaposing several wxStaticText and
wxHyperlinkCtrl controls, probably, but using wxTextCtrl seems like a
simpler solution.
Q> It's probabgly going to be very hard to properly place a succession of
Q> wxStaticText and wxHyperlinkCtrl so to have a correct looking. I don't
Q> want to play with layout stuff for hours and don't see well how sizers
Q> could help in such a situation?
wxWrapSizer could be useful for this.
Q> wxTextCtrl with the style wxTE_RICH2 can show links and react to clicks
Q> on them, but it works only if URLs are written in clear (it may not
Q> always be the case).
The above should work just fine with it though and my initial suggestion,
until I read the paragraph above, was to use a wxTextCtrl with
wxTE_READONLY and wxTE_AUTO_URL styles. If you need anything more, you'll
have to use wxHtmlWindow, but wxTextCtrl has some advantages, notably from
the accessibility point of view.
Q> Using wxWebView for this is probably like trying to kill a fly with a
Q> tank? Far too complicated for what is worth, isn't it?
Yes.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/