KSVC Controls Bug when scrollbar width overridden

Home Forums Konopka Signature VCL Controls (formerly Raize Components) KSVC Controls Bug when scrollbar width overridden

Viewing 2 reply threads
  • Author
    Posts
    • #4313

      I recently upgraded to KSVC 8 on Delphi 12.3 and 8.0.1 on 13 and I’ve noticed some odd behavior under special circumstances. I have a VCL database application that has two versions, one for the desktop and one designed especially for a Windows 11 tablet that’s touch screen friendly. The problems I’ve noticed are on the version for the tablet, there are a number of things that had to be adjusted for use on a touch screen. The big thing is that to scroll comboboxes and listboxes using touch I had to override the operating system’s default scrollbar width so that any control with a scrollbar has a width wide enough for a person to use their finger to scroll the given control.

      This is the code I’ve been using to adjust the width of the scroll bars, I know from the person who gave this to me that it affects scrollbar width system wide.

      procedure TMainForm.SetScrollbarwidth;
      
      Var
        LTemp: TNonClientMetrics;
      
      begin
        ResetScrollBarsClick( Self );
        FillChar(LTemp, sizeof(LTemp), 0);
        LTemp.cbSize := sizeof(LTemp);
        SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(LTemp), @LTemp, 0);
        FOldScrollbarWidth := LTemp.iScrollWidth;
        { Save Scrollbar width }
        LTemp.iScrollWidth := 34;
        SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(LTemp), @LTemp, 0);
      end;

      To restore the system scrollbar width:

      procedure TMainForm.RestoreScrollbarWidth;
      
      var
        LTemp: TNonClientMetrics;
      begin
        If FOldScrollbarWidth <= 0 then Exit;
        FillChar(LTemp, sizeof(LTemp), 0);
        LTemp.cbSize := sizeof(LTemp);
        SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(LTemp), @LTemp, 0);
        LTemp.iScrollWidth := 17;
        SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(LTemp), @LTemp, 0);
      end;

      After this code changes the scrollbar width there are at least two problems that I’ve seen, the first is that in a TrzListBox the width of the scrollbar is set at the specified width but the handle width does not match the scrollbar width and appears at the original system width of the handle.

      Second, a TrzCombobox has issues with it’s scrollbar when you click on the pulldown menu. As you attempt to scroll the pulldown list at various random times the Up and Down arrow buttons stop working and if you click on the track to try and scroll the thumb that way it also randomly doesn’t respond.

      I’ve been able to test this in a small example program. Is there any way to overcome these issues in code or do I need to report this to Embarcadero Quality Central?

    • #4314
      Ray Konopka
      Keymaster

        Hi Chris,
        The TRzListBox and TRzComboBox are descendants of the TCustomListBox and TCustomComboBox, respectively. Neither version does anything specific with the scroll bars. I’d be curious if you try out the same technique with the TListBox and TComboBox, do you get the same behavior?

        Ray

      • #4320

        Hi Ray:

        I did a quick test with TListbox and TCombobox and yes as far as I can tell the results are the same, the thumb in the TListbox is the original system width not the width set for the scrollbar and the TCombobox randomly sticks where clicking the up / down arrows does not scroll and clicking on the track also does not scroll the list.
        TListbox

        • #4327

          Hi Ray:

          I’ve been getting really inconsistent results with my test programs, originally when I tried changing my test project components to VCL components I got the same component behavior. However when I created a new VCL project and tried recreating this in VCL I couldn’t reproduce the problem behavior. Now I have two projects, one strictly KSVC and one mostly VCL with a TrzCombobox and the KSVC project exhibits the behavior I reported while the VCL project with a single TrzCombobox which does not exhibit the behavior I reported.

          The KSVC test project exhibits the problem behavior in Delphi 12.3 and 13, the VCL test project does not have the problems I described in either 12.3 or 13. I’m including links to download both projects, I hope you could take a look to see if you get the same behavior.

          Thanks!
          KSVC: KSVC Test Project
          VCL: https://drive.google.com/file/d/1FNlZNQMp2Os8tJaerP27ZCgrEglo1GpB/view?usp=sharing

    Viewing 2 reply threads
    • You must be logged in to reply to this topic.