Setting focus to background figure or invisible figure
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi All
I have a guide-GUI that generates figures (of the same size and screen position) that need to be compared sometimes, for which the user can use alt-esc and alt-shift-esc to flick to-and-fro. To avoid the finger judo I have a WindowKeyPressFcn acting on leftarrow and rightarrow for this purpose.
It is hard enough keeping the focus on the GUI window after you start pushing arrows keys; the figure easily loses focus (without the mouse clicking elsewhere at all) and the keypress starts acting in the command window. To solve this I do an emulated mouseclick in the GUI figure at the end of the callback.
The real problem comes in when the user has one monitor, because the figures are big and therefore obscure the GUI so my emulated mouse click doesn't work. Is there a way to set focus on a figure in the background, or better yet an invisible figure? If the callback can work from an invisible figure I can simply use a third key (like escape) to make it visible again.
Appreciating any advice!
0 Commenti
Risposte (1)
Image Analyst
il 16 Ago 2017
Modificato: Image Analyst
il 16 Ago 2017
If you have the variable handle to the figure, you can bring it to the front with the figure command.
hFig = figure(); % Create new figure and save its handle.
% Now do something to bring other figures in front.
% Now bring hFig to the foreground:
figure(hFig);
You could put all the figure names in a popup control on your main GUI so the user can select which figure to bring to the foreground.
1 Commento
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!