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"

[PATCH] UMG Combobox not having a font selection

After exploring alittle into a problem of UMG Combobox'es not having a Font selection, I decide to fix this. And made a UE patch.

 diff --git a/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h b/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h
 index 3ba2b20..5fbe517 100644
 --- a/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h
 +++ b/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h
 @@ -424,6 +424,17 @@ struct SLATECORE_API FComboBoxStyle : public FSlateWidgetStyle
      UPROPERTY()
      FName SelectionChangeSound_DEPRECATED;
  
 +    /** Font family and size to be used when displaying this text. */
 +    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Appearance)
 +    FSlateFontInfo Font;
 +    FComboBoxStyle& SetFont(const FSlateFontInfo& InFont) { Font = InFont; return *this; }
 +    FComboBoxStyle& SetFont(const FName& InFontName, uint16 InSize) { Font = FSlateFontInfo(InFontName, InSize); return *this; }
 +
 +    /** The foreground color of text. */
 +    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Appearance)
 +    FSlateColor ForegroundColor;
 +    FComboBoxStyle& SetForegroundColor(const FSlateColor& InForegroundColor) { ForegroundColor = InForegroundColor; return *this; }
 +
      /**
       * Used to upgrade the deprecated FName sound properties into the new-style FSlateSound properties
       */    
 diff --git a/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp b/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp
 index 4a906f5..f2204e1 100644
 --- a/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp
 +++ b/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp
 @@ -60,11 +60,11 @@ TSharedRef<SWidget> UComboBoxString::RebuildWidget()
              SAssignNew(ComoboBoxContent, SBox)
          ];
  
 -    if ( InitialIndex != -1 )
 -    {
 +    //if ( InitialIndex != -1 )
 +    //{     // This is needed to recreate amty combobox field with properly set up fonts
          // Generate the widget for the initially selected widget if needed
          ComoboBoxContent->SetContent(HandleGenerateWidget(CurrentOptionPtr));
 -    }
 +    //}
  
      return MyComboBox.ToSharedRef();
  }
 @@ -204,7 +204,7 @@ TSharedRef<SWidget> UComboBoxString::HandleGenerateWidget(TSharedPtr<FString> It
      }
  
      // If a row wasn't generated just create the default one, a simple text block of the item's name.
 -    return SNew(STextBlock).Text(FText::FromString(StringItem));
 +    return SNew(STextBlock).Font(WidgetStyle.Font).ColorAndOpacity(WidgetStyle.ForegroundColor).Text(FText::FromString(StringItem));
  }
  
  void UComboBoxString::HandleSelectionChanged(TSharedPtr<FString> Item, ESelectInfo::Type SelectionType)
 diff --git a/Treadwater b/Treadwater
 --- a/Treadwater
 +++ b/Treadwater
 @@ -1 +1 @@
 -Subproject commit 258dfad463a1a37a013de07e620f9c0c6179a914
 +Subproject commit 258dfad463a1a37a013de07e620f9c0c6179a914-dirty
 

Yes, it is actually not a bug report, but i've seen many people ask here for font option in combobox, so I share my solution.

Product Version: UE 4.9
Tags:
more ▼

asked Sep 11 '15 at 08:46 AM in Bug Reports

avatar image

Yata
554 39 50 69

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

1 answer: sort voted first

Hello Yata,

Thanks for sharing your information with everyone. If you would like to submit your code to the developers, I have provided a link below and this will allow you to submit a pull request to the developers for further consideration. I hope this helps.

Link: https://github.com/EpicGames/UnrealEngine/compare

Make it a great day

more ▼

answered Sep 11 '15 at 12:53 PM

avatar image

Rudy Q ♦♦ STAFF
47.4k 545 132 525

(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