Changing the Button behavior onClick

Hi Guys,

is there a way to change the button behavior once its clicked for example
onclick change button text to “Running” background “Yellow” disabled “true”

Thank you.

Hi @wsl2001, haven’t really thought about this myself, but guessing it will invole the $session variable and some sync-udelement…I’ll have a sleep on it and update in the morning if I had a vision in my dreams on how to accomplish this…

@psDevUK thanks for replying. It will be nice if we can figure this out because at this moment its important to address this kind of issues in order to provide a protection against human errors like clicking the button twice and not be able to see if your first click is doing something and so on.

my dream is to see UD behave same way as WPF so you dont have to create powershell GUI tools and have people login to a server to use them or have them installed on people machines when they can do the same logging to a web browser with all the dynamic features GUI tool provides.

Hey @wsl2001 just commented on the github issue with the grids…Anyways I was up till like 01:30 thinking yeah I can do this, but then I gave up went to bed. Been keeping my 4 daughters happy today, so only just got on the net…Was thinking https://poshud.com/Button shows how to make a nice big text appear to let you know you clicked the buttong, so maybe keep it simple, and do something like “BUSY…” appear, then disappear when the results are displayed? I couldn’t figure how to change the button text at 01:30 but its now 15:32 so I might have a whole different look at it now…will update when I got a demo working peace…So not been able to delve into this as much as I wanted today as was updating a WIP dashboard. But thinking https://github.com/simformsolutions/react-native-spinner-button and making a custom component from it there is a youtube vid Adam has made on how to make custom components, and reckon this is what has to be done to get this working…what you reckon?

I have raised this as an enhancement on github, I have forked the custom component on github and will ask for time to do this tomorrow at work, work-load depending. See what Mr Driscoll comes back with.

Thank you for paying attention to this.

Finally was able to create it and add it to my custom release. Thanks everyone my dashboard looks much nicer now :smiley:

1 Like

fair play @wsl2001 I was still looking into this…care to share code?

Can we upload files here?

if you message me I can post it on the UDScripts respository I created to share UD scripts or if you can upload to https://github.com/psDevUK/UDscripts is where I am trying to build a nice bundle of how-to scripts…I was looking into this but wasnt getting anywhere :frowning: well not after getting some type script error when trying to import that custom component, so Ive used powershell studio quite a bit, so was trying to set text to something else…but again failed…and tried via the set-udelement and trying to call the button ID and set the text to something else…again epic fail…doh! I did see its easy to get a nice spinner in fontawesome using refreshh or cog, gear icon and use the spin and pulse parameters…but again I couldnt figure how to get this working inside the button…so would like to see how you cracked this nut…if github not possible please mail me on this site the code, as I am very interested to see how you got this done. Thank you.

@psDevUK The whole idea is simple and will let you build anything you want based on Adam posted custom template.
i will upload UniversalDashboard.Materialize to your git hub and after that all what you have to do is to replace yours with this one or rename yours and copy this one instead.

next add the following ‘New-UDButtonLoader’, universaldashboard.psm1 file if you have the enterprise version. and you can start using New-UDButtonLoader in your dashboard.

if you have any questions let me know and ill help you with the steps required to create elements like this one.

Thanks @wsl2001 proper appreciated. I did have a go at starting my own button loader but was getting an error. So looking forward to seeing how you achieved this. And I might be dropping you an email if I get stuck as I really would like to contribute to developing some custom components. Peace

can you post your email address so i can mail you the pkg, does not seem that i can upload files to your gethub.

you can delete it after am done sending the pkg to you :smiley:

you can also look at the 90% of the code at this link