LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Save Panel position + size

Hello,
I would like to save a panel position and size each time I close it, and
restore these settings each time I open it.
This is to give the user, the possibility to customize the application
windows and have the settings restored automatically
when he starts the application.
I tried SavePanelState and RecallPanelState, but it does not save the size
and position of panels.
Any idea?
I am running CVI6.0 under Windows 2000.
Best Regards,
Marco
0 Kudos
Message 1 of 5
(3,738 Views)
In your QuitCallback (or whatever you call your exit function), use GetPanelAttribute to read the height, width, left, and top of the panel. Use the Windows Registry or an INI file to store those values.
When your program starts, read the Registry or the INI file to get those values, then SetPanelAttribute to set those values.
INI file functions are included in the function panel ..\CVI\toolslib\toolbox\inifile.fp. There's an example in ..\CVI\samples\toolslib\ini.prj.
Registry functions are included in the function panel ..\CVI\toolslib\toolbox\toolbox.fp. There's an example in ..\CVI\samples\apps\regadd\regadd.prj.
To temporarily access functions in a function panel, on the CVI menu, goto Instrument >> Load. To permanently add them to your project, goto Edit >> A
dd Files to Project >> Instrument (*.fp).
You may also want to include a checkbox or a command button to restore defaults and have some hard-coded defaults in your code.
0 Kudos
Message 2 of 5
(3,738 Views)
Thanks for your answer,
looks like this will solve my problem.

By the way, if I use the registry to store this information,
what will happen if I uninstall the application?
I guess those entries will remain in the registry, correct?
Is there a way to automatically remove them when the application is
uninstalled?

Best Regards,
Marco

"Al S" a écrit dans le message de
news:50650000000500000086230100-1042324653000@exchange.ni.com...
> In your QuitCallback (or whatever you call your exit function), use
> GetPanelAttribute to read the height, width, left, and top of the
> panel. Use the Windows Registry or an INI file to store those values.
> When your program starts, read the Registry or the INI file to get
> those values, then SetPanelAttribute to s
et those values.
> INI file functions are included in the function panel
> .\CVI\toolslib\toolbox\inifile.fp. There's an example in
> .\CVI\samples\toolslib\ini.prj.
> Registry functions are included in the function panel
> .\CVI\toolslib\toolbox\toolbox.fp. There's an example in
> .\CVI\samples\apps\regadd\regadd.prj.
> To temporarily access functions in a function panel, on the CVI menu,
> goto Instrument >> Load. To permanently add them to your project,
> goto Edit >> Add Files to Project >> Instrument (*.fp).
> You may also want to include a checkbox or a command button to restore
> defaults and have some hard-coded defaults in your code.
0 Kudos
Message 3 of 5
(3,738 Views)
Marco,

I don't thinks there is a way to claen the registry once the application is uninstalled. If you are concerned with leaving some stuff in the registry I would recommend that you use a ini file. But if you have just the panel information in the registry should not be that bad to leave it there. It's up to you.

Good Luck in you app!

Juan Carlos
N.I.
0 Kudos
Message 4 of 5
(3,738 Views)
Thanks for your answer,
I'll go for the ini file
Regards,
Marco

"JuanCarlos" a écrit dans le message de
news:50650000000500000037240100-1042324653000@exchange.ni.com...
> Marco,
>
> I don't thinks there is a way to claen the registry once the
> application is uninstalled. If you are concerned with leaving some
> stuff in the registry I would recommend that you use a ini file. But
> if you have just the panel information in the registry should not be
> that bad to leave it there. It's up to you.
>
> Good Luck in you app!
>
> Juan Carlos
> N.I.
0 Kudos
Message 5 of 5
(3,738 Views)