x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to make VerticalBox slots fill the ChildSlot space?

I'm making a simple dialog window implementation by creating a SCompoundWidget-based widget. It's declared like this:

 ChildSlot
 .VAlign(VAlign_Fill)
 .HAlign(HAlign_Fill)
  [
      SNew(SVerticalBox)
      + SVerticalBox::Slot()
     .MaxHeight(32.f)
     [
         TitleContainer.ToSharedRef()
     ]
      + SVerticalBox::Slot()
     .VAlign(VAlign_Fill)
     [
         SNew(SBorder)
         .BorderImage(&WindowStyle->ContentBoxBrush)
         .Content()
         [
             SNew(SVerticalBox)
             + SVerticalBox::Slot()
             .VAlign(VAlign_Center)
             .HAlign(HAlign_Center)
             [
                 ConfirmTextBlock.ToSharedRef()
             ]
             + SVerticalBox::Slot()
             .VAlign(VAlign_Center)
             .HAlign(HAlign_Center)
             [
                 SNew(SHorizontalBox)
                 + SHorizontalBox::Slot()
                 .HAlign(HAlign_Right)
                 .Padding(10)
                 [
                     SNew(SButton)
                     .ButtonStyle(&WindowStyle->OKButtonStyle)
                 ]
                 + SHorizontalBox::Slot()
                 .HAlign(HAlign_Left)
                 .Padding(10)
                 [
                     SNew(SButton)
                     .ButtonStyle(&WindowStyle->CancelButtonStyle)
                 ]
             ]
         ]
     ]
  ];

But the 2nd slot of top-level Vertical Box (window contents) doesn't fill the remaining space of widget's Childslot alt text

As you can see a bit less than a half of widget space for contents is empty. What should be the proper declaration to make this work?

Product Version: Not Selected
Tags:
slate.jpg (171.3 kB)
more ▼

asked Aug 05 '14 at 02:09 AM in C++ Programming

avatar image

TimGS
626 20 23 239

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

OK, after some research of Engine source I found out what's going on. When you create FSlot for SBoxPanel (vertical or horizontal), it sets SizeRule_Stretch for its SizeRule and 1.0f for its SizeParam.Value by default. That means that it allots equal space for each FSlot even if you set MaxHeight or MaxWidth for any of them. So you need to additionally use AutoHeight() or AutoWidth() for slots with MaxSize to let other slots fill the space.

Resolved. =)

more ▼

answered Aug 05 '14 at 06:47 PM

avatar image

TimGS
626 20 23 239

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question