Recent

Author Topic: BGRA DTThemedGauge  (Read 2795 times)

SandyG

  • Jr. Member
  • **
  • Posts: 64
BGRA DTThemedGauge
« on: May 22, 2024, 04:48:51 pm »
Was messing with the 2 analog gauge in the BGRA Controls and came across and odd 'feature' of the the DTThemedGauge.

Seems if resizing the gauge at design time the pointer loses it origin or something. Picture attached. Stays that way when run as well (all on windows 11 Laz3, BGRA 9.03)

Before I start looking at it, was wondering if anyone has seen this. The regular DTAnalogGauge does not have this issue.

Sandy

SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #1 on: May 23, 2024, 05:24:05 am »
Found the issue, did a PR into the dev branch, again not sure if I botched it.

Was a one line change, had a typeo it seems

Code: Pascal  [Select][+][-]
  1. //Had drawing line from y to y
  2. FPointerBitmap.DrawLineAntialias(origin.CenterPoint.y, origin.CenterPoint.y, x, y, PointerSettings.Color, PointerSettings.Thickness);
  3.  
  4. // updated, in the PR
  5. FPointerBitmap.DrawLineAntialias(origin.CenterPoint.x, origin.CenterPoint.y, x, y, PointerSettings.Color, PointerSettings.Thickness);

Sandy

lainz

  • Hero Member
  • *****
  • Posts: 4544
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: BGRA DTThemedGauge
« Reply #2 on: May 23, 2024, 05:40:31 pm »
Thanks.

Question: Do you want to be part of BGRAControls team? If yes send me a PM and I will invite you, so you can manage the pull request..

SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #3 on: May 24, 2024, 11:15:40 pm »
I might down the road, still getting my hands dirty with all of this. Let me get some more experience doing more then hack debugging :) . I'm happy to help in any case.

May add a few features to the Themed Gauge... If I can, and that will help me get some more experience ;)

Likely on my list of Gauge features is something more like a rectangular style gauge (see also attached) like you might see on some of the other industrial control packages (Delphi). Will have to think about how to change things to support that.

Might not be too bad, but haven't had time to look at that yet.

Sandy


lainz

  • Hero Member
  • *****
  • Posts: 4544
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: BGRA DTThemedGauge
« Reply #4 on: May 24, 2024, 11:22:07 pm »
Looking good.

I will add you as deveolper, feel free to change the code and make improvements or new controls.

SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #5 on: June 01, 2024, 07:24:23 am »
Just started looking at the ThemedGauge code, a lot looks unfinished/unimplemented or Work in Progress.

The main question is their a reason that the position is an integer? It seems like it should be a float?

Finding that Maximum value for the scale has a property, but no Minimum. Neither are implemented. Only Maximum is a property. Also Angle is not implemented but exposed as a property. [edits]

Looking for a place to start, but for sure the Position I'm thinking must be a float or the gauge operation will have steps because of the integral values.

Any background or history on the Gauge development?

Lastly is the Name 'Themed' the intention, as I know some components are actually themed, or is themed in the case of the gauge meaning 'enhanced'?

Sorry for lots of questions, but want to start in a good direction before playing with some code.

Sandy
« Last Edit: June 01, 2024, 07:42:47 am by SandyG »

lainz

  • Hero Member
  • *****
  • Posts: 4544
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: BGRA DTThemedGauge
« Reply #6 on: June 01, 2024, 02:08:12 pm »
Hi, no one knows nothing about these components, try looking the original author in the forums.


SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #7 on: June 02, 2024, 05:59:37 am »
Did some searching and really didn't find much about the history, or really much at all on the Gauge.

I might start with a few simple things to get my feet wet.

Maybe from this list -
  • Convert Position to a float
  • Remove fixed constants for many things that seem to be in the code that should come from properties
  • Add missing properties and try to implement (Angle, min range, etc).
  • Add a triangle pointer
The only thing is that in converting the position from an integer to a float should I worry about about previous version compatibility? Can Properties be overloaded to keep compatibility when converting from a integer to a float?  (Need to check out fp specs I guess on this one).

Sandy


SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #8 on: June 03, 2024, 08:04:18 pm »
@lainz, @circular

I see some .pp files in the repository, along with the same file with a .pas extension. Should the .pp files be removed from the repo? It seems to cause confusion with Lazarus when editing the .pas file and compiling, and also me.

I see these file as .pp extensions -
  • dtthemedgauge.pp
  • dtanaloggauge.pp
  • dtanalogcommon.pp

Thanks

Sandy

