-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update bgraknob.pas to V2 upgrade #175
Conversation
Added numerous event handlers Added Mouse Wheel support Added Sector support
When testing out the Themed gauge it would work fine IF you didn't change the default size. If you did the Pointer would be all over the place. Found a flip parameter in the DrawPointer method that had both points sent to some y values. Minor change.
@circular17 can you check this? It should not be hard to test, just check if everything works fine in LazPaint where you use this control.. |
Ran into an issue where some property values were not being saved in the .lfm, notably when the min/max values were 0. This made the default values come from the Create method which is only a fall back if not set by the design time props. Set property to 'nodefault' seems to force it to always write. Oddly only happened with the floating point type when the value was 0.
@sganz please take care of this, if you can test with LazPaint first, so everything is working fine.. |
Tested the BGRAKnob with Lazpaint. It exists only in the 3D import. Default values for the v2 knob works fine with defaults. Also tested with Mouse Wheel enabled and works fine. Tested with Slow Snap enabled, works well. I'll try to do a merge and see how bad I mess up here on git work now. Sandy |
Thanks! |
@lainz I don't think I can merge, you may have to do it. |
Done |
Thank you @sganz for the improvements on the knob control! It's great to have new contributors bringing their own perspective. Apologies for the late reply, I have been traveling. Looking at the changes, I note that there are changes in spacing. I guess you have a tab size of 4 whereas in the file it was a tab size of 2. I do understand that you would like to add spacing before I don't really mind changing the spacing, however to visualize the changes in the file, it is easier when it stays the same, so that only the parts that are actually changed are shown. For simplicity, I suggest to set the block indentation to 2 in the options of Lazarus (Tools > Options and then Editor > General > Tabulation and indentation) and to use JEDI formatting at the bottom of the Source menu in Lazarus. I've applied JEDI formatting. So here are the changes: I can see you've added properties and changed a few methods. I like the wheel feature, it seems quite natural to use that, even more so with touchpad scrolling. Regarding the change in the IFDEF Regarding the possible exception in begin
if OldMin = OldMax then
begin
if OldValue <= OldMin then exit(NewMin) else exit(NewMax);
end;
... Regarding the MinValue and MaxValue are limited to integers and SectorDivisions property is removed:
MinValue and MaxValue are not limited to integers and SectorDivisions is kept:
What do you think? |
We need to think as well about default value of properties. When adding new properties, we can keep the code backward compatible if those new properties have default value that are defined, so that they won't be added to the LFM file if unchanged. That way, when loading with an older version of BGRAControls, there won't be any missing property error. In all cases, thanks for engaging with us and welcome onboard! |
I made a mistake at some point and used the code format tool but didn't have a good reference for setting up. I'll look at getting my set up closer to what exists. I really struggle with Pascal formatting :) Do you have a 'jcfsettings.cfg' for the JEDI formatter that you can send so I have exactly the same?
I don't know if I changed that, I would have to look at git and see, but I had no intention of changing it, might have been a mistake. The code format tool split the lines up so I manually put them back to a single line. May have botched something, but really didn't try to change that. I think the change was made possibly prior and maybe I just formatted different, but really no intention on changing it.
Yeah, that's likely better have to update and test but I like doing something better then tossing and exception
I have to think more about the sector. It was a bit of a shoehorn into the knob and gets tricky. The idea of the sectors will still allow the angle positions (start/stop) with fixed start from a value of 0. It's not ideal that the value range from 0-255. The mapping back and forth with setting minValue, and maxValue internally might be tricky, at least as a minimum they need to be integers or the snap to a sector gets more complicated (or really just more work ;) In any case, the first example in removing the sectors and using the integer range between MinValue and MaxValue (your first case above would be same as 80 sectors with changes to the returned Value). This might not be too bad. I think where it gets tricky (In my head) was with mouse and wheel movement snapping to the correct sector. I would say the only think that I would mention is that the setting for sectors is possibly easier to understand then the span of the Min/MaxValue range but I might be thinking different. Let me try the first option and see how that works! Thanks for the comments and feedback. If you have a configuration file for the JEDI formatter that would be awesome!! Sandy |
Hi Sandy, I wasn't aware of a specific configuration for the JEDI formatter, as I use the default settings. However, there are lot of options indeed, that's cool. Here is my config file. You may as well get the default seetings by removing the config file. Regarding the I've restored the number to About the sectors, I understand it might not be as straightforward to use I understand there might be some difficulty with handling the wheel. You're welcome to ask any question if needed. Happy experimenting! Circular |
Got the file, I likely could have just got it from a fresh load of Lazarus, but at least it's what you are using and should hopefully not mess up the projects formatting. Might be a good thing down the road to set it up exactly how you like the code to look and save as part of the BGRA project so others can have similar project formatting. It's odd when I run your config and reformat the knob code it does break up the single line of compiler line options that you reverted back (** operator). Thanks for fixing up the code in any case, I'll take another crack at the sector options and see how far I get. I think you are right, it can be done with Min/Max values alone to keep from adding another set of props. I'll pull from the latest dev branch and make sure I'm not working on old code! More hacking ahead! Thanks and please never feel like you can't give me pointers, I pretty much learn from others examples and using the debugger these days so always really appreciate code feedback, helps me do a better job and possibly learn something 😄 Sandy |
Added numerous event handlers
Added Mouse Wheel support
Added Sector support
See also Forum thread