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 4: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: Sun Jan 01, 2017 11:04 pm

Re: How to change a buttons legend

Postby Thorsten » Tue Jun 11, 2019 5: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: 10693
Joined: Mon Nov 02, 2009 8:33 am

Re: How to change a buttons legend

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

Thanks Thorsten, might look into Canvas, tried the 2 buttons, trouble is they do not overlap.
gkick
 
Posts: 106
Joined: Sun Jan 01, 2017 11:04 pm

Re: How to change a buttons legend

Postby Octal450 » Tue Jun 11, 2019 2: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
Octal450

Lead Programmer, IDG (Join our Discord!)
Download High Quality Aircraft from Octal450 Hangar
User avatar
Octal450
 
Posts: 4226
Joined: Tue Oct 06, 2015 12:51 pm

Re: How to change a buttons legend

Postby gkick » Tue Jun 11, 2019 2: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: Sun Jan 01, 2017 11:04 pm

Re: How to change a buttons legend

Postby Octal450 » Tue Jun 11, 2019 8: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
Octal450

Lead Programmer, IDG (Join our Discord!)
Download High Quality Aircraft from Octal450 Hangar
User avatar
Octal450
 
Posts: 4226
Joined: Tue Oct 06, 2015 12:51 pm

Re: How to change a buttons legend

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

Thank you Josh, works like a treat and soo simple if one knows... gee the Warrior looks fantastic!!!
gkick
 
Posts: 106
Joined: Sun Jan 01, 2017 11:04 pm

Re: How to change a buttons legend

Postby Octal450 » Wed Jun 12, 2019 6: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
Octal450

Lead Programmer, IDG (Join our Discord!)
Download High Quality Aircraft from Octal450 Hangar
User avatar
Octal450
 
Posts: 4226
Joined: Tue Oct 06, 2015 12:51 pm


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest