Forum > LCL

Questions about the OnShowHint events in TtoolBar and ToolButtons

<< < (2/2)

jamie:
While in the process of doing this I have found that using a

FOR ACONTROL in TOOLBAR Do...

Only finds TToolbutton controls but not any other controls living on the bar

So, I had to do it the old school way to locate the controls when setting their OnShowHint events

 I have speed buttons there also but are not seen using the Enumerator method

dsiders:

--- Quote from: jamie on November 15, 2022, 09:36:17 pm ---While in the process of doing this I have found that using a

FOR ACONTROL in TOOLBAR Do...

Only finds TToolbutton controls but not any other controls living on the bar

So, I had to do it the old school way to locate the controls when setting their OnShowHint events

 I have speed buttons there also but are not seen using the Enumerator method

--- End quote ---

I think TControlBar is the one intended for use with controls.

wp:

--- Quote from: jamie on November 15, 2022, 09:36:17 pm ---While in the process of doing this I have found that using a

FOR ACONTROL in TOOLBAR Do...

Only finds TToolbutton controls but not any other controls living on the bar

--- End quote ---
Iterate yourself over the Controls[ i] of the Toolbar by using a plain old-fashioned "for i" loop:

--- 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";}};} ---procedure TForm1.Button1Click(Sender: TObject);var  s: String = '';  i: Integer;begin  for i := 0 to Toolbar1.ControlCount-1 do    s := s + ';' + Toolbar1.Controls[i].Name;  Delete(s, 1, 1);  ShowMessage(s);end;

Navigation

[0] Message Index

[*] Previous page

Go to full version