Board index FlightGear Development Nasal

How to change a buttons legend

Nasal is the scripting language of FlightGear.

How to change a buttons legend

Postby gkick » Tue Jun 11, 2019 5:08 am

Hi,
I would like to change a dialogs button legend based on a boolean value. I can do this within the button by changing the property, however when the dialog opens it defaults to the hardcoded legend.
Anyone has come across a code example?
Thanks
gkick
 
Posts: 106
Joined: Mon Jan 02, 2017 12:04 am

Re: How to change a buttons legend

Postby Thorsten » Tue Jun 11, 2019 6:23 am

Create two buttons with visibility dialed by a property - it's the only way I've figured out.

Or create a canvas dialog, they're much more flexible anyway.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: How to change a buttons legend

Postby gkick » Tue Jun 11, 2019 8:06 am

Thanks Thorsten, might look into Canvas, tried the 2 buttons, trouble is they do not overlap.
gkick
 
Posts: 106
Joined: Mon Jan 02, 2017 12:04 am

Re: How to change a buttons legend

Postby Octal450 » Tue Jun 11, 2019 3:02 pm

You can make them overlap with the table <layout>
Then just have a visible condition to overlap them. See what I did in the f16-autoflight dialog in f16/gui/dialogs

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: How to change a buttons legend

Postby gkick » Tue Jun 11, 2019 3:17 pm

Thanks a lot Josh, will give it a shot, sounds a lot easier then the cmdarg example in the nasal function listing
gkick
 
Posts: 106
Joined: Mon Jan 02, 2017 12:04 am

Re: How to change a buttons legend

Postby Octal450 » Tue Jun 11, 2019 9:50 pm

https://github.com/NikolaiVChr/f16/blob ... flight.xml
Here is the specific file I was referencing. Sorry I couldn't link it earlier.

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: How to change a buttons legend

Postby gkick » Wed Jun 12, 2019 4:16 am

Thank you Josh, works like a treat and soo simple if one knows... gee the Warrior looks fantastic!!!
gkick
 
Posts: 106
Joined: Mon Jan 02, 2017 12:04 am

Re: How to change a buttons legend

Postby Octal450 » Wed Jun 12, 2019 7:49 am

You're welcome :mrgreen:
Glad I could assist you.

Thanks! The redesign of the aircraft has been a big step.

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest