Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Re: Component development



Permlink Replies: 6 - Last Post: Oct 11, 2017 9:37 AM Last Post By: Roy Woll Threads: [ Previous | Next ]
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Component development
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2017 12:58 AM
Hello,

I found some time to look at your solution now.
What I like about it is, that it just inherits from TTrackbar (instead
of copying and changing code in the copy in my solution) and that you do
not need to change the style definition.

But it has some issues, which I'm trying to get fixed step by step:

1. I added code to limit the value of the min-thumb to the value of
the max-thumb and vice versa. Ok, that's easy.

2. Your SetValueMax and Min methods do miss some other code as well:

    if Frequency <> 0 then
      LValue := Round(LValue / Frequency) * Frequency;


That's required to make the Frequency property work again and this one:

    if assigned(FOnChange) then
      FOnChange(self);


is required to make OnCHange event fire again. I haven't looked for the
OnTracking event yet.

3. Your DoRealign implementation is not complete yet. It lacks this one:
  if MinThumb <> nil then
  begin
    R := GetMinThumbRect;
    MinThumb.Visible := not ((R.Right <= R.Left) or
                             (R.Bottom <= R.Top));
    MinThumb.BoundsRect := R;
  end;
 
  if MaxThumb <> nil then
  begin
    R := GetMaxThumbRect;
    MaxThumb.Visible := not ((R.Right <= R.Left) or
                             (R.Bottom <= R.Top));
    MaxThumb.BoundsRect := R;
  end;


If that's not present, the component looses thumbs when you anchor it
left and right and then resize the window.

4. The highlight is not being properly cared for yet and that will get
a bit tricky. The highlight is not being used in Win32 but in
Android. In case of our trackbar it should be the space between both
thumbs. Currently it is mostly not there and if it's there it's from
the left end of the trackbar towards the left thumb and even that's
mostly incomplete.

Issue with that is, that the UpdateHighlight method is a private one
and it's also not virtual. So overriding that is not possible.
You might want to vote for this one:
https://quality.embarcadero.com/browse/RSP-19200

It internally uses GetThumbRect, which can be overridden, but that
one is also being used in DoRealing, which would have to be "freed"
from that GetThumbRect or somehow made call the old version of it.

5. When running this on Android and pulling the thumbs towards the
middle it leaves painting artifacts of the tumbs on both ends.
I don't know why this is yet.

6. When dragging a thumb with the mouse and not lifting the mouse
button before the mouse gets outside the window the value of that
thumb will be the minimum or maximum value, but the thumb will not
yet be at the end of the trackbar but stop a little bit before.
That only happens when not releasing the mouse button while the
pointer is still inside the window.

Greetings

Markus
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Component development
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2017 11:23 AM   in response to: Markus Humm in response to: Markus Humm
Am 08.10.2017 um 09:58 schrieb Markus Humm:


4. The highlight is not being properly cared for yet and that will get
a bit tricky. The highlight is not being used in Win32 but in
Android. In case of our trackbar it should be the space between both
thumbs. Currently it is mostly not there and if it's there it's from
the left end of the trackbar towards the left thumb and even that's
mostly incomplete.

Issue with that is, that the UpdateHighlight method is a private one
and it's also not virtual. So overriding that is not possible.
You might want to vote for this one:
https://quality.embarcadero.com/browse/RSP-19200

It internally uses GetThumbRect, which can be overridden, but that
one is also being used in DoRealing, which would have to be "freed"
from that GetThumbRect or somehow made call the old version of it.

Some progress on that front, even if I don't know exactly why it works.
I declared a new method UpdateHighlightMinMax. I also overwrote all
other methods which call the original UpdateHighlight. In the overridden
versions I called inhertied and my new UpdateHighlightMinMax.

I had the issue that changing TrackHighlight.Position.X never changes
that value. It stayed at 0. I don't know why, but my workaround is
to change the left margin, which at least from the look seems to be
working. What I also don't understand is why I need to add "size"
(which is half of the thumb width if I'm not mistaken) to the position
of the MinThumb...

Maybe I should rather use the ThumbMin position to base it on...

Greetings

Markus
loki loki

Posts: 787
Registered: 7/1/02
Re: Component development
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2017 1:22 PM   in response to: Markus Humm in response to: Markus Humm
sorry, the embarcadero forum are suck again, and i don't have the
history, of with component you speak ?
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Component development
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2017 10:32 PM   in response to: loki loki in response to: loki loki
Am 08.10.2017 um 22:22 schrieb loki loki:
sorry, the embarcadero forum are suck again, and i don't have the
history, of with component you speak ?

28th September the Trackbar with 2 thumbs.
And there I'm referring to Roy Woll's approach.

Greetings

Markus
Roy Woll

Posts: 25
Registered: 11/26/06
Re: Component development
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 10, 2017 8:45 PM   in response to: Markus Humm in response to: Markus Humm
Markus,

Sorry, I didn't notice your post earlier. I have worked on a more solid solution since my last share. I can share you its current state, which I think may address many of your issues. If you are interested I can post it here, or you can email me and I can attach a the current file.

-Roy
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Component development
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 11, 2017 8:58 AM   in response to: Roy Woll in response to: Roy Woll
Am 11.10.2017 um 05:45 schrieb Roy Woll:
Markus,

Sorry, I didn't notice your post earlier. I have worked on a more solid solution since my last share. I can share you its current state, which I think may address many of your issues. If you are interested I can post it here, or you can email me and I can attach a the current file.

-Roy

Hello,

thanks for your offer.
I did a bit of work myself, but I'd gladly look at your improvements.
I've sent you a private message (you need to go into the web frontent to
see it)

Greetings

Markus
Roy Woll

Posts: 7
Registered: 3/10/00
Re: Component development
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 11, 2017 9:37 AM   in response to: Markus Humm in response to: Markus Humm
I don't see a private message. If you want, you can email me at roywoll at gmail.com
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02