Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.10.16;
Скачать: CL | DM;

Вниз

ClsStyle or CS_NOCLOSE doesn t work properly   Найти похожие ветки 

 
thaddy   (2005-02-17 12:02) [0]

form.Clsstyle:=form.Clsstyle + CS_NOCLOSE;

This code should disable the close button on the titlebar (and it does),
but it also should remove close from the system menu: It doesn"t.
Furthermore, there"s a huge repaint bug when I try to do this.

Does anyone have a solution other than overriding CreateParams? (that does work, but breaks the pure Tcontrol).
Is this a bug?


 
ECM ©   (2005-02-17 12:19) [1]

DeleteMenu( GetSystemMenu(Form.GetWindowHandle, False ), SC_CLOSE, MF_BYCOMMAND ); не устраивает?
Меню исчезает... Или я не верно понял?
Надо чтобы не исчезало? (становилось "серым" например)


 
thaddy   (2005-02-17 12:28) [2]

No, according to the API documentation, the clstyle CS_NOCLOSE should remove the menu entry enirely, just like your code can do, and it also grays out the cross. The VCL behaves correctly, Plain API program behaves correctly, KOL doesn't :/ unless I override Createparams (which is what I did with the VCL versiob, to be fair)


 
ECM ©   (2005-02-17 13:03) [3]

Да, в этом случае проблема имеет место...:(
VCL - это не показатель - там окно "тупо" пересоздается (ИМХО...), а это часто неудобно - при этом изменяется HWND.
А как в "Plain API program" устанавливался CS_NOCLOSE?
Через SetClassLong?


 
ECM ©   (2005-02-17 13:54) [4]

EnableMenuItem( GetSystemMenu( Form.GetWindowHandle, FALSE), SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
Это конечно не совсем то, что требовалось, но выглядит логичнее - и меню и кнопка становятся серыми и не реагируют на нажатие... :)


 
thaddy   (2005-02-17 15:47) [5]

I have tested all exactly like eachother. VCL and KOL behave the same in all cases. So I have to do it with your advice, or use my koldetour library to patch in a new CreateParams ;) In that case I do not have to override Tcontrol.
Tnx!


 
ECM ©   (2005-02-17 16:26) [6]

IMHO: CS_NOCLOSE - срабатывает только при создании окна ...:(


 
thaddy   (2005-02-17 17:10) [7]

type

PHack = ^Tcontrol;

then:

 destroywindow(form.getwindowhandle;
 PHack(form).fhandle:=0;
 form.clsStyle:=form.ClsStyle or CS_NOCLOSE;
 form.Createwindow; // or form.getwindowhandle;

This does what I wanted. Pity about the hack but it works as in API.

If you add Closequeryhandler, you have "uncloseable form", only task manager can close it. That was what I wanted.


 
thaddy   (2005-02-17 17:12) [8]

Ofcourse:
type
 PHack = ^THack;
 THack = object(TControl)end;


 
thaddy   (2005-02-17 17:27) [9]

// Maybe good utility routine for KOL.pas:
// hack not becessary if included in kol.pas
// maybe even in Tcontrol? like VCL recreatewindow?
// Are more uses than what I wanted.

type
 PHack = ^THack;
 THack = object(TControl)end;

procedure ReCreateWindow(aControl:PControl);
begin
DestroyWindow(aControl.Getwindowhandle);
PHack(aControl).fHandle:=0;
aControl.CreateWindow;
end;



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

Текущий архив: 2005.10.16;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.055 c
11-1108015146
Blure
2005-02-10 08:59
2005.10.16
Не прорисовываются иконки в TKolTreeView


14-1127557420
alexbou
2005-09-24 14:23
2005.10.16
Delphi 2005 Update 4 Release Candidate ???


2-1126957033
AlexLines
2005-09-17 15:37
2005.10.16
Относительные пути и win98


3-1125923970
LostDelpher
2005-09-05 16:39
2005.10.16
bof или EOF имеет значение true и на d7 где взять патч на ADO?


2-1127120832
Wolferio
2005-09-19 13:07
2005.10.16
Открытие файла