Re: FXListbox and ampersand

[email protected]
Newsgroups gmane.comp.lib.fox-toolkit.user
Message-ID <[email protected]>
On 2021-09-09 19:25, John Selverian wrote:
> I using fox 1.7.50
> 
> In a list box when I have "B & W", it shows up fine in the dropdown
> but when selected it shows as "B _ W"
> 
> If I use "B && W" instead is shows up as "B &&W" in the dropdown and
> fine when selected.
> 
> Kind regards,

Thanks for the bug-report.

Here's how it was fixed:

FXLabel::setText() did the same as FXLabel's constructor, and parsed 
incoming
string for the hotkey, offset of the hotkey from the start of the 
string, and
then removed the & from the sting.

This has been changed.

Now, FXLabel::setText() just sets the string.  It "forgets" the hotkey 
location,
i.e. it will no longer draw it [since the string was changed, we don't 
know where
the underline will go].

It does remember the hotkey, and the hotkey will still work [and be the 
same modifiers & key].

This should therefore leave any "&" in the string intact.

A new API called setTextAndHotKey() was added to allow one to set both 
text and
hotkey from one string.  In places where it matters you can therefore 
replace
setText() with setTextAndHotKey().

Since we're also updating via messages ID_SETSTRINGVALUE, this calls 
setText() which is probably more in line with what people expect.

FXMenuCaption and FXToggleButton used similar logic; these were changed 
as well.

The fixes should appear in the next snapshot soon...



     -- JVZ
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.