I have been working on a dithering script, and I add a start and stop custom button to the toolbar when the script is loaded to start an image capture sequence with dithering, and was wondering if there was a way to disable the buttons . IE . disable the start button if its running , disable the stop button if its not .. that kind of thing.
Thanks!
Enable / Disable custom buttons?
- admin
- Site Admin
- Posts: 13344
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Enable / Disable custom buttons?
Hi,
the answer is no sadly, but it's a good idea - hopefully not too hard for me to add in a future version.
cheers,
Robin
the answer is no sadly, but it's a good idea - hopefully not too hard for me to add in a future version.
cheers,
Robin
- admin
- Site Admin
- Posts: 13344
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Enable / Disable custom buttons?
Yes, it was nice and easy, so it is in 3.1.5164. There is now an 'Enabled' property on the CustomButton object which you can set to false to disable the button.
cheers,
Robin
cheers,
Robin
Re: Enable / Disable custom buttons?
Cool!
Thanks so much, will have to download the latest and give it a shot. I finally figured out how I needed to massage the "characters" so I could send binary data out a python socket. Must be a limit of IronPython but this works in straight python but failed from within the sharpcap scripting environment.
cmd = bytearray()
cmd.append(4)
socket.send(cmd)
anyways thanks for the quick work!
Bill
Thanks so much, will have to download the latest and give it a shot. I finally figured out how I needed to massage the "characters" so I could send binary data out a python socket. Must be a limit of IronPython but this works in straight python but failed from within the sharpcap scripting environment.
cmd = bytearray()
cmd.append(4)
socket.send(cmd)
anyways thanks for the quick work!
Bill
Re: Enable / Disable custom buttons?
Hi,
just wondering how the Disable of custom buttons is expressed.
I have tried:
but both throw errors
Cheers..,
Kirk
just wondering how the Disable of custom buttons is expressed.
I have tried:
Code: Select all
SharpCap.CustomButtons.Enabled = False
Code: Select all
SharpCap.CustomButtons('My Script Name').Enabled = False
Cheers..,
Kirk
- admin
- Site Admin
- Posts: 13344
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Enable / Disable custom buttons?
Hi,
works for me with a quick test in the script console :
What error do you get? Are you trying to set the Enabled flag from a different thread perhaps? If so, maybe
will work as a workaround.
cheers,
Robin
works for me with a quick test in the script console :
Code: Select all
cb1 = SharpCap.AddCustomButton("Test", None, None, None)
cb1.Enabled = False
Code: Select all
def disableButton:
button.Enabled = False
SharpCap.MainWindow.RunInUIThread(disableButton)
cheers,
Robin
Re: Enable / Disable custom buttons?
Theadmin wrote: ↑Thu Aug 30, 2018 7:59 pm Hi,
works for me with a quick test in the script console :
What error do you get? Are you trying to set the Enabled flag from a different thread perhaps? If so, maybeCode: Select all
cb1 = SharpCap.AddCustomButton("Test", None, None, None) cb1.Enabled = False
will work as a workaround.Code: Select all
def disableButton: button.Enabled = False SharpCap.MainWindow.RunInUIThread(disableButton)
cheers,
Robin
Code: Select all
cb1 =
Cheers..,
Kirk