Форум: "KOL";
Текущий архив: 2005.10.16;
Скачать: [xml.tar.bz2];
Вниз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 вся ветка
Форум: "KOL";
Текущий архив: 2005.10.16;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.043 c