Editing uitable column widths with cursor does not update ColumnWidth property
이전 댓글 표시
I have a uitable with editable column widths (ColumnEditable = true). I've noticed, however, that when I resize a column in the table using my cursor that the ColumnWidth property for the table does not change. This is important because I have a resize callback function for my figure to adjust the width of my table columns after the user adjusts the figure window size, but if a user manually adjusts the column width of the uitable with the mouse cursor and then resizes the figure window afterward then the adjustment made by the cursor is lost.
fig = figure;
myTable = uitable('Data',[1 2 3; 4 5 6; 7 8 9],'ColumnWidth',{50,100,50},'ColumnEditable',true);
% Requesting ColumnWidth ("myTable.ColumnWidth") returns 50 100 50
% Now modify one of the column widths by dragging edge with cursor
% Requesting ColumnWidth again returns the same values even though width is
% now different!!!
Does anyone know where to retrieve the column width after they're edited with a cursor? I assume this can be done by querying the underlying java object (findjobj.m from Yair), but I didn't see the desired column width fields in my querying.
Thanks.
댓글 수: 3
Walter Roberson
2017년 5월 11일
Tricky.
Note: you can get to the java object of a uitable by using
java(myTable)
at least in R2017a. You get back a matlab_ui_control_TableBeanAdapter0
The java object includes a getColumnWidth method, but it appears to reflect only what you have set originally, not any change you made interactively.
Paul Shoemaker
2017년 5월 17일
편집: Paul Shoemaker
2017년 5월 17일
Walter Roberson
2017년 5월 17일
I suggest you move this into an Answer to make it easier for other people to find.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 App Building에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!