Dynamically change button icons

Hello all. I am working on a navigation app for sailors. They can choose from various locations and the app serves up some optimal times for passage.


The picture above shows the control buttons for the Cape Cod Canal. Notice the left and right buttons. The Cape Cod Canal flows northeast and southwest. The edge buttons allow you to get data when going either direction.


This second picture show data for the Chespeake Delaware Canal. It flows east and west. However the button icons are static and I’m not finding a easy way to change them to east west arrows.

The labels of the buttons are dynamic and can be used to select graphics.

All help appreciated.

Is that a button block? Only thought would be to add all of the buttons you need, but set the actions up in workflows with a condition to only allows actions based on the canal. Any canel that wouldn’t allow an action should make the button hidden.

Another thought would be to switch to using just text on your buttons with unicode or emoji arrows, but it might not look as nice.

1 Like

I do like your first idea. Kinda brut force, but it will work.

Yes, that’s a button block with six buttons. I was hoping there was cool CSS trick that might work. Any thoughts?

1 Like

First, go to Change Icon on the nav bar. Then, go to Legacy. That way, there are more button icons there. Problem solved; use old Glideapps icons.

There might be some CSS options. I try not to user too much CSS, so I’m not much help there. I guess you could try overriding the image, or may apply a rotation to the image. Not sure how easy it is to target the button.

Related to your first suggestion, if I add each button individually, I can set a visibility on each one. Is there a way to set a visibility condition on individual buttons in a button block?

You shouldn’t need to set visibility, and I don’t think you can on an individual button basis with a button block. What you do is have those buttons run a workflow action, but in that workflow give it a condition at the top that needs to meet your criteria to show the button. If the criteria doesn’t match, it should hide the button because there won’t be an action it can run.

I thought show / hide was done with visibility. How do i control show / hide in a workflow? Which action should I use?

Thanks for the suggestion, but the issue is not that there aren’t icons available, but that I want them to change on the buttons based on user selection. I don’t want to rotate an existing icon, as you said, I want to change one legacy icon for another dynamically.

There is no show/hide. You are just putting a condition on the action when you create a workflow. Each button that needs to show or hide should be assigned to it’s own workflow. If the condition in that workflow doesn’t allow the following workflow actions to run, then it will hide the button.

If you want to control visibility using visibility conditions, then you will have to create individual buttons instead of a button block, but it’s not going to look good, so you have to do it via workflow actions with a condition on the workflow if you want to retain your horizontal button placement.

For the life of me, I can’t create a workflow that makes a button disappear. Is it possible for you to post some screen shots of examples?

It would be something like this, and assigning that workflow to the button.

But, on second look, you can in fact assign conditions to individual buttons in a button block. Forgot about that option.

2 Likes

I tried that, but the buttons didn’t disappear. Have you be able to make the disappear when the condition isn’t met?

Wow. I take that back. Now my buttons disappear! Woo hoo! Thank you.

1 Like

Just wanted to say thank you again. While it’s a lot of buttons and kind of tedious, it’s easier and more robust than CSS or javascript. Really appreciate your help and insight.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.