Visual Studio Extensions: How to get colors from the VS theme

TL;DR:

// Note that I've only tried this in VS 2022.
// Browse the EnvironmentColors class to see all the available colors.
var themeColor = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey);
// If you want to use this in a WPF brush, convert it like this.
var wpfCompatibleColor = Color.FromRgb(themeColor.R, themeColor.G, themeColor.B);

Read on for full details.

Read More →

How to be a Great Remote Teammate

turned off laptop computer

Working from home is nothing new, especially for those of us in the technology business. Since the COVID pandemic, however, many companies were forced to jump into the deep end of remote work. Thankfully, it seems to have been a positive experience for most.

Employers realised that their employees’ productivity isn’t reliant on their managers lurking around them and peering over their shoulders to make sure they could see a text editor rather than Facebook on the screen. Employees realised that it’s quite nice to be able to fully control your physical working environment and interruptions. It’s not everyone’s preference, however, and that’s fine too. Some people need more in-person contact with their colleagues in order to do their best work.

The whole arrangement isn’t without its quirks.

Read More →

Unreal Engine: How to Add Widgets With C++ at Runtime

Let’s say you have an existing UMG UI which you’ve created in C++ already* (derived from UUserWidget), and you want to add child widgets at runtime. Imagine you have an inventory UI with a container of some kind (I’ll use a vertical box in this example) and you want to add an item at which the player is aiming. You could add a method to your UUserWidget-derived class like this (I’ve used a text block for the example but you can use any widget derived from UWidget):

void UMyUserWidget::AddInventoryItem(FText ItemName)
{
    auto NewInventoryItemWidget = WidgetTree->ConstructWidget<UImage>();
    InventoryVerticalBox->AddChildToVerticalBox(NewInventoryItemWidget);
}

That’s it!

* Mike Stevanovic has a great tutorial for creating UUserWidgets and adding them to the viewport using C++.