type
TForm1 = class(TForm)
Switch: TSwitch;
Rectangle: TRectangle;
Selection: TSelection;
procedure SwitchSwitch(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.SwitchSwitch(Sender: TObject);
begin
{ (Sender as TSelection).HideSelection := not(Sender as TSelection).HideSelection;
(Sender as TSelection).HitTest := not(Sender as TSelection).HitTest;
(Sender as TRectangle).HitTest := not(Sender as TRectangle).HitTest; }
if Switch.IsChecked = true then
begin
(Sender as TSelection).HideSelection := false;
(Sender as TSelection).HitTest := true;
(Sender as TRectangle).HitTest := false;
end
else
begin
(Sender as TSelection).HideSelection := true;
(Sender as TSelection).HitTest := false;
(Sender as TRectangle).HitTest := true;
end;
end;
Вопрос
delcpy
Всем привет. Подскажите что делаю не так. Выходит ошибка Invalid class typecast.
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
FMX.Controls.Presentation, FMX.StdCtrls;
type
TForm1 = class(TForm)
Switch: TSwitch;
Rectangle: TRectangle;
Selection: TSelection;
procedure SwitchSwitch(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.SwitchSwitch(Sender: TObject);
begin
{ (Sender as TSelection).HideSelection := not(Sender as TSelection).HideSelection;
(Sender as TSelection).HitTest := not(Sender as TSelection).HitTest;
(Sender as TRectangle).HitTest := not(Sender as TRectangle).HitTest; }
if Switch.IsChecked = true then
begin
(Sender as TSelection).HideSelection := false;
(Sender as TSelection).HitTest := true;
(Sender as TRectangle).HitTest := false;
end
else
begin
(Sender as TSelection).HideSelection := true;
(Sender as TSelection).HitTest := false;
(Sender as TRectangle).HitTest := true;
end;
end;
end.
Новая папка.zip
Изменено пользователем БукаСсылка на комментарий
1 ответ на этот вопрос
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.