开发者

UI changes triggering events vs. UI changes triggered programmatically

Here is a problem I often come across:

I start building my app and define eve开发者_JAVA百科nt handlers for changes in the UI, e.g. a user uses a select list -> event triggered -> event handled.

At some point I want to programmatically make changes to the UI and if those changes trigger events, handlers go off without any way of controlling them.

Is there some way around this?


Consider a smarter command implementation. Instead of having the logic directly in UI event handlers, you keep them dumb, and only executing certain tasks via command functions/classes/dispatcher/.. anything you want. Then prior to making your changes to UI, you can instruct command dispatcher to not run certain task, in any way suits you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