Converting from TADVTrackBar to TMSFNCTrackBar

Having recently made an almost successful transition from Delphi to Lazarus, I was looking forward to a more smooth redevelopment of my large application. Whilst in Delphi I utilized several TMS VCLs. The one that had the most flair for my users was the TADVTrackBar. I had it set up to really have a gorgeous user interface. Of course that VCL was not compatible with Lazarus, so I purchased the UI pack that had a newer replacement for TADVTrackBar. I thought it would be a straightforward set up to duplicate my original configuration of the TrackBar. It was not and now I am completely lost. I have attempted to use the UP pack developers’ guide. The problem is that I cannot correlate the parameters of the TMSFNCTrackBar with the parameters of the TADVTrackBar. I set several parameters in the TMSFNCTrackBar Object Inspector to various colors, believing that seeing their effect on the TMSFNCTrackBar would help me duplicate the set of parameters I was using on TADVTrackBar. That did not work. So I have three questions:
(1) Which TMSFNCTrackBar parameters have the same effect as the following TADVTrackBar? Are the following parameters equivalent?

	TADVTrackBar		TMSFNCTrackBar

Slider.Color ?
Slider.ColorCompleted ?
Slider.ColorCompletedTo ?
Slider.ColorTo ?

I tried the following and only one of the parameters worked:

	TADVTrackBar		TMSFNCTrackBar

Slider.Color Fill.Color
(this does color all of
the RMSFNCTrackBar except
for the slider area
Slider.ColorCompleted ?
Slider.ColorCompletedTo ?
Slider.ColorTo ?

(2) None of the other three work, nor does the code sample on page 87 of the TMS FNC UI Pack Developer’s Guide.

(3) If I am going about this in the wrong manner, please tell me how to properly proceed.

Thank you very much for any help you can provide to me.
Carmichael John

Hello,

(1) TTMSFNCTrackBar has been redesigned from scratch. We don't have an equivalent to these properties, but we'll consider them to be added in a future version.

(2) We just tested the sample code in Lazarus and it worked. Can you be more specific what issue do you run into?

(3) You can implement the OnBeforeDrawTrackLine event. The following sample should get you started:

procedure TForm1.TMSFNCTrackBar1BeforeDrawTrackLine(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; var AAllow: Boolean;
  var ADefaultDraw: Boolean);
var
  r: TRectF;
  sv: Single;
begin
  //Skip the default drawing procedure
  ADefaultDraw := False;
  
  //Calculate where the completed and uncompleted parts meet: 
  sv := 4 + (ARect.Right - ARect.Left) / abs(TMSFNCTrackBar1.Max - TMSFNCTrackBar1.Min) * (TMSFNCTrackBar1.Value - TMSFNCTrackBar1.Min);

  //Gradient look
  AGraphics.Fill.Kind := gfkGradient;

  //Draw "completed" rectangle:
  r := RectF(ARect.Left, ARect.Top, sv, ARect.Bottom);
  AGraphics.Fill.Color := clRed;
  AGraphics.Fill.ColorTo := clBlue;
  AGraphics.DrawRectangle(r);
  
  //Draw the "uncompleted" rectangle:
  r := RectF(sv, ARect.Top, ARect.Right, ARect.Bottom);
  AGraphics.Fill.Color := clBlue;
  AGraphics.Fill.ColorTo := clRed;
  AGraphics.DrawRectangle(r);
end;  

Tunde Keller,
Thank you so much for your reply and the code for the OnBeforeDrawTrackLine event. I will try it today, and I look forward to the new version of TMSFNCTrackBar. I have been extremely please with TMS software for many years now, and your prompt and informative response to my query reinforces that good feeling.
Thank you again, John

2 Likes