How to dis play a Progress Bar by Editor mode

        FProgressNotificationHandle ProgressHandle = FSlateNotificationManager::Get().StartProgressNotification(FText::FromString(FileName), 100);
            //Get().StartNotification(100, FText::FromString(FileName));
        LoginTask->OnProgress.AddLambda([FileName, ProgressHandle](const FString& msg, float progress) {
            int IntProgress = (int)(progress * 100.f);
            UtilityTools::LogUtility::PrintOnScreen(FString::Printf(TEXT("Dwoloading:%s,%s,progress:%d"), *FileName, *msg, IntProgress), FColor::Green);
            FSlateNotificationManager::Get().UpdateProgressNotification(ProgressHandle, IntProgress);
            });

I can see the PrintOnScreen things ,but I can’t see the progress bar what should I do?
Help me ,Thanks.

void AManagerNotify::BeginPlay()
{
	Super::BeginPlay();
FSlateNotificationManager::Get().StartProgressNotification(FText::FromString("TEST"), 100);	
}

results in

As you can see it does show up.
I added this to an actor on begin play. Perhaps your fragment of the code is not firing? Add a breakpoint and check if it is being triggered. :slight_smile:

1 Like

Thanks for what you have done. But I actually did it in the editor mode(On a plugin button clicked).
Maybe that’s why I can’t see it ? I should call the Function in a Game Thread ?
And I did add a breakpoint and it was being triggered.But no display on the screen.

There’s also FScopedSlowTask

you construct it

	FScopedSlowTask SlowTask(MyMaxNumber,LOCTEXT("MyLocTextLabel","My Progress Text..."));
	SlowTask.MakeDialog();

and then you call this function, which adds the “Amount” to the progress (max being the MyMaxNumber):

SlowTask.EnterProgressFrame(Amount);

Once it equals the MyMaxNumber it will close the dialog.

Thank you for your help.
I want to show multiple progress bar ,and I won’t want to block my window when the progress bar shown.
So may be FScopedSlowTask can’t touch my target?

These ones come out pretty big - they do support multiple progress bars - but take up a lot of screen space…

Yep,and I’m considerring that my progress bar is showing for display downlaod progress,and once a progress bar was being showed ,the whole window will be blocked,and I can’t click download Button to down the second file .
Am I thougts right?

Yeah it doesn’t sound like the type you’re looking for - it’s more for blocking tasks…

I did this and it’s works .

//customize a widget with progress bar 
void NotificationInfoProgressBar::Construct(const FArguments& InArgs)
{
	LocalTaskName = InArgs._TaskName;
	LocalDescription = InArgs._Description;
	ChildSlot[
		SNew(SBox)
			[
				SNew(SVerticalBox)

				+SVerticalBox::Slot()
				[
					SNew(STextBlock)
					.Text(LocalTaskName)
				]
				+SVerticalBox::Slot()
				[
					ConStructDescriptionText()
				]
				+SVerticalBox::Slot()
				[
					ConstructProgressBar()
				]
			]
	];
}
// create an FNotificationInfo 
FNotificationInfo NotifyInfo
// replace it with custom progress bar
NotifyInfo.ContentWidget = ProgressBar;

// use AddNotification to show it
FSlateNotificationManager::Get().AddNotification()

like this
image

I don’t know is there any better resolveation

This method of creating notification actually works, but for some reason, the list of notifications only gets shown if this method was called in PIE. If you call this method non PIE (i.e. through an call in editor function), a notification will get added, but the notification list won’t show

This worked for me:
(I’m using an object to store stuff)
in .h file:

TSharedPtr<SNotificationItem> ProgressBar;

in .cpp file:

FNotificationInfo Info(FText::FromString(TEXT("InitialText")));
Info.ExpireDuration = 10000.0f;//Never
ProgressBar =FSlateNotificationManager::Get().AddNotification(Info);

//A timer to update the text
FTimerHandle TimerHandle;
GEditor->GetTimerManager()->SetTimer(TimerHandle,
FTimerDelegate::CreateLambda
(
	[this, &TimerHandle]()
	{
		if (GetProgress() >= this.MaxProgress)
		{
			//Finished process bar
			GEditor->GetTimerManager()->ClearTimer(TimerHandle);

			FString BarText="Finished\n"+FString::FromInt(GetProgress())+" shapes";
			this->ProgressBar->Fadeout();
			UE_LOG(LogTemp, Error, TEXT("Progress Stop"));
		}
		else
		{
			//Update process bar
			FString BarText="Generating. \n"+FString::FromInt(GetProgress())+" shapes";
			this->ProgressBar->SetText(FText::FromString(BarText));
		}
	}
),
1.0f,//Update frequency
true
);