Copy/Paste from ListBox at runtime
Show older comments
Hello,
Is there a way to interactively select the entries in an AppDesigner ListBox and then copy them to a different application? Right-clicking on the elements in the list does not pop-up any context menu and also CTRL-C and CTRL-V do not seem to work...
Regards,
Cristian
Accepted Answer
More Answers (2)
Voss
on 9 Dec 2024
You'd have to implement any context menu or ctrl+c behavior.
An example using a context menu:
f = uifigure();
lb = uilistbox(f,'MultiSelect','on');
cm = uicontextmenu(f);
uimenu(cm,'Text','Copy','MenuSelectedFcn',@(~,~)clipboard('copy',mat2str(string(lb.Value))));
lb.ContextMenu = cm;
To have ctrl+c do the copying, you can set the uifigure's KeyPressFcn or WindowKeyPressFcn. See more: uifigure properties
Cristian Berceanu
on 9 Dec 2024
0 votes
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!