Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2008.08.31;
Скачать: [xml.tar.bz2];

Вниз

Problem with 2.83 since 2.53   Найти похожие ветки 

 
Dodfr   (2007-10-21 17:12) [0]

Hi,

In my project I do some height and size changes of multiple forms within the OnPaint and for unknown reason it produce 100 %CPU since I jumped from KOL 2.53 to 2.83

The 100% CPU is because it endless loop into KOL.TControl.ProcessMessages once the OnPaint is done.

I know my question is nearly impossible to answer "as is" but may be somebody know if something changed in messages or form painting management ?

regards.


 
homm ©   (2007-10-21 17:47) [1]

> [0] Dodfr   (21.10.07 17:12)
> size changes of multiple forms within the OnPaint

Maybe don"t use events, which not intend for that purpose?


 
Dodfr   (2007-10-21 19:36) [2]

What I do is to call form.invalidate from a Timer every second, which fire the OnPaint event from which I do the form drawings, this is the standard way to do it I think.

TControl.ProcessMessages is were the program falls once OnPaint is done.


 
Vladimir Kladov ©   (2007-10-21 20:26) [3]

Possible scheme is:
1) you change size in OnPaint;
2) When out from OnPaint, message loop receives WM_PAINT (since size changed);
goto 1)

Very short loop. You can solve it, e.g. following way:
if Control.Width <> newWidth then ControlWidth := newWidth;

But this is not garantee, that every time newWidth will be another. It is better to send a WM_USER+magic_number to a form, and process it in OnMessage, calculating and assigning new size there.


 
ANTPro ©   (2007-10-21 20:27) [4]

> [2] Dodfr   (21.10.07 19:36)

if assigned(form) then form.invalidate; ?


 
homm ©   (2007-10-21 20:45) [5]

Зачем изменять размер в OnPaint, убей не пойму. OnPaint  что-бы в нем рисовать!


 
Dodfr   (2007-10-21 21:02) [6]

homm : sorry I can"t read russian

antpro : my forms are always assigned so no need to test for this.

vlad : yes I do a form.height and form.width, it worked well with 2.53 but if you say about it then I will follow your advice. I tested it in a new empty project, put form.height:=100; form.width:=100; within .OnPaint and it worked so I thought it was not the real source of the problem.


 
homm ©   (2007-10-21 21:22) [7]

> [5] homm ©   (21.10.07 20:45)

Ok, I try :)

Why you use OnPaint for resizing you contols? This event need for painting and painting only.
If you already use Timer, you can do resize from it metod OnTimer.


 
ANTPro ©   (2007-10-21 22:09) [8]

> [6] Dodfr   (21.10.07 21:02)

Show your code :)


> [6] Dodfr   (21.10.07 21:02)
> I can&#146;t read russian

http://www.google.com/translate_t


 
Dodfr   (2007-10-21 22:48) [9]

I understand that chaging height and width should (re)call OnPaint but the endless loop never go back to onPaint and stay inside ProcessMessage loop.

The code is too long to be showed here but I am still wondering what changes from 2.53 to 2.83 make my drawing routine not work.

If I remove some .height and .width the program works again, but not all have an impact over the loop.

I will try to search more with your informations.

Thank you all.


 
homm ©   (2007-10-21 23:29) [10]

> [9] Dodfr   (21.10.07 22:48)
> I am still wondering what changes from 2.53 to 2.83 make
> my drawing routine not work.

You think changing size of controls is a «drawing routine»??? «Drawing routine» should works pefect.


 
Dodfr   (2007-10-22 01:02) [11]

My window(s) may change size at each redraw this is why I change it during OnPaint drawing routine that calculate width and height space needed.


 
homm ©   (2007-10-22 06:39) [12]

> [11] Dodfr   (22.10.07 01:02)

I say the same many times! Don"t use OnPaint for enething else but drawing!
You may calculate change size of you controls in another method, for example in timer. When you change size, windows will receive WM_PAINT messages automaticaly.
Risize controls OnPaint is a bad idea!


 
GMax   (2007-10-23 01:29) [13]

ANCHORS_WM_SIZE ?
this is one "size" noticeable change


 
thaddy   (2007-10-23 12:16) [14]

Can you email me the source? - to my real account - ?
See what I can do.



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

Форум: "KOL";
Текущий архив: 2008.08.31;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.005 c
15-1215472113
Pavia
2008-07-08 03:08
2008.08.31
WALL·E


4-1195492375
Мой ник
2007-11-19 20:12
2008.08.31
Перевод PByte -> PChar


1-1197016344
@!!ex
2007-12-07 11:32
2008.08.31
Положение окна на экране(Z)


1-1197786766
Алекс_
2007-12-16 09:32
2008.08.31
обработка событий VK_DOWN для дочерних контролов


2-1216745096
Дима
2008-07-22 20:44
2008.08.31
Как расчитать MD5 - хеш самого себя (Приложения)





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский