Forum > Designer

how to show hints NOT also at child elements

(1/4) > >>

Muso:
I have TGroupBox which contains a TRadioGroup. The TGroupBox has a hint and the hint should be shown. However, when the user is with the mouse over the TRadioGroup, no hint should be shown. How can I achieve this?

I am asking because whatever settings I tried, the hint of the TGroupBox also appears for the TRadioGroup.

Attached is a small demo program showing the issue.

Bart:
Set RadioGroup's ParentShowHint to False?

Bart

lucamar:

--- Quote from: Bart on July 22, 2021, 12:03:54 am ---Set RadioGroup's ParentShowHint to False?
--- End quote ---

That won't work. Logically enough, since it only means that ShowHint is set to the same value the parent has. The only way to prevent the RadioGroup (or any other child) from showing the parent's hint is to set a Hint of its own for it and set its ShowHint to True.

Of course, then it will show this hint but that's better than showing the parent's, which doesn't apply to this control.

One would think that setting both ParentShowHint and ShowHint to False would work too (and display nothing), but it doesn't: in that case the parent is interrogated and, if all is set its Hint will be shown.

GetMem:
@Muso

--- Quote ---However, when the user is with the mouse over the TRadioGroup, no hint should be shown. How can I achieve this?
--- End quote ---
Set property ShowHint for the RadioGroup to True,  then:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- TForm1 = class(TForm)  //..    procedure FormCreate(Sender: TObject); private   procedure OnShowHint(var HintStr: string; var CanShow: Boolean; var HintInfo: THintInfo); public  end;          procedure TForm1.FormCreate(Sender: TObject);begin  Application.OnShowHint := @OnShowHint;end; procedure TForm1.OnShowHint(var HintStr: string; var CanShow: Boolean;  var HintInfo: THintInfo);begin  CanShow := not ((HintInfo.HintControl is TRadioButton) or (HintInfo.HintControl is TRadioGroup));end;  
If you have multiple RadioGroups, the above method will silence them all, but then you can play with the Tag property to enable/disable hint for a particular RadioGroup.

Bart:

--- Quote from: lucamar on July 22, 2021, 12:35:33 am ---One would think that setting both ParentShowHint and ShowHint to False would work too (and display nothing), but it doesn't:

--- End quote ---

That was what I imagined as well.
I just checked D7, and it behaves the same.

Bart

Navigation

[0] Message Index

[#] Next page

Go to full version