Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Delphi [игнор отключен] [закрыт для гостей] / Найти панель / 3 сообщений из 3, страница 1 из 1
28.07.2019, 16:27
    #39842319
VladimirVVP
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Найти панель
Здравствуйте, Господа ! возникла такая необходимость

Код: pascal
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
    Edit: TdbEdit;
    Panel:TPanel;
    sLabel:TLabel;
    Button,Button2:Tbutton;
begin
    Panel:=TPanel.create(Form1);
    Panel.Parent := Form1;
    Panel.Width := 330;
    Panel.height := 26;
    Panel.BevelWidth := 0;
    Panel.Left := 8;
    Panel.Top := Form1.Tag + 44;
    Form1.Tag := Form1.Tag + 34;

    sLabel := TLabel.Create(Form1);
    sLabel.Parent := Panel;
    sLabel.Left := 10;
    sLabel.Top := 7;
    sLabel.Caption := 'Please,сlick new caption';
    sLabel.OnClick:=@sLabelNew;

    Edit := TdbEdit.Create(Form1);
    Edit.Parent := Panel;
    Edit.Left := 170;
    Edit.Top := 3;

    Button := Tbutton.Create(Form1);
    Button.Parent := Panel;
    Button.Left := 320;
    Button.Width := 4;
    Button.Top := 1;
    Button.Caption:=':';
    Button.OnClick:=@movePanel;

    Button2 := Tbutton.Create(Form1);
    Button2.Parent := Panel;
    Button2.Left := 300;
    Button2.Width := 20;
    Button2.Top := 1;
    Button2.Caption:='x';
    Button2.OnClick:= @DeletePanel;

end;

procedure sLabelNew(sender: string);
begin
  TLabel(Sender).caption:=InputBox('Caption','New caption','Please, new caption');
end;

procedure DeletePanel(sender: string);
begin

end;

procedure movePanel(sender: string);
begin

end;



Мне нужно найти панель на которой кликается кнопка Button2 и закрыть её...
помогите пожалуйста!
...
Рейтинг: 0 / 0
28.07.2019, 16:43
    #39842321
asutp2
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Найти панель
VladimirVVP
Код: pascal
1.
2.
3.
4.
procedure sLabelNew(sender: string);
begin
  TLabel(Sender).caption:=InputBox('Caption','New caption','Please, new caption');
end;

вот это дичь))))

VladimirVVP , sender должен быть типа TObject
также убери @

по сути вопроса
Код: pascal
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
procedure DeletePanel(sender: TObject);
var
  LPanel: TPanel;
begin
  LPanel := nil;
  if sender is TButton then
    if TButton(sender).Parent is TPanel then
      LPanel := TPanel(TButton(sender).Parent);
  if Assigned(LPanel) then
  begin
    { ToDo : вот тут делай с панелью что хочешь (ссылка на нее хранится в свойстве LPanel). Например:  LPanel.Visible := False; }
  end;
end;
...
Рейтинг: 0 / 0
28.07.2019, 16:58
    #39842323
VladimirVVP
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Найти панель
asutp2, Работает! спасибо! string на автомате написал, даже не заметил, Спасибо!
...
Рейтинг: 0 / 0
Форумы / Delphi [игнор отключен] [закрыт для гостей] / Найти панель / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]