Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 11:29:16 +0000



Post From: GDI Flickering

[2024-03-16 00:12:34]
TPH_Main - Posts: 13
For anybody else who stumbles upon this, to not define the inputs twice you can still use the struct just use a persistent int for it. Again don't know if this is the best solution, but it works for me.

Inside SCSFExport Function
// Create persistent storage
s_Data *Data = (s_Data *)sc.GetPersistentPointer(0);
if (Data == NULL)
{
Data = new s_Data();
sc.SetPersistentPointer(0, Data);
}

// Example Setting data
Data->xPOS = Input_FontxPOS.GetInt();
Data->yPOS = Input_FontyPOS.GetInt();
Data->alignment = Input_FontAlignment.GetInt();
Data->fontSize = Input_FontSize.GetInt();
Data->fontColor = Input_FontColorCSS.GetColor();
Data->bgColor = Input_BgColorCSS.GetColor();
Data->invalidBgColor = Input_InvalidBgColorCSS.GetColor();


Drawing Function
void DrawTradeCopierLabels(HWND WindowHandle,
HDC DeviceContext,
SCStudyInterfaceRef sc)
{

// Fetch Data from main function
s_Data *Data = (s_Data *)sc.GetPersistentPointer(0);
if (Data == NULL)
return;


// Using data
int width = sc.ChartRegion1RightCoordinate - sc.ChartRegion1LeftCoordinate;
int height = sc.ChartRegion1BottomCoordinate - sc.ChartRegion1TopCoordinate;

int xPosition = static_cast<int>(width * CopyTradingData->xPOS / 100.00);
int yPosition = static_cast<int>(height * CopyTradingData->yPOS / 100.00);
}