Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-03

TWSProgressBar.SetPosition() - what is it for?

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I've just added TProgressBar support for LCL-fpGUI, but I find the widgetset design extremely confusing.

For example, I implemented TFpGuiWSProgressBar.SetPosition() - the component is painted on the form, but the position property was never set. Adding a SendDebug() call inside TFpGuiWSProgressBar.SetPosition() I noticed that it is _never_ called. Not at the creation of the form, and not when you set the ProgressBar.Position seems to go via the ApplyUpdates() method. I could confirm this inside the progressbar.inc file where TCustomProgressBar class is implemented. So what is TWSProgressBar.SetPosition() then used for, and when is it called?

I had a look at the LCL-Qt widgetset implementation for TProgressBar. I can see code duplication (setting the Position information) in ApplyUpdates and SetPosition() as well.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

zeljko
to Graeme Geldenhuys
Graeme Geldenhuys wrote 19 lines
Hi, I've just added TProgressBar support for LCL-fpGUI, but I find the widgetset design extremely confusing. For example, I implemented TFpGuiWSProgressBar.SetPosition() - the component is painted on the form, but the position property was never set. Adding a SendDebug() call inside TFpGuiWSProgressBar.SetPosition() I noticed that it is _never_ called. Not at the creation of the form, and not when you set the ProgressBar.Position property at runtime. Everything seems to go via the ApplyUpdates() method. I could confirm this inside the progressbar.inc file where TCustomProgressBar class is implemented. So what is TWSProgressBar.SetPosition() then used for, and when is it called? I had a look at the LCL-Qt widgetset implementation for TProgressBar. I can see code duplication (setting the Position information) in ApplyUpdates and SetPosition() as well.

Yes, that's something pretty weird in TProgressBar implementation.I've asked about it on mailing list few months ago afair, but no answer.

zeljko

Reply by email

Graeme Geldenhuys
to zeljko
zeljko wrote
Yes, that's something pretty weird in TProgressBar implementation.I've asked about it on mailing list few months ago afair, but no answer.

Also the ApplyUpdates() idea is extremely inefficient. You change one property in TProgressBar, and at the widgetset level, every single property of TProgressBar has to be checked and assigned to the widgetset progressbar component. A crazy design.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Graeme Geldenhuys
to Mattias Gaertner
Mattias Gaertner wrote
It can be deleted. Do you need it?

No I don't need TFpGuiWSProgressBar.SetPosition(), because of the weird TProgressBar design, where every property change goes via ApplyUpdates(). I just implemented it because it was a blank virtual method from a base class.

But this raises the other question. Why is TCustomProgressBar implemented so different and inefficient.... every property change going through TCustomProgressBar.ApplyUpdates. I say inefficient, because now all the backend widgetsets must check and set all properties of the ProgressBar widget, even if only a single property value has changed.

I ran git-blame to see when it was introduced, and by whom. But the code predates the SubVersion repository.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email