c++c++builderfiremonkeyshapesc++builder-xe6

Change color from a Rectangle using a TColorListBox


I'm here again. I just would like to discover how to change the color background of a rectangle (Shape) using a TColorListBox. I know it is easy, however I'm getting exception all the time I try to set a new value for the Rectangle. The command I'm using is the following:

Rectangle1->Fill->Color = ColorListBox1->Color;

Function:

void __fastcall TForm1::ColorListBox1Click(const TCustomListBox *Sender,
          const TListBoxItem *Item)
{
    Rectangle1->Fill->Color = ColorListBox1->Color;
}

Now the error I'm getting all the time I try to change the collor:

Access violation at address 00405628 in module 'Project1.exe'. Read of address 00000360.

Another exception on debugger is here:

First chance exception at $00405615. Exception class $C0000005 with message 'access violation at 0x00405615: read of address 0x00000360'. Process Ninterpres.exe (904)

Could someone help me please?Since now, thanks A LOT!


Solution

  • I've found the problem... The access violation code is because of multiple pointers with the same name. On this case I was using Rectangle1 (Actually is was called Transp, I changed the name to put here to make the comprehension easier) as a int var and as an object... Thanks for the answers XD.