Shoutbox

Change Control enable status - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Change Control enable status (/showthread.php?tid=90699)

Change Control enable status by WARlrus on 05-19-2009 at 04:05 PM

Hi,

I'm making a settings box for my latest script, and need some options to be enabled/disabled depending on others.

I thought the following code would work:

code:
winSettings.GetControlHandle("EdtUseTag").Enabled=true;


But it doesn't. I know that in web-page JS I would use getElementById(), but that doesn't work either.

Thanks in advance :-)
RE: Change Control enable status by matty on 05-19-2009 at 04:21 PM

You need to use the Win32 API.

Enable:

js code:
Interop.Call('user32', 'EnableWindow', winSettings.GetControlHandle('EdtUseTag'), true);

Disable:
js code:
Interop.Call('user32', 'EnableWindow', winSettings.GetControlHandle('EdtUseTag'), false);

RE: Change Control enable status by WARlrus on 05-19-2009 at 04:24 PM

Thanks for that!

Seems like a long way around a simple problem, I'm surprised there's nothing in the API about this!


RE: Change Control enable status by matty on 05-19-2009 at 04:31 PM

http://shoutbox.menthix.net/basicsearch.php?do=se...9&lookin=msg&sort=