Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "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.041 c
14-1127394578
GuAV
2005-09-22 17:09
2005.10.16
Вопрос про синтаксис :-)


3-1125591659
suharew
2005-09-01 20:20
2005.10.16
Кэшируются базы???


2-1126686038
JTAG
2005-09-14 12:20
2005.10.16
Про tray


14-1127844074
LordOfRock
2005-09-27 22:01
2005.10.16
Ульяновск


6-1120112485
Леха.
2005-06-30 10:21
2005.10.16
POST





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский