Recent

Author Topic: [SOLVED]Underline character in app hint tips  (Read 2066 times)

petevick

  • Sr. Member
  • ****
  • Posts: 347
[SOLVED]Underline character in app hint tips
« on: February 04, 2022, 12:48:11 pm »
I don't suppose it's possible to display an underlined character in a hint tip is it? I know that for a button you place a & in front of the character that you'd hit Alt+character for. It looks like hint tips are just plain text, it'd just be kinda nice to see what the shortcut character was in the hint tip.
« Last Edit: February 04, 2022, 04:24:31 pm by petevick »
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

Zvoni

  • Hero Member
  • *****
  • Posts: 2330
Re: Underline character in app hint tips
« Reply #1 on: February 04, 2022, 01:42:14 pm »
Not sure if i understood you correctly:
Let's say, you have an "A" as the accelerator for a Button "Save", which is displayed as "Save"

And you want the hint tip to show what? "Instead of clicking on the Button you can also hit ALT + A on the Keyboard" with the "A" being "dynamically" inserted?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: Underline character in app hint tips
« Reply #2 on: February 04, 2022, 01:53:36 pm »
Not sure if i understood you correctly:
Let's say, you have an "A" as the accelerator for a Button "Save", which is displayed as "Save"

And you want the hint tip to show what? "Instead of clicking on the Button you can also hit ALT + A on the Keyboard" with the "A" being "dynamically" inserted?
If the hint tip text for a button is say "edit Current field",  and the accelerator is Alt+C, then I'd like the hint tip to display as 'edit Current field'. Basically, can you apply underlining to hint tip text.
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

Zvoni

  • Hero Member
  • *****
  • Posts: 2330
Re: Underline character in app hint tips
« Reply #3 on: February 04, 2022, 02:01:24 pm »
Don't think so.
the character "C" is ASCII 67, independent if it's displayed underlined or not.
The "underline" (as well as Bold, italic) are a property of the TypeFace of the used Font.
It's not part of the CodePoint of the Character

I think there is a way to actually read (from code) which character is the accelerator of a control, since "&" becomes part of the caption/string, it's just not displayed (or better said: get's "translated" to be underlining the following character).
I could guess at something like (not tested)
Code: Pascal  [Select][+][-]
  1. iPos:=Pos('&',Button.Caption);
  2. If iPos>0 Then AccChar:=Button.Caption[iPos+1];
  3.  

EDIT: Of the top of my head coming to mind would be to use a (custom?) implementation of a HTML-capable "DisplayText"-Control (Label, whatever), which gets shown at the correct position, with Text formated with HTML-Tags
« Last Edit: February 04, 2022, 02:06:53 pm by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Underline character in app hint tips
« Reply #4 on: February 04, 2022, 03:47:36 pm »
EDIT: Of the top of my head coming to mind would be to use a (custom?) implementation of a HTML-capable "DisplayText"-Control (Label, whatever), which gets shown at the correct position, with Text formated with HTML-Tags

Lazarus itself uses a THintWindow with a HTML capable control embedded in it for its more complex hints.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Underline character in app hint tips
« Reply #5 on: February 04, 2022, 04:16:49 pm »
Edit C̲urrent Field <== Unicode
Edit Current Field <== HTML

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: Underline character in app hint tips
« Reply #6 on: February 04, 2022, 04:24:02 pm »
Thanks for the replies guys, I really appreciate it.
I'm not going to the trouble of custom implementation, it was just a thought, I would have only done it if it was an easy thing to apply.

Thanks again.
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: [SOLVED]Underline character in app hint tips
« Reply #7 on: February 04, 2022, 04:30:38 pm »
@petevick, just copy this text and try it:
Edit C̲urrent Field

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: [SOLVED]Underline character in app hint tips
« Reply #8 on: February 04, 2022, 04:51:12 pm »
@petevick, just copy this text and try it:
Edit C̲urrent Field
I got all excited  :) it displayed as that in the Hint property field, compiled it, the underline was missing  %)
Nice try but no cigar  ;D
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: [SOLVED]Underline character in app hint tips
« Reply #9 on: February 04, 2022, 05:05:09 pm »
I just saw your signature. I tested it on Windows with Laz 2.2.0. Check the attached image.
« Last Edit: February 04, 2022, 05:06:51 pm by engkin »

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: [SOLVED]Underline character in app hint tips
« Reply #10 on: February 04, 2022, 05:07:58 pm »
I just saw your signature. I tested it on Windows with Laz 2.2.0. Check the attached image.
Ah ok, I'll give it a try in Windows later  ;)
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: [SOLVED]Underline character in app hint tips
« Reply #11 on: February 04, 2022, 05:17:31 pm »
Here is another one to try. It uses Combining Low Line: U+0332:
Edit C̲urrent Field

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: [SOLVED]Underline character in app hint tips
« Reply #12 on: February 04, 2022, 06:24:51 pm »
Here is another one to try. It uses Combining Low Line: U+0332:
Edit C̲urrent Field
Same thing, displayed as that in the Hint property field, compiled it, the underline was missing  %). No cigar again  :(
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: [SOLVED]Underline character in app hint tips
« Reply #13 on: February 04, 2022, 09:13:19 pm »
It seems like your OS doesn't like cigars :D

 

TinyPortal © 2005-2018