Add visual indicator showing which button is currently active?

I have a table with a date column along with a series of buttons that filter the date column for Today, Yesterday, -2 Days, -3 Days, -4 Days, -5 Days, -6 Days, etc.

Is there anyway I can add some form of visual indicator (change of button color? font color? badge?) to show which button is currently filtering the dates in the table? In other words, if the -2 Days button was the last button pushed, it gets some visual indicator until another button is pushed?

Many thanks, Gregg

Hey Gregg!

There are many different ways to do this, the best way just depends on how exactly your buttons are working.

What is your current action in your button? Is it modifying a ControlValue?

Yes!
To go back 4 days, I currently use this, but of course open to any suggestions to better ways to approach it:
SetControlValue([Hitlist Test Date.], List(
Today()-4,
Today()-4
))
Thank you!

Great! Then I would do this:

In the label portion of your button write:
If((today()-4).in(HitListTestDate), _color(ā€œ#00000ā€, ā€œin Useā€, ā€œnot in useā€))

Then, in the place of the 0ā€™s put in the hex-value of the color you are after!

Then do the same for your other buttons but adjust the if criteria to make sure it matches the button action

Also- just personally Iā€™d use all white buttons so the colored text stands out more clearly. Alternatively to the _color() formula you could also use _highlight()

2 Likes
  1. You can make the button thatā€™s currently in use disabled. Then it will be greyed out.
  2. You can use formulas in your labels and e.g. prepend a :radio_button: or :white_circle: emoji
  3. If you wish to venture into hidden experimental formulas, you can make some Button()s with arbitrary icons like this:
3 Likes

@Paul_Danyliuk

in a recent video of yours (de-duplicating video?) i am prety sure i saw a progress-bar show up in some of your buttons for a few momentsā€¦ or was i seeing things?

can it be done?

max

No no, you got that right @Agile_Dynamics :grin: !
So, yes it can be done as, apparently, itā€™s an ā€œold trickā€ from @Paul_Danyliuk :raised_hands: !

I searched on the Community to find the ā€œhowā€ but I wasnā€™t able to find a dedicated topic :pensive: ā€¦
(As I didnā€™t have the time to try and see if I could solve this riddle for myself :innocent: )

Maybe this is what he was referring to?

Indeed it was a progress bar but I didnā€™t suggest it here because I didnā€™t see how that would work along what OP requested (highlighting a ā€œcurrently activeā€ button in terms that itā€™s not a long-running action but a yes/no state, i.e. indicating that ā€œLast weekā€ was the last pressed number / the currently active setting).

I donā€™t mind making a quick tutorial on implementing a progress bar label sometime soon :slight_smile: I thought it was pretty easy to solve without a tutorial for it.

2 Likes

ha @Paul_Danyliuk ā€¦ you throw down a challenge methinks :wink:

let me see if i can figure it out

tomorrow

im too tired in the brain right now

challenge accepted :smiley:

You guys are making my head explode! :wink:

Hi, @Paul_Danyliuk ā€“

Can you tell me how to do this:

Many thanks!

Hey Greg! You can just write that into your ā€œDisable Ifā€ criteria of the button

Essentially write: (today()-4).in(HitListTestDate)

And then shift around the today()-4 to match the action of your button

1 Like

@Paul_Danyliuk, i tried.

here is a doc with the following tricks for showing the progress of a buttonā€¦

  • disable the button while a procedure is running
  • show progress using the badge
  • show progress using a long progress-bar beside the button

but i cannot seem to change the label of the button while its running
so you must be using the ā€˜Deep Vodooā€™ of the hidden _Button() function?

or have i missed something obvious?

anyway - you win! - challenge accepted but failed!

1 Like

I fail to believe that youā€™re capable of making a JS interpreter in Coda but fail to notice that a buttonā€™s label can be a formula :grin:

image

Iā€™ll try to record a proper tutorial about it and progress indication in general sometime soon. Maybe even today if I have time for it.

1 Like

oh yes i noticed

it was the first thing i tried

but when i set the label via a formula, it didnt change in real time when the button was running!

or i had it disabled while running (stupid mistake)?

argh!

maybe its because the button is doing row inserts and deletes that have a long delay round-trip to the server?

ok

hangs head in sorrow

i will try again

max

1 Like

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