Create account / Log in

Preferences Tabs

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Preferences Tabs

Postby drimmer » September 21st, 2020, 8:21 pm

Is it possible to create a new tab in Preferences that would only show when a particular module is running?

Can this be done via the module editor and/or custom code classes?
Doug
drimmer
 
Posts: 40
Joined: May 21st, 2014, 4:48 pm

Re: Preferences Tabs

Postby marktb1961 » September 21st, 2020, 10:23 pm

Global Options (from Module Editor provides this functionality.
Platform used:
Vassal 3.4.10
MacOS Big Sur
iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 335
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: Preferences Tabs

Postby Cattlesquat » September 21st, 2020, 10:54 pm

Mark is right about Global Options providing preferences w/o need for custom classes -- you right click on the [Global Options] and it will let you add a preference.

Meanwhile if you are wanting to add some in a custom class then the basic call is:
Prefs.getGlobalPrefs().addOption("Your New Tab Name", yourConfigurer);

Where yourConfigurer is, you know, a BooleanConfigurer or an IntConfigurer or a ColorConfigurer or whatever other configurer you've created.

You can follow the pattern in Chatter.java down at the bottom (in its addTo method) where it creates options on its own tab.

Brian
User avatar
Cattlesquat
 
Posts: 947
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Preferences Tabs

Postby drimmer » September 22nd, 2020, 2:35 am

Cattlesquat wrote:Mark is right about Global Options providing preferences w/o need for custom classes -- you right click on the [Global Options] and it will let you add a preference.

Meanwhile if you are wanting to add some in a custom class then the basic call is:
Prefs.getGlobalPrefs().addOption("Your New Tab Name", yourConfigurer);

Where yourConfigurer is, you know, a BooleanConfigurer or an IntConfigurer or a ColorConfigurer or whatever other configurer you've created.

You can follow the pattern in Chatter.java down at the bottom (in its addTo method) where it creates options on its own tab.

Brian


Thanks for the replies. As I understood global options, it would let me create new preferences, but not new tabs in the preferences window which is what I want to do. probably misunderstood; won't be the first time. I will check out both options. Thanks.
Doug
drimmer
 
Posts: 40
Joined: May 21st, 2014, 4:48 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 3 guests