From: Eyal on
I am trying to create a uitable where clicking on a cell will select
the entire row. In Matlab 2007, this was relatively simple:

ht=uitable();
h=ht.getTable;
h.setColumnSelectionAllowed(1);

However, in Matlab 2008 (which I'm using), uitable returns a standard
graphics handle, rather than a handle to the java object. java(handle
(ht)) doesn't help, since that returns a handle to something else
(possibly a wrapper) rather than the uitable java. I can get an old-
style uitable handle with uitable(' v0 '), but that has other
drawbacks (primarily that apparently the deprecated version of uitable
does not support autowidth for columns)

I have managed to get the UITablePeer class object by using the
following:

ht=uitable;
h1=findjobj(ht);
h2=get(h1,'viewport');
h3=get(h2,'view');

findjobj being a function available on the file exchange. However,
while the resulting object does have a setColumnSelectionAllowed
method, it doesn't seem to do anything when set to 1. I noticed that
the object I get in the second case is of class UITablePeer$22, while
the object in the old uitable is different (I don't remember it
exactly, but the part after the dollar sign is different, SpreadSheet
or something similiar - I'm not really very familiar with classes in
Matlab and I don't know what the dollar sign signifies).

Can anyne suggest a solution? (either to my method or a different
approach)

Thanks
From: Eyal on
OK, I managed to solve the problem; turns out that in this version of
Matlab, you need to set the NonContiguousSelection (or something like
that, I don't have it in front of me right now) property of
UITablePeer to 'off' before ColumnSelectionAllowed will do anything.

On a related note, does anyone know how a simple way to obtain the
UITablePeer object? I'd prefer to do it without an external function
(or a long subfunction in my main one)

On Dec 15, 4:24 pm, Eyal <eflemi...(a)gmail.com> wrote:
> I am trying to create auitablewhere clicking on a cell will select
> the entire row. In Matlab 2007, this was relatively simple:
>
> ht=uitable();
> h=ht.getTable;
> h.setColumnSelectionAllowed(1);
>
> However, in Matlab 2008 (which I'm using),uitablereturns a standard
> graphics handle, rather than a handle to the java object. java(handle
> (ht)) doesn't help, since that returns a handle to something else
> (possibly a wrapper) rather than theuitablejava. I can get an old-
> styleuitablehandle withuitable(' v0 '), but that has other
> drawbacks (primarily that apparently the deprecated version ofuitable
> does not support autowidth for columns)
>
> I have managed to get the UITablePeer class object by using the
> following:
>
> ht=uitable;
> h1=findjobj(ht);
> h2=get(h1,'viewport');
> h3=get(h2,'view');
>
> findjobj being a function available on the file exchange. However,
> while the resulting object does have a setColumnSelectionAllowed
> method, it doesn't seem to do anything when set to 1. I noticed that
> the object I get in the second case is of class UITablePeer$22, while
> the object in the olduitableis different (I don't remember it
> exactly, but the part after the dollar sign is different, SpreadSheet
> or something similiar - I'm not really very familiar with classes in
> Matlab and I don't know what the dollar sign signifies).
>
> Can anyne suggest a solution? (either to my method or a different
> approach)
>
> Thanks