From: Adam on
Hi,

I'm making a GUI that takes in input via a table. As the user, you would add data then click start to run the algorithm using the data from the table. My issue is that the Data in a cell is not updated until the user actually moves away from the cell. Is there a way to have the data update upon the value being changed. The table's callback also only runs once the user have moved away from the cell.

The problem is say the user changes the value in cell 1 from '3' to '5', then immediately clicks on the start button (without clicking somewhere else first). When I retrieve from the cell the value is still '3'. Is there a work around this? Perhaps, some way to force a update on the cell data.

Thanks a lot,

Adam
From: us on
"Adam " <abc5(a)ubc.ca> wrote in message <hvgi36$od5$1(a)fred.mathworks.com>...
> Hi,
>
> I'm making a GUI that takes in input via a table. As the user, you would add data then click start to run the algorithm using the data from the table. My issue is that the Data in a cell is not updated until the user actually moves away from the cell. Is there a way to have the data update upon the value being changed. The table's callback also only runs once the user have moved away from the cell.
>
> The problem is say the user changes the value in cell 1 from '3' to '5', then immediately clicks on the start button (without clicking somewhere else first). When I retrieve from the cell the value is still '3'. Is there a work around this? Perhaps, some way to force a update on the cell data.
>
> Thanks a lot,
>
> Adam

one of the solutions as a skeleton

uh=uitable;
set(uh,...
'data',magic(2),...
'columneditable',true,...
'celleditcallback','get(uh,''data'')');
% now change values and move the focus away from the cell...
% eg, TAB, mouse click, etc...

us
From: Adam on
"us " <us(a)neurol.unizh.ch> wrote in message <hvgk4m$4qg$1(a)fred.mathworks.com>...
> "Adam " <abc5(a)ubc.ca> wrote in message <hvgi36$od5$1(a)fred.mathworks.com>...
> > Hi,
> >
> > I'm making a GUI that takes in input via a table. As the user, you would add data then click start to run the algorithm using the data from the table. My issue is that the Data in a cell is not updated until the user actually moves away from the cell. Is there a way to have the data update upon the value being changed. The table's callback also only runs once the user have moved away from the cell.
> >
> > The problem is say the user changes the value in cell 1 from '3' to '5', then immediately clicks on the start button (without clicking somewhere else first). When I retrieve from the cell the value is still '3'. Is there a work around this? Perhaps, some way to force a update on the cell data.
> >
> > Thanks a lot,
> >
> > Adam
>
> one of the solutions as a skeleton
>
> uh=uitable;
> set(uh,...
> 'data',magic(2),...
> 'columneditable',true,...
> 'celleditcallback','get(uh,''data'')');
> % now change values and move the focus away from the cell...
> % eg, TAB, mouse click, etc...
>
> us

Thanks us, that is basicly what I have now.

What I have:
set(handles.inputTable,...
'BackgroundColor',[0.93 0.93 0.93
0.7 0.9 0.9 ],...
'Units','normalized',...
'Data',dat,...
'Enable','on',...
'RowName',rownames,...
'CellEditCallback',@inputTable_Callback,...
'ColumnWidth', columnwidth,...
'ColumnName', columnname,...
'ColumnFormat', columnformat,...
'ColumnEditable', columneditable);

function inputTable_Callback(source, eventdata)
data=get(source,'Data')
numericCheck(data{eventdata.Indices(1),eventdata.Indices(2)})
end

This doesn't work since 'Data' is not changed upon keystroke, but rather when the user moves focus away from the cell.
From: Adam on
After more testing, it seems things are even worse than I thought. You must click on a cell in the table for the data to update. Even click away from the table to another textbox won't update the contents.
From: Walter Roberson on
Adam wrote:

> The problem is say the user changes the value in cell 1 from '3' to '5',
> then immediately clicks on the start button (without clicking somewhere
> else first). When I retrieve from the cell the value is still '3'. Is
> there a work around this? Perhaps, some way to force a update on the
> cell data.

It's a known limitation in all kinds of edit fields. I don't know what the
technical limitation *is*, but I gather it is considered to not be fixable.

The work-around is to use key press callbacks and to handle each key press
independently, including things like handling the pressing of backspace as
meaning you want to correct the previous character. This approach has some
difficulties as well.

My memory is a bit fuzzy at the moment (too much hot chocolate); I seem to
recall that to do the key press callbacks for a uitable that you might have to
go in at the java level. If so then the technique will be described in more
detail at http://undocumented-matlab.com
 |  Next  |  Last
Pages: 1 2
Prev: Accessing hardware and DLLs in MatLab
Next: Smooting