Panel resolution

Hi there,

We have a rather decent amount of code written in igor 6 and recently migrated our procedure file to igor 8 (which by the way highly facilitates coding, well done!). However, we are faced with the problem that all our panels look too big in igor (windows 120 dpi, 125 % zoom as recommended by windows). I tried to zoom back to 100 % under windows and made the size of the text larger, but this resulted in rather ugly symbols and task bar, although it solved the problem of the panels in igor.

When using the command "SetIgorOption PanelResolution = 72" and then reopening the panels this works marvellously well. However, when closing and reopening the experiment igor seems to take again the default value "SetIgorOption PanelResolution = 1" and then the only option is to close and reopen all panels again, which is okay but rather annoying when one had several panels, subpanels and graphs already open.

Is there a way to store in the igor options that igor should start with "SetIgorOption panel resolution = 72" rather than the default "SetIgorOption panel resolution = 1"? This would highly facilitate the life of many users of our software package in igor.

Thanks already in advance for your reply!

Best,

Francesco

You can write it into the code that creates the panels, something like this:

        Execute/Q/Z "SetIgorOption PanelResolution=?"
        NVAR vf = V_Flag
        variable oldResolution = vf
        Execute/Q/Z "SetIgorOption PanelResolution=72"

This allows you to return the setting to 'normal' after creating the panel.

Or you could wait for a future version of Igor to handle panel size much more elegantly.

When you say "a decent amount of code", what we are talking about? If you want to fix this, you 'just' have to modify the lines where you either set or use the panel sizes. Look out here especially for MoveWindow and SetWindow (for sizelimit). Note that the NewPanel command does not need treatment here. You need to introduce a factor to each size value (either by multiplication or division, depending on which direction you need): 

Variable convertPointsToPanelPix = ScreenResolution/PanelResolution(panelName)

In reply to by chozo

Hi Chozo,

We have roughly 50 panels with on average 20 entries (in terms of buttons, variables, menus, etc.). Last week I wanted to loop over all my panels and resize exactly how you mentioned above. However, it seemed like I have to modify also all other lines where I defined a position, i.e., also for all buttons, variables, menus etc.). Or did I miss something? Can I use setwindow to define the new limits and then the interior of the panel will just follow? If not, this would mean to loop over ~1000 lines of code and that is definitely something I'm not going to do.

The command  "SetIgorOption PanelResolution = 72" works just fine when introduced before calling any panel. I basically want this to be also called before recreating the panel after reopening a new igor experiment.

Best,

Francesco

Hi Francesco,

Maybe I am wrong here, but I would think that you should not need to touch the controls or the panel creation at all. The NewPanel command as well as all control definitions (pos, size) use screen pixels, which, as far as I know, should be fine either way. Only where points as unit is used (e.g., MoveWindow) should you need the conversion factor. Maybe you are willing to post one panel example which is off, and we can have a look. Otherwise, you could keep using the workaround and have a small function which loops over all open panels, saves their recreation macro, then sets the PanelResolution to 72 and reopens all panels. You could even run such a script automatically at start.

Hi Chozo,

Please find below/attached the two images ("after recreating the panel", this is the normal and expected shape of our main panel) and ("after reopening", is when closing and restarting igor, the panel is oversized). Normally, then we have to close the panel and reopen it after having internally called the line "SetIgorOption PanelResolution = 72". 

I tried to rescale the panel, but then the size of the panel was okay, but the interior (controls, images, txt) remained the original size, so I'm not sure what to do here.

As for your suggestion of the workaround, how could I call this at very start? I mean is there a way to let igor execute some command when starting? if so, I could call first "SetIgorOption PanelResolution = 72" and then the panels would appear in the proper shape, right?

Best,

Francesco

normal panel shape (94.34 KB) large panel (143.81 KB)

Hmm... That looks really like everything just gets bigger. Could this be some problem with high-DPI scaling? Maybe you want to give it a try to disable high-DPI scaling under Miscellaneous Settings > Miscellaneous (or follow the instructions listed there) and see where this gets you:

DisplayHelpTopic "Windows High-DPI Recommendations"

I wouldn't think this is caused by wrong size settings in the code. In other words, the same size seems to be upscaled, which I think hints at the high-DPI display compensation introduced since Igor 7. Maybe someone with more in-depth knowledge of the onscreen scaling can help out here.

As for executing something at the start of Igor, you might want to look into the IgorStartOrNewHook() function. You could set the panel resolution override there upon every start.

I would be remiss if I did not point out that Igor 9 has/will have "panel expansion" which allows you to set a default expansion/contraction factor to make panels and their contents bigger or smaller than "usual".

There's also a Panel->Expansion submenu so you can alter the expansion/contraction of the active panel.

Under the hood, it is changing the panel resolution from the default.

Hi,

Thanks a lot for all your very fast support and valuable input, really highly appreciated!

Excellent, I'm really looking forwward to igor 9. I guess that in the meantime the users will have to update their panels as workaround.

 

Best and have a nice weekend!

Francesco