StollLab / EasySpin

MATLAB toolbox for Electron Paramagnetic Resonance (EPR) spectroscopy
http://easyspin.org
MIT License
48 stars 25 forks source link

esfit: table focus resets each iteration #289

Closed stestoll closed 1 year ago

stestoll commented 1 year ago

For a parameter table with a scroll bar, the scroll bar resets to top after every iteration. This makes it impossible to follow a parameter at the bottom of the table. Seen both on Mac and on Win10.

stestoll commented 1 year ago

Here is a MWE - unselect all fit parameters except the last one.

clear, clc

Sys.g = [2 2.01 2.02];
Sys.Nucs = '1H,1H,1H';
Sys.A = [10 20 30; 5 8 12; 3 15 30];
Sys.lwpp = 0.1;

Exp.mwFreq = 9.5;
Exp.Range = [334 341];

[B,spc] = pepper(Sys,Exp);

vSys.g = [1 1 1]*0.003;
vSys.A = [1 1 1; 1 1 1; 1 1 1]*4;
vSys.lwpp = 0.05;

esfit(spc,@pepper,{Sys,Exp},{vSys})
cetait commented 1 year ago

This issue can be fixed by moving completely to App Designer uicomponents, however, it seems that to maintain all of the functionality of the esfit GUI, so far it looks like the Matlab release needs to be R2019b or later. Using App Designer uicomponents simplifies dealing with other parts of the GUI as well.

To fix this issue in older versions of Matlab easily would require using undocumented features at the Java level, but it seems that Matlab is going to make it more difficult to interact with Java objects in the future, so I'm not sure how long this would then work for newer Matlab versions.

Depending on how important support of old Matlab versions is, one option could be to switch between different versions of the esfit GUI depending on the release used.

stestoll commented 1 year ago

IMO we should not fix this. Using undocumented Java is going to be very brittle going forward.

I think it's worthwhile considering implementing EasySpins' GUIs using uicomponents - but that's a separate issue and doesn't have to be part of 6.0.