Вниз
Скачать: CL | DM;

TForm   Найти похожие ветки 

← →
gestern ©   (2004-01-01 17:12) [0]

Вопрос простой. Как сделать так что-бы форма не закрывалась Alt+F4


← →
Intell ©   (2004-01-01 17:44) [1]

procedure TForm1.FormCreate(Sender: TObject);
begin
KeyPreview := true;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ((ssAlt in Shift) and (Key = VK_F4)) then Key := 0;
end;


← →
Intell ©   (2004-01-01 17:44) [2]

procedure TForm1.FormCreate(Sender: TObject);
begin
KeyPreview := true;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ((ssAlt in Shift) and (Key = VK_F4)) then Key := 0;
end;


← →
raidan ©   (2004-01-01 20:05) [3]

А если хочешь, чтобы форма закрывалась только если нажата кнопка какая-нить (tbutton или еще что-нибудь), то проще поставить обработчик на OnCloseQuery.

var allowCloseForm:boolean;
В form.oncreate установить allowCloseForm:=false;
В tbutton.onclick установить allowCloseForm:=true;

В tform.onclosequery: if allowCloseForm then canClose:=true else canClose:=false;


← →
Номолос   (2004-01-01 22:28) [4]

Внимание! KeyPreview крупно глючит под XP!


← →
mike-d ©   (2004-01-02 12:00) [5]

Компонент TActionList. Добавляешь к нему один TAction (Action1) и назначаешь ему ShortCut = Alt+F4. Делаешь обработчик:

procedure TForm1.Action1Execute(Sender: TObject);
begin
ShowMessage("А вот фигушки!");
end;



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.016 c
14-49760
}|{yk
2003-12-22 17:44
2004.01.16
Кстати. А почему-таки умер С++Builder?


1-49557
andrey_pst
2004-01-06 07:26
2004.01.16
Balloon Tips


1-49545
gestern
2004-01-01 17:12
2004.01.16
TForm


3-49401
new
2003-12-19 15:54
2004.01.16
dbgrid


1-49602
Toots
2004-01-05 12:48
2004.01.16
файл ресурсов




   Наверх