New monitor - how to reset experiments to previous displays

I have just upgraded my monitor to a better resolaution and size.  All of the panels, graphs with buttons are drawn at new sizes and for me the buttons are off the plot..  This can be resolved by adding modifygraph expand = 0.8 for example on each plot recreate macro  In miscellaneous settings Panel can be set so that all panels can have  expand set.  But how can I do this with plots/  I also use Igor on a laptop and same problem.   Is there a global setting that can be applied?

There are a few points to clear up before we (or at least I) can help you effectively. First, I assume you are on Igor 8/9 on Windows, right? Also, do you use your new monitor as a second monitor or as a replacement for your original one? In the latter case I would be surprised why you would see any change. Anyway, your monitor and its specs have little to do with what you see. More likely, your zoom level settings on Windows have adapted to your new monitor maybe? You can have a look by searching for 'Make everything bigger'. Your 0.8 scaling factor likely hints at a (default) setting of 150% where you had 125% previously. So you could simply scale this back to the previous value and then restart Igor. One thing is for sure: The physical size of graphs does not change just by getting a new monitor, so again your zoom settings might have changed. As for the misplaced buttons: The code you are working with is likely not scaling aware, and you have unknowingly worked with your personal zoom settings all the time, which looked just right. You would need to adapt the code (or ask the original author, if it's not you) to honor windows zoom settings, likely involving ScreenResolution. But I do not know enough about your problem to give any further advice.

UI elements such as graphs, panels, buttons, popup menus, etc... work with two different units: pixels and points. They are not the same. The scaling factor between the two is ScreenResolution()/72. On windows machine ScreenResolution() can be, I think, either 96 or 120, which can shift UI elements around if you didn't correctly account for the difference between points and pixels.

The whole thing is very confusing, I usually end up with randomly dividing or multiplying with ScreenResolution()/72 until the UI elements are correct with both 96 and 120. Maybe someone else can explain it better.

If you want to support zooming / panel expansion then you would even have to invoke PanelResolution() instead of the hard-coded '72'. I also wrote about this problem in other threads, for reference:

https://www.wavemetrics.com/forum/igor-pro-wish-list/panel-resolution

https://www.wavemetrics.com/forum/general/points-and-pixels

https://www.wavemetrics.com/forum/general/panel-size-vs-image-size

It is not that confusing, when you think in different categories. Most stuff which is exclusively panel related (such as NewPanel and control placement) is in screen pixels. Only when you start working with graphs and stuff (Display, MoveWindow etc.) does one need to worry about the physical size and, more often than not, points are involved.

In reply to by chozo

Reposting from this thread:

// control panel units:
// res=72: pixels or points
// res=96 or 84: pixels
// res>96: points

// for pixels within window
function cpu2pixel(variable cpu, [string win])
    variable expansion = ParamIsDefault(win) ? 1 : PanelResolution(win)/PanelResolution("")
    return expansion * (ScreenResolution > 96 ? cpu * ScreenResolution / 72 : cpu)
end

// for pixels within window
function pixel2cpu(variable pixel, [string win])
    variable expansion = ParamIsDefault(win) ? 1 : PanelResolution(win)/PanelResolution("")
    return (ScreenResolution > 96 ? pixel * 72 / ScreenResolution : pixel) / expansion
end

function point2cpu(variable point)
    return ScreenResolution > 96 ? point : point * ScreenResolution / 72
end

function cpu2point(variable cpu)
    return ScreenResolution > 96 ? cpu  : cpu * 72 / ScreenResolution
end

function point2pixel(variable point)
    return point * ScreenResolution / 72
end

function pixel2point(variable pixel)
    return pixel * 72 / ScreenResolution
end

// notes

// cpu are pixels for screen resolutions 96 AND 84 (and 72).
// MoveSubwindow /fnum= requires pixels, not cpu - help is wrong!
// MoveWindow uses points
// NewPanel uses control panel units
// Positioning controls with pos={x,y} uses cpu
// Moving controls positions with pos+={x,y} takes pixels!
// These are potentially not the same
// Button b0 pos={10, 20}
// Button b0 pos={10, 10}, pos+={0, 10}

// could alternatively define variables:

// variable cpu2point = ScreenResolution > 96 ? 1  : 72 / ScreenResolution

 

In reply to by chozo

Yes, forgot to say - Win10 Igor 9.  I replaced 2 sqaure format monitors with one larger panoramic with improved resolution. 

More likely, your zoom level settings on Windows have adapted to your new monitor maybe? You can have a look by searching for 'Make everything bigger'.

Searched Manual and Help > search files and didn't find anything using the expression in quotes?

The code you are working with is likely not scaling aware, and you have unknowingly worked with your personal zoom settings all the time, which looked just right. 

In a graphics macro (as used with original monitors) I have something like 

Button ZoomIn,pos={15.0,60.00},size={55.00,10.00},proc=ButtonZoomIn,title="Zoom In",fsize =8

which I adjusted to position where I wanted on the graphs with the size then.  When I changed monitor the graph window size had changed and buttons were missing.  

You would need to adapt the code (or ask the original author, if it's not you) to honor windows zoom settings, likely involving ScreenResolution. 

My screenresolution is 72.  So, I have to modify each graph macro using ScreenResolution to account for any changes between monitor or laptop?  Since Igor is screen resolution aware, I was hoping that this could have been dealt with in its software:-(

In reply to by tony

Thanks Tony

I am hoping I can make igor globally (automatically) aware of which PC monitor is is in use so that code (mainly graph windows) I have written on one monitor/PC will work on another or laptop.  I will have a look at the thread and  routines. 

Yeah, that's the problem with the abysmal control panel of Windows 10 and beyond. You never find what you are looking for and everything is bloated with unhelpful text. Anyway, you can also navigate to System => Display => Scale and layout (hopefully). Note that this setting is is monitor-specific in case of multiple monitors. The default here is 150%. I personally use 100% however.

Your button code looks fine, and as seen in the many discussions posted above, the values are interpreted in control panel units, which are the same as pixels for the most part. The question is how does the rest of your code look like. It is difficult to imagine why the button should disappear. It would be best of course, if you could post a simple test experiment file.

And yes, Igor honors the Windows zoom level, adapting the size of UI elements automatically. But if your code is not at least a bit adapted to this then you might get sub-optimal results.

If you're putting buttons on a graph (which is discouraged by WM), you're likely mixing whichever units are used in the Display command (points, inches or cm) and control panel units (for positioning controls).

It was my easy (crude) way of zooming , selecting an ancilliary plot or process based on the graph I was using.  Here I have clicked on a button to Zoom-in all three plots to the time on the lower plot cursor.  The triple plot button displays all three on one plot.

Looks like I will need to look at this again .....

 

You could move the buttons to the top left and align them at the very top. This way, any graph size changes would not obscure the buttons. I would also add:

ControlBar 50

or so to have them in a dedicated area at least.

Thanks for help all.  I am now able to get a better handle on things.  Also spotted on Misc Setting "Windows High-DPI Recommendations" which was helpful.

Mike, you might prefer to use ControlBar /L, instead, which would make room for your controls on the left.

But WaveMetrics *does* recommend you use a panel subwindow, like this:

Window Graph0() : Graph
    PauseUpdate; Silent 1       // building window...
    Display /W=(41.25,41.75,429.75,250.25) data
    ControlBar/L 114
    NewPanel/W=(0.2,0.2,0.8,0.8)/FG=(FL,GT,GL,FB)/HOST=#
    Button zoomIn,pos={23.00,42.00},size={70.00,20.00},title="Zoom In"
    RenameWindow #,PLeft
    SetActiveSubwindow ##
EndMacro