Opened 5 years ago

Closed 5 years ago

#10159 closed defect (fixed)

EVT_LISTBOX for wxSimpleHtmlListBox doesn't include the selected string

Reported by: profdreamsmasher Owned by:
Priority: normal Milestone: 2.8.9
Component: GUI-generic Version: 2.8.x
Keywords: simple Cc:
Blocked By: Blocking:
Patch: no

Description

I have an EVT_LISTBOX event wxSimpleHtmlListBox. In the handler, calling wxCommandEvent::GetSelection() will indeed give me the selected index of the item in the wxSimpleHtmlListBox. However, calling wxCommandEvent::GetString() returns an empty string (instead of the selected string in the listbox). The help states:

"Returns item string for a listbox or choice selection event"

I would just assume this should work for a wxSimpleHtmlListBox too.

Change History (6)

comment:1 Changed 5 years ago by roebling

  • Resolution set to invalid
  • Status changed from new to closed

I don't know what should be included. The entire HTML string? This hardly makes sense to me.

comment:2 Changed 5 years ago by profdreamsmasher

  • Resolution invalid deleted
  • Status changed from closed to reopened

Just return whatever GetStringSelection() returns.

comment:3 Changed 5 years ago by vadz

  • Status changed from reopened to confirmed

Yes, this could be made to work for wxSimpleHtmlListBox (not for abstract wxVListBox however). We need to:

  1. Add
    virtual wxVListBox::InitEvent(wxCommandEvent& event, int n)
    {
        event.SetEventObject(this);
        event.SetInt(m_n);
    }
    

function.

  1. Call it from wxVListBox::SendSelectedEvent() and wxVListBox::OnLeftDClick()
  2. Override it in wxSimpleHtmlListBox to call event.SetString(GetString(n)) in addition to calling the base class version.

If you can make a patch doing this and -- more importantly -- test it, it would be great. TIA!

comment:4 follow-up: Changed 5 years ago by profdreamsmasher

I would rather not submit a patch. My coworkers tried sending patches before and received nothing but arguments and lecturing about stupid stuff like whitespaces, curly braces, and how they made their diffs. I thought reporting simple bugs could be a way for me to help out WX, but I have no interest in arguing over patches. I've already had enough lecturing about how I format my emails.

comment:5 in reply to: ↑ 4 Changed 5 years ago by vadz

  • Keywords simple added

Replying to profdreamsmasher:

I would rather not submit a patch.

This is a perfectly valid position. Unfortunately it's also completely unhelpful. Pity.

My coworkers tried sending patches before and received nothing but arguments and lecturing about stupid stuff like whitespaces, curly braces, and how they made their diffs.

This is however something I can't agree with. Yes, we do expect all wxWidgets code to be written using the same coding conventions for ease of maintenance (I'm sure the same is true for your own code base, isn't it?) and we do want to get patches which can be easily applied without spending any time on it instead of having to painstakingly apply them manually. I think this is very reasonable and I'm sorry that you consider explaining this to be insulting.

I thought reporting simple bugs could be a way for me to help out WX

Yes, it is. Reporting a bug is better than not reporting it. Making a patch to fix it is much better still.

but I have no interest in arguing over patches.

There is really no need to argue. We have the explanation of how to make patches and we have no problem at all with patches done using this way.

I've already had enough lecturing about how I format my emails.

I'm afraid this is another thing I can't agree with. Formatting the emails in a way easily readable by the people you send them to is just the online equivalent of social etiquette rules. But this is pretty irrelevant to patches and bug reports (unless you start making them in HTML...).

comment:6 Changed 5 years ago by FM

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [57643]) add the HTML string of the selected item to wxSimpleHtmlListBox events (closes #10159)

Note: See TracTickets for help on using tickets.