Вниз
Скачать: 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 вся ветка

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



Память: 0.47 MB
Время: 0.027 c
9-1116326699
VVV-First
2005-05-17 14:44
2005.10.16
GlScene, Objects


5-1103272219
han
2004-12-17 11:30
2005.10.16
Копонент наподобии CombBox


3-1125669985
jeka_t
2005-09-02 18:06
2005.10.16
Как в запросе указать условие отбора по дате с временем...


14-1127366703
Starcom
2005-09-22 09:25
2005.10.16
Определение Noname Материнки?


3-1125486181
intaari
2005-08-31 15:03
2005.10.16
данные в DBGrid как в cross-tab отчета




   Наверх