View model separation X and D.

Igor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 29 12:04:59 PST 2016


Suppose I create a model in D and would like it to support a gui 
written in another language such as Qt C++ or WPF .NET.

Can anyone think of an efficient and very easy way to hook up the 
"bindings"? The gui doesn't need to be updated more than about 30 
times a second and it should run in it's own thread.

I would think a simple message queue would work that uses 
commands to tell the gui that value X has changed. The gui then 
checks the queue and updates the values visually. This should be 
quick except one needs to deal with potential multiple changes of 
the same value so the queue is not flooded with useless 
changes(changes that are not able to be displayed due to the fps 
limitation).

Does this seem relatively viable? It would need a rather minimal 
api and should be relatively fast?

The other problem of the gui updating the or changing the model 
is a bit harder but commands could also be used. Seems like most 
of the work would be done in creating the bindings to the model 
so the view can act on them. I imagine a simple syntax in the gui 
design could be used to bind view to model actions.

Any ideas on the subject?







More information about the Digitalmars-d-learn mailing list