Jump to content

[UI] Close gap between dialog toggles?


Recommended Posts

I have a large gap between options in a ToggleGroup and I want to close that gap.

Also, the input text below, how can I make it right-justified? it's currently left by default

 

 

GCVmEMh.jpg

 

 

 

Edited by Xyphos
Link to comment
Share on other sites

54 minutes ago, Xyphos said:

I have a large gap between options in a ToggleGroup and I want to close that gap.

Try adding a DialogGUIFlexibleSpace to the end.

Quote

Also, the input text below, how can I make it right-justified? it's currently left by default

Try setting textInput.guiStyle.alignment = TextAnchor.MiddleRight

(That might affect more things than you want; you really want to assign the whole guiStyle object.)

Edited by HebaruSan
Link to comment
Share on other sites

41 minutes ago, HebaruSan said:

Try adding a DialogGUIFlexibleSpace to the end

that didn't work, here's the code I'm using:

     var optimizeForOptions =
                    new DialogGUIVerticalLayout(IDGAF, IDGAF, SPACER, R0, TextAnchor.MiddleLeft,
                        new DialogGUILabel("Optimize For:"),
                        new DialogGUIScrollList(new Vector2(120, IDGAF), false, false,
                            new DialogGUIVerticalLayout(IDGAF, IDGAF, IDGAF, new RectOffset(12, 0, 0, 0), TextAnchor.MiddleLeft,
                                new DialogGUIContentSizer(FM.PreferredSize, FM.Unconstrained, true),
                                new DialogGUIToggleGroup(
                                    new DialogGUIToggle((OptimizeFor == OptimizeForEnum.Mass), "Mass",
                                        b =>
                                        {
                                            if (b)
                                                OptimizeFor = OptimizeForEnum.Mass;
                                        }, IDGAF, Height),
                                    new DialogGUIToggle((OptimizeFor == OptimizeForEnum.Cost), "Cost",
                                        b =>
                                        {
                                            if (b)
                                                OptimizeFor = OptimizeForEnum.Cost;
                                        }, IDGAF, Height),
                                    new DialogGUIToggle((OptimizeFor == OptimizeForEnum.PartCount), "Part Count",
                                        b =>
                                        {
                                            if (b)
                                                OptimizeFor = OptimizeForEnum.PartCount;
                                        }, IDGAF, Height)
                                    ),
                                new DialogGUIFlexibleSpace()
                                )
                            )
                        );

const float IDGAF = -1F;
const float SPACER = 12F;
static RectOffset R0 = new RectOffset(0,0,0,0);

 

Edited by Xyphos
Link to comment
Share on other sites

I think this is a bug in some of the DialogGUI types, it didn't happen before 1.3. I reported this during the 1.3 pre-release, but it didn't seem to get any attention. You can see the same behavior in the stock difficulty panel sections. The only way I know around it is to add something that takes up a fixed amount of space to force the gap to close.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...