[Closed] Help with DialogMonitorOps / uiaccessor
I am trying to find a way to register specific events performed by a user in the “environment and effects” dialog. Specifically I need to know when the user has:
[ul]
[list]
[li]Selected a new environment map[/li][li]Changed the background color[/li][li]Checked / unchecked the “use map” checkbox[/li][/ul]
[/list]So far I have:
fn checkDialog =
(
local hwnd = dialogMonitorOps.getWindowHandle()
local dialogTitle = uiAccessor.getWindowText hwnd
local hwnd_children = uiAccessor.getChildWindows hwnd
if (dialogTitle == "Environment and Effects") then
(
udpate_bg_dialog()
)
true
)
dialogMonitorOps.interactive = false
dialogMonitorOps.unregisterNotification id:#test
dialogMonitorOps.registerNotification checkDialog id:#test
dialogMonitorOps.enabled = true
This will run the function udpate_bg_dialog() whenever the environment and effects dialog is launched, however how can I monitor the three events mentioned above within this dialog?
Any suggestions would be greatly appreciated.
D.
You can hijack the environment panel’s message pump and intercept messages, but I think you’re going about it the wrong way. All of those elements that you mentioned can be changed from places other than the environment dialog (track view, etc.)
for the first 2 events, this will catch them:
when parameters (refs.dependents rootnode)[1][7] change id:#test do print "something changed"
for the ‘use map’ checkbox… that’s a tricky one.
any changing of these parameters causes 3dsmax.ini update. So technically it’s possible to set F[b]ileSystemWatcher /b
^ that was my first though, When Parameters, but I thought u had to pass an actual Node… nice
I’ve had issues in the past with FileWatcher though, where it misses the update/change and never triggers.
I think my work around was to use a timer to check every second once the action was started to see a change. Which also isn’t a great method to use either.
Cheers guys, thanks for the suggestions, the when parameters seems quite an interesting technique, not come across this one before. How would I go about “unregistering” this line of code?
either:
myHandler = when parameters (refs.dependents rootnode)[1][7] change id:#test do print "something changed"
deleteChangeHandler myHandler
or
when parameters (refs.dependents rootnode)[1][7] change id:#test do print "something changed"
deleteAllChangeHandlers id:#test
see Change Handlers and When Constructs in the docs.
Ok thanks lo.
Are there any good threads illustrating the FileSystemWatcher technique?