377 views
in GUI Development by
Is there an easy way to disable variants from getting activated just for a single screen. The reason behind the question is I have some icons that I need to switch to the variant on all screens except for one screen (this screen stays the same look-and-feel through all variants). I tried creating a new resource with the same source png file with no variant and tried to use it on this one screen but maybe because of EW's optimizations it seems to switch to the variant image. I tried disabling the style when loading the screen and re-enabling the style when leaving the screen but this seems to cause some undesired side effects, meaning some older dialogs that are waiting on the stack below seem to be affected and go back to the non-variant style. Is there a recommended way in which I could accomplish this. Thanks!

1 Answer

0 votes
by
 
Best answer
Hello,

your approach is correct. All components which depend on a multi-variant bitmap should use this multi-variant bitmap. The other component where no variants are desired should use the specially for it prepared bitmap resources without variants. I suppose, in your actual implementation the other component still refers the multi-variant resources.

Best regards

Paul Banach
by
Hello Paul, thanks for your reply! Unfortunately, it's not working as expected in my case. I basically have an resource icon that has a resource variant connected to it. I use this resource is all screens except one. On this one screen where I don't want the variant to kick in I have a copy of the previously mentioned resource icon (basically a new resource icon pointing to the same png file) with no corresponding variant. But, it looks like the variant still kicks in for the latter screen which has the resource icon that has no variant. It looks like maybe EW is smart enough to see that since both these resources (the one with and without the variant) are pointing to the same base png file, and ends up optimizing them into just one resource. Could this be happening? If so, how can I get around it..
by

Hello,

well EmWi is smart but no too smart :o) Such kind of optimization is not implemented. If your project contains 2 resources, then you will get also 2 sets of generated bitmap pixel data - even if the both original resource members refer to one and the same PNG file. 

You can test following: create a copy of the PNG file with another name. Use this copy for one of the resources while the other resource should use the original PNG file. Now the both resources do not refer the same PNG file - they have nothing in comun. You can even test what happens when you configure the second resource with another PNG file. What image does appear now in your screen?

Anyway are you sure, in your implementation the both resources are not confound? You can add code to your screen to trace the bitmap, which is displayed in the affected screen. For example, add a push button to the screen and connect it to a slot method. In the method implement something similar to the following code (the_image_view refers to view where the bitmap is displayed):

trace the_image_view.Bitmap;

When the screen appears and you press the button, the name of the bitmap resource is displayed in the log window. Verify this name.

Best regards

Paul

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...