points and pixels

GetMarquee with no specified axis gives me coordinates in points.

On Windows, if screenresolution is 96, I need a correctionfactor of 96/120 if I want to position a control in the graph window based on the points from GetMarquee.

What is the unit?

 

i think i have figured out the answer to my question:

if you don't restart igor after changing windows settings, things get confusing.

If you need 96/120, you no doubt have your display set to 125%. Or it's quite possible that the factor you need is actually 72/96. They aren't quite the same, but maybe close enough that you didn't notice a small inaccuracy.

Jim Prouty is the expert on this topic and on vacation, but chozo has quite a lot of experience with the necessary adjustments for screen resolution on Windows. Perhaps he will chime in when the sun comes up in Japan.

Are you putting controls into a graph window? Or are they in a control bar? We would recommend never putting controls directly into a graph. The best solution is to use a panel sub-window for the controls. Sometimes it actually makes sense to create a panel as the top-level window and add a graph subwindow. There might be further problems if you use graph expansion, and a panel (should) get around that. If you use a panel, you can use ScreenResolution/PanelResolution(). I personally like exterior panels attached to a graph- that keeps the windows together, but independent in most operational respects.

I am a bit late to the party, but I think John has already given the best answer, and it seems that Tony has figured everything out for himself. Yes, the GetMarquee function reports values in points if no axis is defined. So probably everything that is left for me to do is to quickly summarize the situation for others:

In Igor many coordinates are defined in the unit 'points' instead of screen pixels. Points are a fixed unit with 72 points per inch. On the other hand, the number of pixels per inch depends on the particular OS setting (which often enough has no bearing on real life measurements of your computer monitor such settings are intended to represent, but this will lead too far). On Mac this resolution setting happens to equally be 72 pixels (dots) per inch, so on Mac points = pixels. On Windows the resolution is not 72 dpi and depends on the font setting, but is most often larger (either 96 or 120 pixels per inch).

In short: point and pixel values are not the same on Windows (unlike Mac) and need to be converted taking the screen resolution setting into account. This can be done with the following conversion:

Variable pixels = numPoints * (ScreenResolution/72) // Convert points to pixels
Variable points = numPixels * (72/ScreenResolution) // Convert pixels to points

If one wants to get the units figured out for a panel instead of a graph, then the new panel magnification feature requires an additional step. Enlarged panels have a different resolution, which can be readily queried with the PanelResolution() function. In case of panels it is better to use:

Variable pixels = numPoints * (ScreenResolution/PanelResolution(panelNamestr))  // Convert points to pixels
Variable points = numPixels * (PanelResolution(panelNamestr)/ScreenResolution)  // Convert pixels to points

Above conversion also works for graphs, by the way, since PanelResolution() invoked for graphs reports 72.