Board index FlightGear Development Canvas

Are radio buttons available?  Topic is solved

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Are radio buttons available?

Postby C-FABP » Tue Oct 01, 2019 9:29 pm

I'm trying to create an exclusive multiple choice dialog and keep reading about a radio button Canvas widget but can't find any explicit documentation.

For example, README.gui says:
Code: Select all
As listed above, FlightGear implements several GUI elements:

(1)    "dialog"      "group"         "frame"       "hrule"      "vrule"
       "list"        "airport-list"  "input"       "text"       "checkbox"
       "radio"       "button"        "combo"       "slider"     "dial"
       "textbox"     "select"

But that's it. It gives examples for several of those options, but doesn't mention "radio" again.

If not, what would be the best option? Combo? Checkbox with some code to make the options exclusive? ...

BTW, it's damn hard to search for "radio button" when just about every aircraft has a radio with buttons :x
C-FABP
 
Posts: 17
Joined: Mon Sep 09, 2019 9:43 pm
Location: Left coast of Canada
Callsign: C-FABP
Version: 2019.2.0
OS: Manjaro Linux

Re: Are radio buttons available?  

Postby Johan G » Tue Oct 01, 2019 9:52 pm

C-FABP wrote in Tue Oct 01, 2019 9:29 pm:I'm trying to create an exclusive multiple choice dialog and keep reading about a radio button Canvas widget but can't find any explicit documentation.

Looking at existing examples might help (even if there would have been useful documentation). See for example the random failures dialog: fgdata/gui/dialogs/random-failures.xml.

C-FABP wrote in Tue Oct 01, 2019 9:29 pm:BTW, it's damn hard to search for "radio button" when just about every aircraft has a radio with buttons :x

Happens here too from time to time. Also, it does not really help that many common words are excluded from the search function on the forum, probably to limit the size of the search index. Using Google search and ending the search string with "site:forum.flightgear.org" can at times be extremely helpful.

Speaking of searching the web: If you start a business, use an original name. Here in Sweden one of the larger IT companies for some reason amazingly changed their name to CGI. Good luck googling on them... :roll: :lol:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5527
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Are radio buttons available?

Postby Octal450 » Tue Oct 01, 2019 9:57 pm

You realize, johan, that dialog is PUI not canvas...

Kind Regards,
Josh
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Are radio buttons available?

Postby C-FABP » Tue Oct 01, 2019 10:20 pm

Johan G wrote in Tue Oct 01, 2019 9:52 pm:Looking at existing examples might help

Also, @Octal450 I did look at how you did the panel selection (DG vs HSI) in the PA28 and that may be how I end up doing this, but I like a radio button for only a few options.
C-FABP
 
Posts: 17
Joined: Mon Sep 09, 2019 9:43 pm
Location: Left coast of Canada
Callsign: C-FABP
Version: 2019.2.0
OS: Manjaro Linux

Re: Are radio buttons available?

Postby Johan G » Tue Oct 01, 2019 10:22 pm

Octal450 wrote in Tue Oct 01, 2019 9:57 pm:[...] that dialog is PUI not canvas...

Doh! :oops:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5527
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Are radio buttons available?

Postby Octal450 » Tue Oct 01, 2019 10:24 pm

np Johan :mrgreen:

C:
I'm not using Canvas for my dialogs - I use PUI cause its frankly much simpler and in my opinion nicer looking - the Ubuntuish(?) theme of Canvas never really appealed to me.

If you are using PUI I can let you know how to make them exclusive.

But based on my knowledge of Canvas dialogs I have no idea how to do that as I have no knowledge in Canvas dialogs! :mrgreen:

Kind Regards,
Josh
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Are radio buttons available?

Postby C-FABP » Tue Oct 01, 2019 10:37 pm

Octal450 wrote in Tue Oct 01, 2019 10:24 pm:If you are using PUI

I'm calling it Canvas because every bit of documentation that I've seen has called them canvas widgets. I've never heard of PUI before, so that's going to send me down another rabbit hole :D

Any pointers would be much appreciated.
C-FABP
 
Posts: 17
Joined: Mon Sep 09, 2019 9:43 pm
Location: Left coast of Canada
Callsign: C-FABP
Version: 2019.2.0
OS: Manjaro Linux

Re: Are radio buttons available?

Postby wkitty42 » Tue Oct 01, 2019 10:57 pm

Octal450 wrote in Tue Oct 01, 2019 9:57 pm:You realize, johan, that dialog is PUI not canvas...

