Canvas GUI: Difference between revisions

Jump to navigation Jump to search
543 bytes added ,  15 October 2013
m
→‎PUI Widgets: http://flightgear.org/forums/viewtopic.php?f=71&t=17187&p=187244&hilit=canvas#p187244
m (→‎PUI Widgets: http://flightgear.org/forums/viewtopic.php?f=71&t=17187&p=187244&hilit=canvas#p187245)
m (→‎PUI Widgets: http://flightgear.org/forums/viewtopic.php?f=71&t=17187&p=187244&hilit=canvas#p187244)
Line 30: Line 30:


== PUI Widgets ==
== PUI Widgets ==
Canvas dialogs are definitely the way to go, as they are far more flexible and will replace PUI in the future. Since I think FG 2.11 you can create canvas dialogs with window decoration, including a title bar allowing to drag the window around and a close icon:
<pre>
var dlg = canvas.Window.new([400,300], "dialog")
                                    .set("title", "My Canvas Dialog...");
<pre>
The existing XML dialogs can still be used and will also be usable in the future (by a backwards compatibility layer or some migration path).
Implementing all our existing PUI/XML-based dialogs is almost certainly going to be more work than providing a Nasal-space migration path/wrapper that reads the old dialogs and turns them into "modern" canvas windows, possibly by just overwriting the dialog-show fgcommand via the new removecommand/addcommand APIs. And phasing out canvas widget should be fairly straightforward too, because those can be directly mapped to embedded/nested canvas textures, so I wouldn't worry too much ...
Implementing all our existing PUI/XML-based dialogs is almost certainly going to be more work than providing a Nasal-space migration path/wrapper that reads the old dialogs and turns them into "modern" canvas windows, possibly by just overwriting the dialog-show fgcommand via the new removecommand/addcommand APIs. And phasing out canvas widget should be fairly straightforward too, because those can be directly mapped to embedded/nested canvas textures, so I wouldn't worry too much ...


Navigation menu