lainz

  • Hero Member
  • *****
  • Posts: 4544
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: BGRA DTThemedGauge
« Reply #9 on: June 04, 2024, 02:32:02 am »
I see. Just delete them maybe these was copied by mistake...

About the value as float... I don't think it will be a big deal but yes published property can go wrong with the change. So change it and update the demo project.

SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #10 on: June 04, 2024, 04:07:03 am »
Thanks,

Will delete the .pp versions.

Once I get a bit more into it I'll try the demo project and make adjustments. Hopefully only minor stuff will have to be updated.

Thanks again!

Sandy

Josh

  • Hero Member
  • *****
  • Posts: 1310
Re: BGRA DTThemedGauge
« Reply #11 on: June 04, 2024, 07:26:40 am »
Hi

Just some thoughts.

be careful changing to float, any one using the component, it will break their project, they may not even be able to open their project to fix it.
(single/double as they have a fixed byte size, do not choose a type that is definded dependent on cpu/architecture)

using any float type, can have many bad side effects, if user does a standard comparison for value match they probably will not work.

i would stick with integer/cardinal type, then its up to usr to do any decimal resolution they need. As long as they can overide the displaying of value, so they can choose how the value is displayed, as some may want 0.12300  other may want 0000.123 etc.

props
Min,Max,Interval
-10000,15000,100
Would allow for a display of 250 distinct visual increments.
User could then overide the display as they seem fit, theymight want the value
to be displayed as -10,000 or -100.00 or -10.000 and in Red / 14,999 or 149.90 or 1.4999 and in Blue.

What might be beter is fix any bugs in existing, allowing for display override, then have a DecimalVersion of the Control that inherits the Fixed Control, that does the 'float stuff', that way you have best of both worlds, and any future bugs/fixes to the base control,propogates to the decimal version. that way it should have little to no impact on existing users, but a'new' controlif users need decimal, and it shouldbe easier to maintain.
« Last Edit: June 04, 2024, 07:34:16 am by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #12 on: June 04, 2024, 07:48:55 pm »
Josh -

Thanks for the comments.

Since this is a display control and everything is internally doing floating point, it's going to be just to figure out a way (if possible) to overload the property. Scaling integral numbers IMO is not a great solution, and while possibly more accurate, it's more of a pain to use. Have to think about this.

It's no problem to set the value of a floating point directly from an integer, it's just the reading that has the problem. My guess is most are setting the value of the Gauge, but not reading it, as they already have the value so why read the gauge when you already have it.

It's odd the original author had the gauge as an integer value as it not really going to help performance, and just complicates the display by not allowing the angle of the pointer to be anything it needs to be, and 'notchy' as it works.

Expanding it to have more points to make it smoother, again makes it more complicated to use. The resolution is as accurate as the display will allow. I'm thinking it will be sorta' like the knob where you can set the scale of the gauge and it will do the rest. Internally it's mostly floating to do all the calcs, so not much worry about that aspect of it... well until it breaks something  :)

Also thinking of decoupling the 'Range' from the scale. It's possible to have a gauge with multiple scales but the scale(s) might not dictate the range of the gauge. Have to think about that.

The Themed gauge as I see it was a work in progress, I think who ever was working on it did a great job in splitting out some of the components (needle, scales, etc) but I think a lot was left incomplete, but it's a very good start.

As to keeping a integer version I think the basic gauge would be good for that, and the 'Enhanced' version (DTThemedGauge) could move away from specifics without much worry. I really will have to see if I can make it compatible but not sure at this point. Have to see if I can overload a property to allow either float or int values. Just have to read the freepascal docs a bit more.

Going to re-read your post a bunch of times too, just to get a solid idea how to make it work as well as allow for it to be more feature complete.

Thoughts in progress!

lainz

  • Hero Member
  • *****
  • Posts: 4544
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: BGRA DTThemedGauge
« Reply #13 on: June 05, 2024, 02:33:41 am »
Maybe you just can create a new component and grab everything you need from the other controls and add your own stuff.

We already have more than one for buttons for example so there's no problem.

SandyG

  • Jr. Member
  • **
  • Posts: 64
Re: BGRA DTThemedGauge
« Reply #14 on: June 05, 2024, 05:24:00 pm »
Might be a plan but I think the current gauge is somewhat unfinished, hate to have more redundant components. BUT, I think what I might do is just see how far I can get, and see how compatible it ends up being. If not to far off then likley no new component, but will have to see.

I could not figure out how to overload a property with single/integer return value. I think because it's just the return type of the property that differs it may not work when overload , or I just did it wrong!

In any case, I'm going to move forward and see how incompatible it is when I get further along.

Sandy

 

TinyPortal © 2005-2018