Code: Select all
error: invalid conversion from `wxChar' to `const wchar_t*'
Code: Select all
error: invalid conversion from `wxChar' to `const wchar_t*'
Code: Select all
wxString input = InputBox->GetValue();
OutputBox->SetValue( grid->Decode(&input) ); //grid = new MatrixGrid()
Code: Select all
wxString MatrixGrid::Decode(wxString* input)
{
wxString output;
for (unsigned int i = 0; i < input->Length(); i += 2)
{
wxMessageBox(input->GetChar(i+0), _("+0"));
wxMessageBox(input->GetChar(i+1), _("+1"));
output += GetCellValue( wxAtoi(input[i]), wxAtoi(input[i+1]) );
}
return output;
}
Code: Select all
wxString MatrixGrid::Encode(wxString input)
{
bool resetFor;
wxString output;
for ( unsigned int a = 0; a < input.Length(); ++a)
{
resetFor = false;
for ( int i = 0; i < GetNumberRows(); ++i)
{
for ( int j = 0; j < GetNumberCols(); ++j)
{
if (input[a] == GetCellValue( i, j ))
{
output << i << j;
resetFor = true;
break;
}
}
if (resetFor == true)
{
break;
}
}
}
return output; //Change to a pointer. Strings are heavy when passing around directly.
//Works great. Maybe a better way than three for loops though lol.
}
Code: Select all
{
wxMessageBox(input->GetChar(i+0), _("+0"));
wxMessageBox(input->GetChar(i+1), _("+1"));
int row = input->GetChar(i+0) - '0'; // you could check to make sure that GetChar(...) is between '0' and '9'...
int col = input->GetChar(i+1) - '0';
output += GetCellValue(row,col);
}