How to put multiple Html container cells on one line in HtmlWindow?

I’m trying to write an application that does different things when the user clicks on different parts of a displayed text. The strategy I thought of was to put the text in an HtmlWindow and use container cells to divide the text into the relevant parts. I don’t know if this is the best strategy; I would welcome other suggestions.

Anyway, the attached file is a simple attempt to test my strategy. It doesn’t work satisfactorily because it puts the text in the different container cells on different lines, whereas I need to be able to have them on the same line. (In the example, “Text 1” and “Text 2” should be on the same line but they aren’t.) Is it possible to have different container cells on the same line and, if so, how?

Thanks,
Patrick Maher

tagtest.py (1.21 KB)

Patrick Maher wrote:

I'm trying to write an application that does different things when the
user clicks on different parts of a displayed text. The strategy I
thought of was to put the text in an HtmlWindow and use container
cells to divide the text into the relevant parts. I don't know if this
is the best strategy; I would welcome other suggestions.

Anyway, the attached file is a simple attempt to test my strategy. It
doesn't work satisfactorily because it puts the text in the different
container cells on different lines, whereas I need to be able to have
them on the same line. (In the example, "Text 1" and "Text 2" should
be on the same line but they aren't.) Is it possible to have different
container cells on the same line and, if so, how?

As far as I can tell, "container" maps to HTML block elements (like
<div>), and "cell" maps to HTML inline elements (like <span>).
Interesting that there seems to be no way in a tag handler to access the
cell currently under construction.

wx.html really has a very limited set of uses.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Try asking about this on wx-users as Vaclav, the author of wxHtml will see it there and may have a solution for you.

···

On 1/18/12 7:34 AM, Patrick Maher wrote:

I'm trying to write an application that does different things when the
user clicks on different parts of a displayed text. The strategy I
thought of was to put the text in an HtmlWindow and use container cells
to divide the text into the relevant parts. I don't know if this is the
best strategy; I would welcome other suggestions.

Anyway, the attached file is a simple attempt to test my strategy. It
doesn't work satisfactorily because it puts the text in the different
container cells on different lines, whereas I need to be able to have
them on the same line. (In the example, "Text 1" and "Text 2" should be
on the same line but they aren't.) Is it possible to have different
container cells on the same line and, if so, how?

--
Robin Dunn
Software Craftsman

I found that HtmlContainerCell has a method called SetWidthFloat that is supposed to be able to change the width of a container cell to be less than the whole line. The width has to be a fixed number of pixels or else a fixed percentage of the parent container, like in an html table. I didn’t get this to work for me but perhaps it would have if I’d pursued it further. I gave up on it for two reasons: (1) The requirement of a fixed width is too limiting for my purposes; (2) I found that I can do what I want with either TextCtrl or RichTextCtrl.

The way I use TextCtrl is to keep track of the character positions where a given section of text begins and ends, then use GetInsertionPoint to find where a mouse click occurred (this works because the mouse click moves the insertion point), then determine the section of text in which the click occurred, and then have the program respond in the way appropriate for that section of text.

Patrick Maher