Need interface suggestions on how best to let the user reorder a list of objects.

I have created an app in app desginer where i have a list of objects as following
They are created form a table that holds all the values and graphic, but also a Order number and ID
I have touble finding a good solution to how I let the user change the order (moving one line of objects above or below a another)
Any suggestions are welcome.
Best JC

1 Comment

Here some of the things i have been looking at.
Pull and drop - not in matlab it seems
Two buttons beside each line, move one step up or down - many clicks to move a line far.
uicontextmenu - cant find what object line that evoke the called to create the menu when needed on right click and button that on left click opens the context menu cant place it next to it as I cant find the posstion of the button with scroll enable.

Sign in to comment.

 Accepted Answer

Hi Johan, you mentioned looking into using a context menu to provide options to reorder the rows in your app. This could work using the CurrentObject property of the UI figure, which stores the most recently clicked object in the figure.
For example, you can add this code to the MenuSelectedFcn callback of the relevant menu item to store the component that was right-clicked to bring up the context menu, and then use that info to rearrange the order:
selected = app.UIFigure.CurrentObject;

5 Comments

Hi Jasmine. Thanks for the answer. If i right click on the button, so it open the contextmenu, the CurrentObject is "0×0 empty GraphicsPlaceholder array" It seems like CurrentObject can not be a button.
I could mabye have ButtonGroup around each button and labels, but i feel its unintuitive for user that they need to right click beside/next-to buttons for functionality.
Best Johan
Hi Johan,
CurrentObject should be able to be a button. A couple things might be going on:
  • Querying CurrentObject in a UI Figure is supported starting in R2021a. If you're running an earlier release, that could account for the behavior you're seeing.
  • If you're using R2021a, make sure that the button has HandleVisibility set to 'on' or 'callback'. A component with HandleVisibility = 'off' cannot become the current object.
Hi Jasmine. Thanks for the reply!
My version is 9.9.0.1592791 (R2020b) Update 5, ill get it updated and try again :-)
Best Johan
Hi again Jasmine.
It worked! :-) after updateing to version 2021a.
On the negativ side, updating to 2021a gave new problems as a function i called many times now gives an error "Undefined function 'insertText'".
Best Johan

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Release

R2021a

Asked:

on 11 Aug 2021

Commented:

on 17 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!