AdvColumnGrid and CreateBitButton (bis)

Hi

I have still a problem with this action. I change the method according your previous recommendation from CreateBitButton to AddBitButton see below

I try this method :

list_Espece.AddBitButton(1, I, 16, 16, '', Poubelle, AdvGrid.HaRight, AdvGrid.VaTop);

procedure xxx;
var 
   Poubelle : tBitmap;
   i : integer;
begin
   try
        FOR i := 1 TO 10 DO
        BEGIN
            list_Espece.AddRow;
            list_Espece.AddBitButton(
                1,
                i,
                16,
                16,
                '',
                Poubelle,
                AdvGrid.HaRight,
                AdvGrid.VaTop);
            // list_Espece.CreateBitButton(1, I, 16, 16, '', AdvGrid.HaRight, AdvGrid.VaTop).LoadFromResourceName(HInstance, 'Poubelle');
        END; // Fin de FOR
    
  finally
    Poubelle.free;
  end;
end;

At the creation, nothing happend, however when display starts, I received this error message :

ThreadId=21140
ProcessId=5
ThreadName=""
ExceptionMessage="Access violation at address 46090000. Read of address 46090000"
ExceptionName="EAccessViolation"
ExceptionDisplayName="$C0000005"
ExceptionAddress=46090000
FileName=
LineNumber=

What the problem, an idea ?
I prepared a small project to demonstrate it.
regards
olivier
Arbre.zip (8.6 KB)

You destroy the bitmap you are referencing in AddBitmap() so it will indeed not work and result in this error. You need to free this bitmap only when the form is destroyed.

ahh OK so simple :flushed:

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.