[TxMt] Re: Suggestion for DIALOG2 enhancement - interactive async windows

Allan Odgaard mailinglist at textmate.org
Mon Aug 4 09:44:03 UTC 2008


On 9 Jul 2008, at 10:42, Hans-Joerg Bibiko wrote:

> [...]
> I didn't find a way to do this. That's why I introduced a new method
> to '"$DIALOG" window' named 'getparams'.
> This method is very simple. It write the current NSDictionary
> 'parameters' of the current nibController to the standard output.
> Nothing else.
> But then I was able to ask the async window: Are there any changes? If
> so, then I changed the content of the parameters accordingly and
> updated the window's parameters.

So are you polling? I.e. how do you learn _when_ the user changes the  
pop-up?

I would suggest that we instead make this an extension of wait or a  
new monitor command.

So one would call: "$DIALOG" window monitor «property 1» [.. «property  
n»] «token»

This command then returns if «property i» changes, and returns a  
dictionary with the changed properties.

This would be implemented by using key/value observing. Two problems  
though, 1) what if the property is changed while no-one is observing  
it, but later the user calls the command (this could be solved by  
storing a copy of the initial parameters and reference + update these,  
each time the user monitors a property, and 2) monitor doesn’t imply  
waiting for actions, but for all practical purposes, this would be  
desired.

Based on the above, it might be better with:

     "$DIALOG" window observe «property» «token»

This will immediately return the value of «property» _and_ setup KVO  
for this, which makes "$DIALOG" window wait «token» return, if that  
property is changed.

This solves both #1 and #2.




More information about the textmate mailing list