UI Popup Window Text Alignment


I’m trying to display a popup that shows some test results. Attempting to dynamically display the text with padding results in the misalignment shown below. Is there a way to modify the font/alignment so I can print this more neatly?

    int maxTestNameLength = 40;
	String message = "Test results from HST module on slot: " + String(slot) + " port: " + String(port) + "\n\n"; 

	np::NP_ErrorCode *results = (np::NP_ErrorCode*)(&status->VDD_A1V2);
	for (int i = 0; i < numTests; i++)
		message+=String(tests[i]).paddedRight('-', maxTestNameLength - tests[i].length());
		message+=results[i] == np::SUCCESS ? "PASSED" : "FAILED w/ error code: " + String(results[i]);
		message+= "\n";

	AlertWindow::showMessageBox(AlertWindow::AlertIconType::InfoIcon, "HST Module Detected!", message, "OK");


You’ll need to set a LookAndFeel which implements getAlertWindowMessageFont() to return a fixed width font.

Worked perfectly, thanks!

Font CustomLookAndFeel::getAlertWindowMessageFont() 
    return Font(Font::getDefaultMonospacedFontName(), 12, 0);