Recent

Author Topic: [SOLVED] class function TCDWSButton.GetText doesn't return a result  (Read 2609 times)

lagprogramming

  • Sr. Member
  • ****
  • Posts: 407
lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas contains the following function. It can be noticed that it doesn't return a result.

Code: Pascal  [Select][+][-]
  1. class function TCDWSButton.GetText(const AWinControl: TWinControl;
  2.   var AText: String): Boolean;
  3. var
  4.   lCDWinControl: TCDWinControl;
  5. begin
  6.   lCDWinControl := TCDWinControl(AWinControl.Handle);
  7.   if lCDWinControl.CDControl = nil then Exit;
  8.   AText := TCDIntfButton(lCDWinControl.CDControl).Caption;
  9. end;

New code mimics result assignment of class function TCDWSCustomEdit.GetText

Code: Pascal  [Select][+][-]
  1. class function TCDWSButton.GetText(const AWinControl: TWinControl;
  2.   var AText: String): Boolean;
  3. var
  4.   lCDWinControl: TCDWinControl;
  5. begin
  6.   Result := False;
  7.   lCDWinControl := TCDWinControl(AWinControl.Handle);
  8.   if lCDWinControl.CDControl = nil then Exit;
  9.   AText := TCDIntfButton(lCDWinControl.CDControl).Caption;
  10.   Result := True;
  11. end;
« Last Edit: March 30, 2023, 06:21:01 pm by lagprogramming »

Bart

  • Hero Member
  • *****
  • Posts: 5465
    • Bart en Mariska's Webstek
Re: class function TCDWSButton.GetText doesn't return a result
« Reply #1 on: March 27, 2023, 11:59:12 am »
Please report in the bugtracker and attach your patch (as a proper diff).

Bart

lagprogramming

  • Sr. Member
  • ****
  • Posts: 407
Re: class function TCDWSButton.GetText doesn't return a result
« Reply #2 on: March 27, 2023, 04:49:53 pm »
Here is a patch

Code: Pascal  [Select][+][-]
  1. diff --git a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas
  2. index 795ca36d3e..1a90af04e9 100644
  3. --- a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas
  4. +++ b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas
  5. @@ -1704,9 +1704,11 @@ class function TCDWSButton.GetText(const AWinControl: TWinControl;
  6.  var
  7.    lCDWinControl: TCDWinControl;
  8.  begin
  9. +  Result := False;
  10.    lCDWinControl := TCDWinControl(AWinControl.Handle);
  11.    if lCDWinControl.CDControl = nil then Exit;
  12.    AText := TCDIntfButton(lCDWinControl.CDControl).Caption;
  13. +  Result := True;
  14.  end;
  15.  
  16.  class procedure TCDWSButton.SetText(const AWinControl: TWinControl;

Bart

  • Hero Member
  • *****
  • Posts: 5465
    • Bart en Mariska's Webstek
Re: class function TCDWSButton.GetText doesn't return a result
« Reply #3 on: March 27, 2023, 06:27:52 pm »
Please put it in the bugtracker, so it won't be forgotten.
I know next to nothing about CD widgetset.

Bart

wp

  • Hero Member
  • *****
  • Posts: 12457
Re: class function TCDWSButton.GetText doesn't return a result
« Reply #4 on: March 30, 2023, 03:49:05 pm »
Like Bart I have no experience with customdrawn WS, but since your solution is obvious and straightforward, I committed it. But please, report issues in the bugtracker where it is easier for us to trace regressions and side-effects.

 

TinyPortal © 2005-2018