cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

testing a selected region

ptc-953343
1-Newbie

testing a selected region

My comment and review application allows the user to select a range
of content and wrap that with a comment. This works great for
everything but table content.

As long as they only select the text of a cell, the comment is
inserted properly, but if they select the cell or multiple cells
things don't work. In the case of a single cell, the content is
replaced by the comment they type. With multiple cells the table
thinks the cells are empty (they get a big X as content).

So I'm looking for a way to tell if the content they have selected
includes elements we use for custom table cells and rows., I need to
be able to detect the difference between just a row or cell selected,
vs the entire table being selected as this works fine.

thanks

..dan
3 REPLIES 3

Hi Dan--

If the users are using table mode to view and edit these elements, you'll probably need to use the custom table methods for accessing and changing the selection. Things get weird pretty fast if you try to munge table bits as just the underlying elements.

Look in the programmer's guide for information on a whole series of interfaces that start with Table, in particular TableObject, as well as ADocument.selectionType and ADocument.tableSelection.

As an alternative to using the table-specific API, you could test for a table selection, and then turn on table tags view, make your change at the element level, and then turn table tags off again.

Also, be aware that if you insert non-table markup into the structure of a table, you may break table rendering in the editor view. For example, if you intend to wrap a row element in a comment, you could end up with something like this:

<table>
<tgroup>
<tbody>
<row><cell>a</cell><cell>b</cell></row>
<comment comment="This" row=" is=" redundant&quot;=">
<row><cell>a</cell><cell>b</cell></row>
</comment>
</tbody>
</tgroup>
</table>

In most cases, the commented row won't display at all in the table view. (You can see it's still there by switching table tags on.) So this may not be the approach you want. In the context of a table, you might consider inserting rows or cells rather than using wrapper elements, something along these lines:

<table>
<tgroup>
<tbody>
<row><cell>a</cell><cell>b</cell></row>
<row colspan="2"><comment comment="The" following=" row=" is=" redundant&quot;="/></row>
<row><cell>a</cell><cell>b</cell></row>
</tbody>
</tgroup>
</table>

This is why tables have earned the well-deserved moniker "spawn of satan".

--Clay

At 05:34 AM 7/11/2008, Clay Helberg wrote:
>Hi Dan--
>
>If the users are using table mode to view and edit these elements,
>you'll probably need to use the custom table methods for accessing
>and changing the selection. Things get weird pretty fast if you try
>to munge table bits as just the underlying elements.

That's exactly what is happening.


>Look in the programmer's guide for information on a whole series of
>interfaces that start with Table, in particular TableObject, as well
>as ADocument.selectionType and ADocument.tableSelection.


This is a bit off topic, but it points up a problem I've been having
with Help Center that maybe someone can help with. So I look for
SelectionType and in this case I find info about the attribute and
the associated enumeration type. For one, unlike the regular help,
there is no Related section to help link these things together.
Secondly, all theses methods and such, have no reference back to the
interface they come from. Usually a search will also pull a bunch of
interface references, in this case ADocument for some reason is not
listed. So I just searched on adocument and the first two hits list
the interface, but its just an intro statement, again with no link to
get me to its parent or more details. This is the worst I've seen and
I can't hook it up with any interface, it doesn't appear to be part
of adocument either.


>As an alternative to using the table-specific API, you could test
>for a table selection, and then turn on table tags view, make your
>change at the element level, and then turn table tags off again.
>
>Also, be aware that if you insert non-table markup into the
>structure of a table, you may break table rendering in the editor
>view. For example, if you intend to wrap a row element in a comment,
>you could end up with something like this:

Yeah, I have two issues. I was able to get my process to work by
turning table markup on - at least it improved things. But then as
you show below, the comment tags get in the way of the table being
interpreted properly and I get the big X in cells affected.


><table>
> <tgroup>
> <tbody>
> <row><cell>a</cell><cell>b</cell></row>
> <comment comment="This" row=" is=" redundant&quot;=">
> <row><cell>a</cell><cell>b</cell></row>
> </comment>
> </tbody>
> </tgroup>
></table>
>
>In most cases, the commented row won't display at all in the table
>view. (You can see it's still there by switching table tags on.) So
>this may not be the approach you want. In the context of a table,
>you might consider inserting rows or cells rather than using wrapper
>elements, something along these lines:
>
><table>
> <tgroup>
> <tbody>
> <row><cell>a</cell><cell>b</cell></row>
> <row colspan="2"><comment comment="The" following=" row=" is=" <br="/>> redundant"/></row>
> <row><cell>a</cell><cell>b</cell></row>
> </tbody>
> </tgroup>
></table>
>
>This is why tables have earned the well-deserved moniker "spawn of satan".


Yeah I knew they were going to be a problem. They were already giving
us problems because they are custom tables and all the table editing
functionality is not available.

So can anyone help with more detail on this selectionType attribute,
it might be what I need.

Minimally, I would like to detect that they have selected table
structure items and stop the process. Currently my insert process is
all ACL commands and I looked in the help system through the table
functions that are provided and didn't find anything. I can switch
this over to Javascript if this attribute will provide what I need.

..dan


>--Clay
>
>-----Original Message-----
>From: Dan Vint [
>
>


At 09:08 AM 7/11/2008, you wrote:
>So can anyone help with more detail on this selectionType attribute,
>it might be what I need.
>
>Minimally, I would like to detect that they have selected table
>structure items and stop the process. Currently my insert process is
>all ACL commands and I looked in the help system through the table
>functions that are provided and didn't find anything. I can switch
>this over to Javascript if this attribute will provide what I need.


Looks like the getSelectionType is the method I need, but it doesn't
get to either of the areas in the documentation mentioned before!
I'll keep you posted if this works or not.

..dan
---------------------------------------------------------------------------
Danny Vint

Specializing in Panoramic Images of California and the West


Announcements