Unable to add images to cockpit screens programmatically

Jonathan Turpin shared this bug 5 years ago
Solved

The code that actually sends the update image request is missing in implementation from cockpits and other non-text panel.


Steps to reproduce:


1. Place a PB and a cockpit / flight seat.


2. In the PB, enter the following:


void Main()

{

var provider = GridTerminalSystem.GetBlockWithName(“block name”) as IMyTextSurfaceProvider;


if (provider == null)

{

Echo(“Provider null”);

return;

}


if (provider.SurfaceCount == 0)

{

Echo(“Provider has no screens”);

return;

}


var screen = provider.GetSurface(0);

screen.ContentType = ContentType.TEXT_AND_IMAGE;

screen.ClearImagesFromSelection();

screen.AddImageToSelection(“Cross”);

}


3. Notice that the image is never displayed, but the content type is properly updated.

Leave a Comment
 
Attach a file