Thema: Delphi Class field lost value!

Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Class field lost value!

  Alt 26. Feb 2010, 18:30
Delphi-Quellcode:
var
  Index: Integer;
  Layer: TCustomFilterLayer;
begin
  Index := lbLayers.ItemIndex;

  if Index <> - 1 then
  begin
    if lbLayers.Items.Objects[Index] is TCustomFilterLayer then
    begin
      Layer := lbLayers.Items.Objects[Index] as TCustomFilterLayer;

      if Layer is TBrightnessAdjustmentLayer then
      begin
        Layer := Layer as TBrightnessAdjustmentLayer;

        with TBrightnessLayerEditor.Create(Layer) do
        begin
          SetAmount(vtInteger, -100, 100, TBrightnessAdjustmentLayer(Layer).Amount); // Here is something wrong :(

          // Here is ok
        end;
      end;
    end;
  end;
end;
So, I create some graphic tool with layers.
There is problem with this procedure: when - TBrightnessAdjustmentLayer(Layer).Amount is always 0 (default from Create()), also if is setup other value... Other parameters from TCustomFilterLayer are ok. Why and how to fix? Layer is display with correct setting.
  Mit Zitat antworten Zitat