07-17-2012 01:50 AM
Hello all,
I am trying to figure out what is the difference between CVI 8.5.1 and CVI 2010.
With the latest of them it did work as expected: If the control were sized to the original picture size with VAL_SIZE_TO_IMAGE it was not scaled at the different
resolutions. So it looked just fine on all monitors. (This setting I made with the GUI designer not programmaticaly).
But with CVI 2010 something changed: the picture (or control) is scaled now on loading the panel. It is just after on click event on it that the picture/control is turning to the original size of the picture and isn't scaled anymore.
Why this behaviour?
Is it a bug in CVI 2010?
Thank you in advance.
07-18-2012 04:43 AM
Hello Inomed,
I tried to look into the behaviour you pointed out but don't seem to get it right. Could you please share an example where I could see the resize of the control after the on click event?
Thanks and regards
07-18-2012 10:08 AM
Hello Naity.
In the meantime I could figure out where the issue come from.
The problem is following:
If the panel attribute ATTR_SCALE_CONTENTS_ON_RESIZE is set to true then
it can be supposed that all contents are scaled with the resizing of the panel.
But consider the case if you have the image control on this panel that should not be scaled on the panel resize.
It was possible with CVI 8.5.1 if the picture control attribute was set to VAL_SIZE_TO_IMAGE.
With CVI 2010 is the behaviour defenitely different.
The problem with my application is the that some controls as decorations, text boxes etc. should be scaled on the panel resize.
But the picture controls should keep the original size of the image independent of the size of the panel.
I attached the example project and two screenshots to demonstrate this behaviour.
07-20-2012 02:01 AM
Hello,
anybody?
A statement from NI would be highly appreciated.
Unfortunately we can not back to CVI 8.5.1 because of the OS - we use Win 7.
Thanks.
07-20-2012 02:39 AM - edited 07-20-2012 02:40 AM
Hello Inomed,
I did not have time yesterday to get a look at your code. I tried it now and could reproduce your behaviour. However, it seem like I found a way to set it right. In your main UIR, in the property window of the "new" Command Button, there is a property called "Fit Mode". By changing its value to "size to picture" the button does not get his original size animore by clicking on it.
Here a screenshot of the property:
Does this also work for you?
Best regards
07-20-2012 02:55 AM
Hello Naity,
that's exactly the case - I do not want the picture control to be scaled with the panel resizing.
In this case the method you proposed would be the solution.
But I woud like the picture control to keep the original size of the image - always, not just by clicking on it but also on resizing the panel.
So the attribute VAL_SIZE_TO_IMAGE seems to be the right one. So it was in CVI 8.5.1 at least.
Further ideas?
Thanks and regards.
07-20-2012 04:07 AM
Hello Inomed,
I've browsen through the help and did not find a statement anywhere that the size should be kept automatically on resize. It seems to me, after what I read, that the resize has some kind of "priority" over the attribute, whichever this attribute was. I will however ask in Austin for a statement on that point.
To work it around I added an event on panel resize to reload the picture and, that way, resize it autoimatically. it seem to work here:
int CVICALLBACK mainMenCallback (int panel, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_CLOSE: QuitUserInterface(appHandle); break; case EVENT_PANEL_SIZE: if (state == 0) { SetCtrlBitmap(mainmen, MAINMEN_PATNEW, 0, picOff); } else { SetCtrlBitmap(mainmen, MAINMEN_PATNEW, 0, picOn); } break; } return 0; }
I will let you know when I have more informations
Best regards
07-20-2012 04:31 AM
Hello Naity,
thanks for the reply.
CVI Help says:
VAL_SIZE_TO_IMAGE Make the control conform to the size of the image.
And you are right - not a word about resize. But it takes no effect on the fact that is now different
to the earlier version.
It seems to me this behaviuor is unwanted: huge drawback on flexibility of scaling the panel content.
Moreover it can be the impact on designs created with the earlier versions of CVI, which is it in my case.
The workaround you posted is unfortunately not so easy to implement in our application due to its design.
I am curios what the NI developers will say.
Regards.
07-20-2012 04:42 AM
"But it takes no effect on the fact that is now different to the earlier version."
I agree to that. This means that one of the 2 is unexpected behaviour. The Fit properties in general seem to work. If I use Size to Picture, reloading the image after a resize will scale it to the control size, which is what is expected.
I understand that the workaround is not the easiest to implement. It involves setting your flags global and, depending of the ammount of bitmaps you use, can create a big PANEL_SIZE callback. If I run into another workaroung or hear of something else from Austin, be sure I will let you know.
Best regards
07-23-2012 07:13 AM
I ran some additional test today. I wanted to share the result of them:
1) I installed CVI 8.5 on my Windows 7 machine. I tested the program and could observe the same behaviour than with CVI 2010: The bitmap get resize with the window.
2) I installed Windows XP on a machine and installed CVI 8.5 on this machine. I tested your code and could observe that the button was not resized when the window was resized
3) I installed CVI 2010 on the XP machine and tried. As with Windows 7, the button was resized with the window.
4) After installing CVI 2010 I retried with CVI 8.5 and the same behaviour than with Windows 7 was observed.
I want to run further tests (installir 8.5 on a fresh formated windows 7, using CVI 8.5 configuration in 2010) but I don't think I will be able today.
In parallel I will let you know if I hear from Austin.
Best regards