LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI 2009 menu bar resize problem

In CVI 2009, if you have the 'scale contents on resize' attribute set for a panel with a menu bar on it, the menu bar font resizes with the panel.

 

Unfortunately, there is a rather severe bug in this. If you do the following repeatedly:

(a) Load a panel with 'scale contents on resize' set and a menu bar

(b) Enlarge it

(c) Display it

(d) Hide it

(e) Discard it

 

then the menu bar font gets progressively bigger and bigger each time the panel is displayed. Below is an example from the test project attached to this posting (four successive display iterations). To say this is inconvenient is understating the truth: It actually breaks many of my applications. Is there any way to stop this behaviour?

 

18831iC03CD62E89F082B4

 

18833iCB7E00D56E36AB46

 

18835i119FB396B6BA8538

 

18837i863038DE4CCF5AE7

--
Martin
Certified CVI Developer
0 Kudos
Message 1 of 5
(4,037 Views)

Hey Martin -

 

I've reported this issue with bug ID 240139.  For the time being, you should be able to return the panel to its original size before discarding the panel as a workaround.


NickB

National Instruments

0 Kudos
Message 2 of 5
(4,022 Views)

Not so nice if I have to modify all the apps affected Smiley Sad

 

It would be really good if there was an option not to resize the menu bar, so the behaviour was more like normal Windows apps.

--
Martin
Certified CVI Developer
0 Kudos
Message 3 of 5
(4,017 Views)

Hello Martin -

 

I'm very sorry for the inconvenience this bug has caused.  Another workaround that may be a little simpler would be to update the font of the menubar with a newly created metafont immediately before showing the panel (and after resizing).  This also has the added benefit of the menu retaining it's original size instead of being scaled.  You could accomplish this with code similar to the following:

 

int hNewPanel, hMenuBar;

hNewPanel = LoadPanel (0, "TestMenu.uir", MENUPANEL);
hMenuBar = GetPanelMenuBar (hNewPanel);
SetPanelSize (hNewPanel, 600, 800);
CreateMetaFontEx ("NewMenuMetaFont", "NIMenuMetaFont", 13, 0, 0, 0, 0, 0);
SetMenuBarAttribute (hMenuBar, 0, ATTR_MENU_BAR_FONT, "NewMenuMetaFont");

 

I also just wanted to add why the behavior of scaling menus with "Scale Contents On Resize" changed in LabWindows/CVI 2009.  The problem was that when using scale contents on resize, all fonts are supposed to scale proportionately to the scaling of the panel.  However, menu fonts did not scale, and this led to the problems seen in this forum.  Because of the inconsistenty and to fix the bug reported on that forum, bug report 134165 was created and then fixed in LabWindows/CVI 2009.

 

Once again, I'm sorry for the inconvenience this has caused,

 

NickB

National Instruments

0 Kudos
Message 4 of 5
(4,002 Views)

Nick:

 

I've had discussions before with Luis and others at NI about the serious consequences of changing the default CVI run-time behaviour for existing applications when releasing a new version. I do wish you wouldn't do it, it costs us a lot of money. Smiley Mad

--
Martin
Certified CVI Developer
Message 5 of 5
(3,976 Views)