Unable to add images to cockpit screens programmatically

Jonathan Turpin shared this bug 4 years ago
Solved

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


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.

Replies (1)

photo
1

Make sure you change “block name” to the actual name of the block you place

Leave a Comment
 
Attach a file