Start a new topic

Hide/show picture?

Does anyone know a way to hide and show a picture at run time?

I want to create a screen with what amounts to an "icon" that appears conditionally.  But pictures have no "visible" or other such property so I can't figure out how to do it.

 


just use a "button" or "picture" or "crop" component. 

The hide pictureID is the picture the same as background, the visible pictureID is the icon picture.

Hey thanks!

Unfortunately I've tried all those things and none worked.

The picture control resizes itself to fit the image so when I set it to use the background image, it tries to display the entire image... at the picture control's location, not 0,0.  The button control displays the image starting at its top left corner, so again when it's set to display the background, the image is displayed in the incorrect location.

The crop control has the opposite problem.  The docs say it can only be used with full-screen images, and when I try to set it to use a smaller image (like my icon) the image doesn't display properly.

 

Relative to my last post, I meant to say I've only tried this in the simulator so far.  I've got the actual device, but haven't had a chance to hook it up yet.  So if the simulator behavior is not exactly the same as the display, that could explain what I'm seeing.

 

HMI file attached.


Use picture component.


HMI
Hey thanks!

But that project doesn't switch the picture component between a picture and the background, it switches between two pictures.  I know that approach works, but it means I'd have to have two ("visible" and "hidden") images for each icon I want to display, which seems wasteful of memory.

It looks like you guys are working on adding transparency support... it seems like adding a "visible" property to a picture would be along the same lines.  Then the MCU could just set the picture to be visible or not to show and hide the icon.

 

Edit to the above: I meant to say "...it switches between two pictures of the same dimensions".

 

I don't know if you solved it, but there is the "vis" command which hides or shows an element.


The format is:


vis elementName,0 


Use 1 to show, 0 to hide

Lefteris, the date on this thread comes from near the very beginning.  At that time the vis command wasn't available, but you see how it was solved.  By switching "a picture" of one with your button and one with a crop image of the background - to the user it is there and not.  90% of an HMI is presenting the best illusions


Login or Signup to post a comment