// Fill out your copyright notice in the Description page of Project Settings. #include "UI/Settings/SelectGoalUserWidget.h" #include "SharedDef.h" #include "Components/ComboBoxString.h" void USelectGoalUserWidget::NativeConstruct() { Super::NativeConstruct(); bInitAddOption = false; if (GetComboBoxString()) { if (AllGoalListDataTable) { FString ContextString; TArray RowNames = AllGoalListDataTable->GetRowNames(); for (const FName& RowName : RowNames) { FAllGoalListData* AllGoalListData = AllGoalListDataTable->FindRow(RowName, ContextString); if (AllGoalListData) { if (AllGoalListData->bIsActive) { UEnum* GoalTypeEnum = StaticEnum(); FString GoalTypeString = GoalTypeEnum->GetDisplayNameTextByIndex(int(AllGoalListData->GoalType)).ToString(); GetComboBoxString()->AddOption(GoalTypeString); bInitAddOption = true; break; } } } } GetComboBoxString()->SetSelectedIndex(bInitAddOption); } }