Hello ,
Setup description:
Embedded wizard version 8.20
Target CPU: NXPLPC565
we are trying to activate vertical list, by implementing onLoadItem and UpdateArraySourceLogs methodes.
We have declared an array to work with the vertical list:
/* This class implements the interface between the GUI application and the device. */
EW_DEFINE_FIELDS( DataDeviceClass, XObject )
.
EW_ARRAY ( ArraySourceLogs, XString, [1000])
.
EW_END_OF_FIELDS( DataDeviceClass )
In our GUI application we have declared an array to contain wide-caracter strings and an integer to hold the logs number .
unsigned short ushort_sourceArr[10][36] = {'\0'};
int LogsNo = 0;
Then we assigned the first element with "Comm setup" string.
Now, variable 'LogsNo' is equal to 1.
At this point, the debuger show this data:
(XString)ushort_sourceArr[0] = 0x8068DD80 -> "Comm setup".

Then we update the Embedded wizard with logs number (=1) and new string.
DataDeviceClass_UpdateLogsNumber(DeviceObject, (XInt32)LogsNo); //Update EW with logs number
DataDeviceClass__UpdateArraySourceLogs( DeviceObject, (XString)ushort_sourceArr[0]); //Update EW array with new string
Here is 'DataDeviceClass__UpdateArraySourceLogs' code:
/* Wrapper function for the non virtual method : 'Data::DeviceClass.UpdateArraySourceLogs()' */
XInt32 DataDeviceClass__UpdateArraySourceLogs( void* _this, XString aNewValue )
{
return DataDeviceClass_UpdateArraySourceLogs((DataDeviceClass)_this, aNewValue );
}
/* This method is intended to be called by the device to notify the GUI application
about an alternation of its setting or state value. */
XInt32 DataDeviceClass_UpdateArraySourceLogs( DataDeviceClass _this, XString aNewValue )
{
XInt32 result;
/* Dummy expressions to avoid the 'C' warning 'unused argument'. */
EW_UNUSED_ARG( _this );
EW_UNUSED_ARG( aNewValue );
result = 0;
{
int i;
for( i =0; i < _this->LogsNumber; i++)
{
_this->ArraySourceLogs[i] = EwNewString((XString)aNewValue);
}
}
return result;
}
The snapshot below shows that the first element of 'ArraySourceLogs' (first was "Data memory" by default ) is now upadate to "Comm setup".

In order to show the vertical list, the program calls 'ScreensEventLogTableContent_OnLoadItem' function:
/* This method is called by 'VerticalList' every time the list loads or updates
an item. */
void ScreensEventLogTableContent_OnLoadItem( ScreensEventLogTableContent _this,
XObject sender )
{
XInt32 itemNo;
ScreensEventLogTableItem itemView;
/* Dummy expressions to avoid the 'C' warning 'unused argument'. */
EW_UNUSED_ARG( sender );
itemNo = _this->VerticalList.Item;
itemView = EwCastObject( _this->VerticalList.View, ScreensEventLogTableItem );
if ( itemView == 0 )
return;
ViewsText_OnSetString( &itemView->Txt_Sourse, EwGetAutoObject( &DataDevice, DataDeviceClass
)->ArraySourceLogs[ EwCheckIndex( itemNo, 1000 )]);
if (( itemNo % 2 ) == 1 )
ViewsRectangle_OnSetColor( &itemView->ItemBackground, ResLightGray );
CoreRectView__OnSetBounds( itemView, EwSetRectSize( itemView->Super2.Bounds, EwNewPoint(
EwGetRectW( _this->VerticalList.Super2.Bounds ), _this->VerticalList.ItemHeight
)));
}
The problem is that when we get to 'ViewsText_OnSetString' we see that the new string (2'nd argument, i.e 'value') is corrupted.

And from this point the program is in its way to get crashed, as shown in snapshot below:

Please help us to understand what we are doing wrong.
Thank you very much!