it can be if it goes through the PUI2Canvas convertor ;)
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5695
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Are radio buttons available?

Postby wkitty42 » Tue Oct 01, 2019 10:58 pm

just also remember that PUI is going to be removed at some point... it is unmaintained for years...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5695
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Are radio buttons available?

Postby C-FABP » Tue Oct 01, 2019 11:19 pm

wkitty42 wrote in Tue Oct 01, 2019 10:58 pm:just also remember that PUI is going to be removed at some point... it is unmaintained for years...

Yes, I was just reading on the wiki that:
PUI widgets are generally considered to be pretty archaic...
C-FABP
 
Posts: 17
Joined: Mon Sep 09, 2019 9:43 pm
Location: Left coast of Canada
Callsign: C-FABP
Version: 2019.2.0
OS: Manjaro Linux

Re: Are radio buttons available?

Postby Octal450 » Wed Oct 02, 2019 12:34 am

OK, well this is all a bit of a useless thing for now and here is why:

- Nobody is gonna use Canvas dialogs of they remain this complex
- There barely any canvas in the UI now

They've been talking that for years, but nobody has made any major steps in that direction, so its not a worry - and because likely at that point, there will be a parser for PUI dialogs into the new system.

Also what is this "widget", we are talking about dialogs here...

Kind Regards,
Josh
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Are radio buttons available?

Postby wlbragg » Wed Oct 02, 2019 1:31 am

Canvas is the future unless something else comes along.

I use PUI cause its frankly much simpler and in my opinion nicer looking - the Ubuntuish(?) theme of Canvas never really appealed to me.


As far as "nicer looking", the "look" is determined by the developer. Because you can use a texture on the canvas it is really unlimited in design capability and can be made to look any way you want it to. Canvas is also much more flexible and has more options. So what your referring to "Ubuntuish" would have been by design and could be made with any look you desire.

As far as "simpler" I think once you work with canvas as much as you have with PUI you would find it just as simple, and more flexible. I've seen some PUI dialog that are pretty complex and not easy to understand.

But it does need developers to step up and start using it and creating content that can be extended and reused. I think that might help more people adopt its use. The Shuttle is make good use of "canvas" and it is really effective.

Then again, I can also show the OP how to do a radio button in PUI but not in canvas without learning how to myself first. But if the OP isn't families with either PUI or Canvas, I think the learning curve will end up being about the same for either one.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4904
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Are radio buttons available?

Postby C-FABP » Wed Oct 02, 2019 2:13 am

OK, so this is what I ended up with by following fgdata/gui/dialogs/random-failures.xml as @Johan G suggested. It is used to choose between a regular compass and an RMI. And, it works!

No idea if it is using Canvas, PUI or something else.

Code: Select all
<!-- RMI / Compass choice -->
    <group>
    <stretch>true</stretch>
      <layout>vbox</layout>
      <valign>top</valign>
    <text>
        <label>Choose a magnetic inst:</label>
    </text>
    <radio>
        <halign>left</halign>
        <property>instrumentation/MagComp</property>
        <live>true</live>
        <value>true</value>
        <label>Magnetic compass</label>
        <binding>
          <command>property-assign</command>
          <property>instrumentation/MagComp</property>
          <value>true</value>
        </binding>
        <binding>
          <command>property-assign</command>
          <property>instrumentation/RmiWind</property>
          <value>false</value>
        </binding>
    </radio>
    <radio>
        <halign>left</halign>
        <property>instrumentation/RmiWind</property>
        <live>true</live>
        <value>true</value>
        <label>RMI + Wind Needle</label>
        <binding>
          <command>property-assign</command>
          <property>instrumentation/RmiWind</property>
          <value>true</value>
        </binding>
        <binding>
          <command>property-assign</command>
          <property>instrumentation/MagComp</property>
          <value>false</value>
        </binding>
    </radio>
    </group>
C-FABP
 
Posts: 17
Joined: Mon Sep 09, 2019 9:43 pm
Location: Left coast of Canada
Callsign: C-FABP
Version: 2019.2.0
OS: Manjaro Linux

Re: Are radio buttons available?

Postby Octal450 » Wed Oct 02, 2019 2:56 am

@wlbragg:
wlbragg wrote in Wed Oct 02, 2019 1:31 am:Canvas is the future unless something else comes along.

Canvas is great for lots of things. You're not wrong.

