[wx-dev] markup in wxStaticText (Re: wxStaticText GTK woes)

Vadim Zeitlin vadim at wxwindows.org
Thu Jan 11 09:18:41 PST 2007


On Thu, 11 Jan 2007 15:14:31 +0100 Francesco Montorsi <f18m_cpp217828 at yahoo.it> wrote:

FM> Looking at  wxControl::GetLabelText()  I wonder if we couldn't just add 
FM> markup support on by default...

 Is it really needed? I.e. why complicate things, is it really so difficult
to call SetLabelMarkup() or use wxST_MARKUP style?

FM> Then we'd have the following public functions in wxStaticText:
FM> 
FM>    - SetLabel(): works as usual but recognizes not only mnemonics but 
FM> also markup ('recognize' here means that when toolkit != GTK+2 the 
FM> markup is stripped out)

 While '<' symbols are not used often in static labels, it still risks to
be quite surprising to people who do use them.

FM>    - GetLabel(): works as usual but returns the label not only with 
FM> mnemonics, also with markup.

 And this could potentially be even more surprising...

FM>    - GetLabelText(): works as usual but not only strips out mnemonics; 
FM> strips out also the markup. Both a static and non-static version of this 
FM> function would be available.
FM> 
FM>    - [new] SetLabelText(): calls SetLabel() after escaping all 
FM> occurrences of mnemonics and markup; could be used when the programmer 
FM> wants to display e.g. HTML sources , i.e. does not want to have 
FM> wxStaticText recognize mnemonics and markup.

 Both of these could be useful though.

FM> The reasons why I'm proposing this change are:
FM> 
FM>   1) just like mnemonics-support is on by default (and cannot be 
FM> disabled) it would be sensed to have markup support by default

 Mnemonics are supported by all ports (except wxGTK1 maybe) while markup is
GTK2-only (for now) and is also much less wide spread: all static texts
have mnemonics normally but not all of them use markup.

FM>   2) it would make wxWidgets sources less complicated.

 I can't really judge about this but I don't really understand why?

FM>   3) is we use wxST_MARKUP only a non-static version of GetLabelText() 
FM> could be available

 Not a big deal IMO.

 Regards,
VZ





More information about the wx-dev mailing list