Recent

Author Topic: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?  (Read 17357 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #15 on: November 02, 2013, 04:09:08 pm »
OK, I forgot that Bart Broersma had given me this tip that takes care of switching based on BiDiMode for each control.  But there was still a problem with the way the HintWindow displayed the text, but only when I used Hebrew text.  Maybe there has been a change in Lazarus code because that problem doesn't seem to exist now:

Bart Broersma's Tip:
=============
In application.inc we find these commented out lines

    // make the hint have the same BiDiMode as the activating control
    //FHintWindow.BiDiMode := FHintControl.BiDiMode;  <== Activate this line

in TApplication.ShowHintWindow
Lazarus Trunk / fpc 2.6.2 / Win32

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #16 on: November 03, 2013, 03:57:12 pm »
[Solved - sort of] OK.  I have something that seems to work.

In File 'Application.inc' near line #840 in routine
'TApplication.ShowHintWindow' I activated this line that had been commented out.
Code: [Select]
procedure TApplication.ShowHintWindow(const Info: THintInfoAtMouse);
  ...
  ...
  // make the hint have the same BiDiMode as the activating control
  FHintWindow.BiDiMode := FHintControl.BiDiMode; // <== Activate This Line
  ...
  ...
end;


Then in the File 'HintWindow.inc' I added this as the last line of routine 'THintWindow.CalcHintRect' near line #276.
Code: [Select]
function THintWindow.CalcHintRect(MaxWidth: Integer; const AHint: String; AData: Pointer): TRect;
  ...
  ...
  if BiDiMode<>bdLeftToRight then inc(Result.Right);
end;
« Last Edit: November 03, 2013, 06:56:23 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #17 on: November 03, 2013, 06:01:30 pm »
@Avishai: I enabled BidiMode.
You are right, it looks wrong RTL. Please answer my questions in bugtracker, and let's contunue the discussion there.

Bart

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #18 on: November 03, 2013, 07:30:06 pm »
Thanks Bart.  I have added a comment to BugTracker.
Lazarus Trunk / fpc 2.6.2 / Win32

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #19 on: November 03, 2013, 11:45:32 pm »
Fixed THintWindow.CalcHintRec.

Bart

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #20 on: November 04, 2013, 04:18:02 pm »
Bart, I did SVN Update but I don't see any relative code changes and I'm still seeing the same behavior as before.  No BiDi support.  Did I miss something? 
Lazarus Trunk / fpc 2.6.2 / Win32


Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #22 on: November 04, 2013, 06:31:12 pm »
Yes, I have Lazarus 1.3 - 43372.  I don't understand why I'm not seeing the changes.
Lazarus Trunk / fpc 2.6.2 / Win32

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #23 on: November 04, 2013, 06:57:11 pm »
Well, do you see the changes in the code I made?

Bart

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #24 on: November 04, 2013, 07:01:07 pm »
Yes, I'm looking at it now.  But in Application.inc it still has

//FHintWindow.BiDiMode := FHintControl.BiDiMode;

So I guess that's why I'm seeing the old behavior.
Lazarus Trunk / fpc 2.6.2 / Win32

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #25 on: November 04, 2013, 07:13:42 pm »
I just uncommented //FHintWindow.BiDiMode := FHintControl.BiDiMode; and I got the same chopped-off Text as before.  If it's working correctly for you, it must be something I'm doing.  But I tried adding the 'inc(Result.Right)' back into 'HintWindow.inc' and it looks as it should again.

Sorry to be such a bother.
Lazarus Trunk / fpc 2.6.2 / Win32

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #26 on: November 05, 2013, 10:01:58 am »
Avishai,

Quote from: Avishai
and I got the same chopped-off Text as before.

The fix for that is not in application.inc, but in hintwindow.inc.

You have local changes to LCL which prevent a decent svn up.
Please do a
Code: [Select]
cd \path\to\lazarus
make clean
svn revert -R
svn up

and then rebuild Lazarus.

Bart

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #27 on: November 05, 2013, 10:23:14 am »
Thanks Bart.

Quote
You have local changes to LCL which prevent a decent svn up.

When ever I experiment with Lazarus code, I work on a copy so that I can revert back to the original.

However, the 'Make Cleal All' seems to have cleared up the problem.  I should have thought of that myself.  Anyway I'm now getting proper display.

Thank you so much for your help and your patience.
Lazarus Trunk / fpc 2.6.2 / Win32

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: [Solved] How to get TControl.Hint to respect Parent.BiDiMode?
« Reply #28 on: November 05, 2013, 11:48:23 am »
You're welcome.
Please close the associated bugreport.

Bart

 

TinyPortal © 2005-2018