#15744 closed defect (fixed)

wxRichTextCtrl: HitTest can't find top-level floats

Reported by: dghart Owned by: juliansmart
Priority: normal Milestone:
Component: wxRichText Version: dev-latest
Keywords: wxRichTextFloatCollector hittest Cc:
Blocked By: Blocking:
Patch: yes

Description

Now that the cells of a floating wxRichTextTable are displayed, it's apparent that clicking or dragging inside one fails to set focus or select text. This can be seen in 'richtext'.

This is for two reasons. First, wxRichTextFloatCollector::HitTestFloat treats the floating control as a single object, which is correct for e.g. a wxRichTextImage, but not for a table. richtextbuffer.patch checks to see if it's top-level, and if so calls HitTest() on it.

That almost works, but unfortunately the current HitTestFloat() code does nothing to set the contextObj. That gets set later by wxRichTextParagraphLayoutBox::HitTest to be the buffer, which means that trying to select a cell's content will instead select random text outside the table, or nothing.

The fix for this is easy: just pass contextObj as an extra parameter to wxRichTextFloatCollector::HitTest and HitTestFloat. The patch does this, and it works. However I'm not sure if this extra parameter breaks binary compatibility for wx3.0. I read http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++ to mean that it should; however wxRichTextFloatCollector is defined in the cpp file and has only a forward declaration in the header, and testing here by switching richtext libs caused no problem.

Attachments (1)

richtextbuffer.patch download (4.5 KB) - added by dghart 11 months ago.

Download all attachments as: .zip

Change History (2)

Changed 11 months ago by dghart

comment:1 Changed 11 months ago by juliansmart

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

Thanks for another quality patch :-) This is binary compatible as it's self-contained in an implementation file and doesn't affect headers. Applied to 3 and trunk.

Note: See TracTickets for help on using tickets.