Recent

Author Topic: Working on BGRAKnob features  (Read 3476 times)

SandyG

  • Jr. Member
  • **
  • Posts: 66
Re: Working on BGRAKnob features
« Reply #15 on: May 21, 2024, 11:36:05 pm »
Think I did the PR to the dev branch. Feel free to change any formatting, etc.

Let me know if I can do better with the code as well.

Sandy

SandyG

  • Jr. Member
  • **
  • Posts: 66
Re: Working on BGRAKnob features
« Reply #16 on: May 22, 2024, 01:09:31 am »
I may have botched the PR in github, let me know if I did.

Sandy

lainz

  • Hero Member
  • *****
  • Posts: 4558
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Working on BGRAKnob features
« Reply #17 on: May 22, 2024, 01:59:25 am »
Hi again, I've sent a personal message to circular to see if she can test the changes.
« Last Edit: May 22, 2024, 02:02:45 am by lainz »

SandyG

  • Jr. Member
  • **
  • Posts: 66
Re: Working on BGRAKnob features
« Reply #18 on: May 22, 2024, 02:13:25 am »
Thanks!!

Sandy

lainz

  • Hero Member
  • *****
  • Posts: 4558
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Working on BGRAKnob features
« Reply #19 on: May 22, 2024, 03:09:21 am »
Thanks to you.

Just wait sure your code will be tested.

circular

  • Hero Member
  • *****
  • Posts: 4276
    • Personal webpage
Re: Working on BGRAKnob features
« Reply #20 on: May 25, 2024, 09:32:46 am »
Hello SandyG,

Thank you very much for your contribution. I have reviewed the changes on the GitHub merge discussion:
https://github.com/bgrabitmap/bgracontrols/pull/175

I propose to change the way tkSector works, so that MinValue and MaxValue will still be relevant.

Regards
Conscience is the debugger of the mind

SandyG

  • Jr. Member
  • **
  • Posts: 66
Re: Working on BGRAKnob features
« Reply #21 on: May 25, 2024, 07:28:22 pm »
Glad to give back to the community and make the acquaintance (@circular @lainz)

I just took a look at your comments, all of the suggestions seem good, commented in Github, will take another crack at the sector settings as well.

If you have a 'jcfsettings.cfg' file for the JEDI formatter that you can attach as I have changed mine so many times, I'm not sure what's good anymore and would be great to have the same as the BGRA project uses, that is of course with the exception space before and after the ' : ' ... JK ;)

Sandy


Hello SandyG,

Thank you very much for your contribution. I have reviewed the changes on the GitHub merge discussion:
https://github.com/bgrabitmap/bgracontrols/pull/175

I propose to change the way tkSector works, so that MinValue and MaxValue will still be relevant.

Regards

SandyG

  • Jr. Member
  • **
  • Posts: 66
Re: Working on BGRAKnob features
« Reply #22 on: May 28, 2024, 06:01:41 am »
Ok, hopefully the last cut unless anyone finds a bug ;)

This version removed the notion of having to set the SectorDivisions. When in ktRange, the Knob behaves as it did. When in ktSector the values for MinValue and MaxValue are now used to compute the span, but it's looking only at integral values. That is, if you set MinValue to 14.3, it will be rounded (using pascal Round()) to 14, and similarly for the MaxValue. The number of divisions are now internally computed from this span.

Also in ktSector mode, the Min/MaxValue set the range for the knob, and it can be negative to start.

For example,
MinValue 0, MaxValue 5 would lead to a knob with 5 sectors that will cause the knob to snap to, and return values 0 to 5
MinValue  -5, MaxValue 5 would lead to a knob with 10 sectors, and return values -5 to 5

One other trick, if you want a knob with more or less integral values returned, you can try a trick... Set knob to ktSector mode, then set the MinValue = 0, MaxValue = 100. This will give a semi-smooth knob like action but values will be more or less 0,1,2,3...99,100. It's floating point so your mileage may vary.

This change makes the operation more consistent (Thanks @Circular for suggestion).

The attacked zip has BGRAKnob.pas which is v2.10, and a NEW test program.

Note : if you have the old test application you will get an exception as the SectorDivisions property is no longer used.

To do build the project, unzip the file into a clean directory where you can build Lazarus projects, look in the folder for the BGRAKnob directory. You will need to rename you existing BGRAKnob.pas in the components directory (where ever that may be installed) and copy the BGRAKnob.pas into that directory. Ensure you have v2.10 (see constants at top of source).

Compile the BGRA Controls via the package manager, and then install (will rebuild Lazarus). Build the project. If you have an exception on start up, you likely have the wrong version of BGRAKnob.pas being built.

Will make an update to git shortly as well.

circular

  • Hero Member
  • *****
  • Posts: 4276
    • Personal webpage
Re: Working on BGRAKnob features
« Reply #23 on: May 28, 2024, 05:41:41 pm »
Thank you very much Sandy. All sounds good to me.

I've uploaded your sample project as well on Git.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018