wlbragg wrote in Wed Oct 02, 2019 1:31 am:As far as "nicer looking", the "look" is determined by the developer. Because you can use a texture on the canvas it is really unlimited in design capability and can be made to look any way you want it to. Canvas is also much more flexible and has more options. So what your referring to "Ubuntuish" would have been by design and could be made with any look you desire.

Yeah, if I do a shit-ton of work to design new images for each and every thing (remember, I am a worse artist as a monkey without fingers!) PUI is easy to skin using XML, I can make whatever color scheme I want (such as the IDG theme)

wlbragg wrote in Wed Oct 02, 2019 1:31 am:As far as "simpler" I think once you work with canvas as much as you have with PUI you would find it just as simple, and more flexible. I've seen some PUI dialog that are pretty complex and not easy to understand.

LMAO! I have worked with Canvas for years, have you seen my Airbus and MD-11 display units? Those are complexity like the moon! But writing a few simple XML lines is much faster and easier than complex nasal for everything... not mentioning the fact that nasal as HORRIBLY SLOW property I/O. So now I have to optimize all the property I/O - and lets say you aren't using IDG PropertyTreeSetup like IDG aircrafts do - this suddenly becomes a bigger task! All for a simple little dialog. Also lots of these complex dialogs you don't understand happen because people try to add functionality that should be handled by something else into the dialog (like the generic autopilot, implements basic mode handling into the dialog itself - this is beyond silly!) PUI in its base is extremely simple.

wlbragg wrote in Wed Oct 02, 2019 1:31 am:But it does need developers to step up and start using it and creating content that can be extended and reused. I think that might help more people adopt its use. The Shuttle is make good use of "canvas" and it is really effective.

Again I disagree and so have most devs I've spoken to who work on Canvas - we all tend to do canvas a bit differently. For example, Pinto and Leto I spoke most recently too - both have each their own Canvas systems. Also I have my own IDG Display Framework V1 (and V2 coming soon!). Because they are all best suited for our programming style, and implementation. Why do you think complex addons for every flight sim avoid generics and build their own? Because SPECIALIZED systems are always better than Generic.

But - if there was an easy way using XML to make dialogs into Canvas, that would be acceptable because it is modular and easy to understand. And yes there is something to take PUI dialog into Canvas, but its in my opinion broken as formatting is all messed up and some dialogs look totally weird. (Also not updated in YEARS!)

wlbragg wrote in Wed Oct 02, 2019 1:31 am:I think the learning curve will end up being about the same for either one.

Sorry, you are totally wrong here: XML is a simple language, and general. PUI is modular, requires no frameworks or setup. It just works. Very very easy. In fact, editing dialogs was one of the first things I ever learned! Canvas on the other hand, requires knowledge of nasal, knowledge of performance optimization, knowledge of property I/O management that doesn't reduce the frames so much, etc. Its A LOT of work! There is a reason I, and Thorsten, and Leto, and Pinto have taken lots of time to refine and optimize our Canvas' because its VERY VERY complex - but also very powerful.

@C-FABP
That's PUI. :) Carry on with what you are doing.

Kind Regards,
Josh
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Are radio buttons available?

Postby wlbragg » Wed Oct 02, 2019 4:09 am

LMAO! I have worked with Canvas for years, have you seen my Airbus and MD-11 display units? Those are complexity like the moon!


Hey, your the one that said

I have no knowledge in Canvas dialogs!


So I figured if you ever actually looked at the available examples and widgets there would be no possibility that you would think it complex or harder to learn than PUI elements. :)

Plus we weren't talking about systems or panel instruments. we're talking about "simple" PUI dialog concepts. Nothing complicated about that. In that context it would take me about the same time to learn how to do a simple dialog from scratch with either framework. The first time I used canvas and followed a "simple" example, it was not rocket science, same as PUI, in some respects maybe easier. Any complex PUI element you make usually include a nasal interface as well, so that conceptually has the same issues. Thorsten has modeled several canvas assisted dialogs that are simple yet far more aesthetically pleasing than anything we can do with PUI. That is more of what I am talking about.
As far as modular, again I am talking about simple stuff, like text box, radio, check box, slider, etc. Those should and could be standardized and expanded. The GUI could be given a ascetically pleasing "feel" that you can't get with PUI.

Anyway, I'm glad C-FABP got the needed information to accomplish the task at hand.
Last edited by wlbragg on Wed Oct 02, 2019 6:55 am, edited 1 time in total.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4904
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Next

Return to Canvas

Who is online

Users browsing this forum: No registered users and 2 guests