LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Menus

Hi All

 

A bit of a weird one here.

 

We have written some control software with CVI that we distribute to customers with equipment we manufacture. The first version was release almost 20 years ago. It has been updated ever since. 

 

For the last 3 so so years, I have been maintaining and updating as required for our needs. 

 

In the last few months my colleagues and our customers have been informing me of some bazar activity.

 

The software creates menus dynamically. When first started, three menu items are added to the menu bar (File, Window, Help). When the user initiates a connection to our equipment, two more menu items are added (Logger and Advanced). These are inserted before the Window menu item. 

 

Now for the weirdness. This NEVER happens when the application is run in either Debug or Release from the IDE. It also never happens when the Release Version is executed from the build directory (in my case, this is alongside the source files). 

 

It ONLY seems to happen from the installation directory (i.e. after I have created the distributable and installed it). Further, if the user disconnects from our equipment and reconnects (without terminating the application) it also does not happen. If the application is terminated and restarted, the first connection attempt suffers the above noted effects. 

 

In the three or so years I have been maintaining the code, I have not made changes to the way the top-level menu items themselves are created. A few versions ago, I added some sub-menu items, however in those versions at the time, there were no ill menu effects noted by my colleagues nor our customers. 

 

Since I have been developing, I have been using CVI 2020. Prior versions used 2017 and earlier. 

 

I have gone back to some of the earlier versions that I created and those noted ill menu effects are now present!!! - The installer has not been recreated in the interim. So I am in a quandary as to what is happening are a base level. My colleague ever when back to a version that was built by be predecessor on CVI 2017 and again noticed ill menu effects. 

 

This not happening in the debugger is a pain in the backside as it is proving difficult to track. However using message popups, it looks like something is not correctly initialising at times. However my quandary is why does everything initialise correctly when running the debug or release versions from the IDE as well as the release version from the build directory, but things fall apart when the application is actually installed and then run? 

 

Also, why is this happening all of a sudden - especially to older versions which never previously experienced any issue? 

 

Is there any difference to the application being executed from the build directory to be executed from the installation directory in terms of the dependencies being used? 

 

I have not updated by NI Installation since it was installed 3 years ago - not sure if this is good or bad. 

 

Although it is possible for the dependencies to have been updated by other software that I have installed. 

 

I really need to solve this problem as it is starting to annoy many people, however I am having a really hard time in fully tracking the issue as it does not occur in the debugger.

 

Any insights anyone can provide would be very much appreciated. 

 

Thanking you in advance.

 

Anand

0 Kudos
Message 1 of 4
(637 Views)

I cannot think of a clear reason that can explain some weirdness in manipulating dynamic menu bars, but I must note that your explanation is not so clear. Specifically, I don't understand if the problem is that menus ARE created, ARE NOT created or are created in some unspecified wrong way.

 

Nevertheless, you mentioned a switch from CVI2017 to 2020 and this implies a discontinuity since release 2020 introduced support for UTF-8 encoding with a potential impact on projects created in previous versions.

 

A first check I would do is to verify whether defective instances are running against 2020 or 2017 runtime.

 

To proceed examining your situation some detail more is needed: even better could be a small sample project with only the relevant functions included that exhibits the problem. Building up such an example could also help you in narrowing down the problem to a specific set of functions in your effective application.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(609 Views)

Hi Roberto

 

Thank you for your help. 

 

Please accept my apologies for the poorly phrased explanation of my problem. The issue was that the menus were created in some instances and not in others - initially seemingly at random. 

 

The switch from 2017 to 2022 was not the issue as I have software versions which worked after the switch.

 

I have now tracked the problem.

 

It looks like that a some point I have accidently removed a ini from the Distribution Inclusion List. While the menu creation routine does not rely on these settings, it looks like the accessing and implementation of the settings in the file is causing a sufficient delay to allow the menus to be created correctly. When running from the IDE or the build directory, the application was picking up the local copy of the ini file and hence the menus were working. 

 

When installed the ini file was missing which caused the timings to be altered and then causing the menu to fail. 

 

So programmer error rather than anything else. 

 

Thank you again for your assistance. 

 

Kind regards

 

Anand 

0 Kudos
Message 3 of 4
(579 Views)

Never mind, I'm happy you solved the issue!



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(553 Views)