When creating a UiTable and trying to display a pop-up menu in a cell, the point down arrow does not appear.
4 views (last 30 days)
Show older comments
I am trying to create a drop down menu with different options in a cell for UITable. But when the GUI appears the cell looks exactly as the others and only when i double click it the option menu (and the down arrow) appears.
My code is:
d = {'LogStart', 0.2, 'Log End', 800, 3000};
ColumnNames = {'BGGas top Zone name', 'BGGas value %',...
'BGGas base zone name', 'BGGas top zone depth',...
'BGGas base zone depth'};
zones = {'LogStart', 'Neogene', 'Paleogene', 'Cretaceous', 'Jurassic',...
'Triassic', 'Permian', 'Carboniferous', 'Devonian', 'Silurian',...
'Ordivician', 'Cambrian'};
fig = uifigure('Name', 'Enter Background Gas Value',...
'CloseRequestFcn',@Parent_closefcn);
%-------Table------
uit = uitable(fig);
uit.Position(1:2) = [10,150];
uit.Position(3:4) = [fig.Position(3)-20, fig.Position(4)-220];
uit.ColumnSortable = false;
uit.RowName = 'numbered';
uit.ColumnName = ColumnNames;
uit.Data = d;
uit.ColumnFormat = {zones, 'numeric', 'char', 'numeric', 'numeric'};
uit.ColumnEditable = [true true false false false true];
When running my code my GUI looks like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/409845/image.png)
And when double clicking:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/409850/image.png)
Any idea why the drop down menu arrow is not appearing?
Thank you in advance.
2 Comments
Debasish Samal
on 13 Nov 2020
Hi Alejandro!
As far as I know, you have to click once on the particular cell you want to edit and click a second time for the drop down menu to appear and select an option from the menu.
I found an answer with a workaround which might help you here. Please refer to the MATLAB Answer below:
I have not tried it myself. Please try and see if it works for you.
Thanks.
-Debasish
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!