We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

How to display multiple THintwindows and them remove the from the screen. for example when hit a button.

erwingosepa
erwingosepa asked
on
Medium Priority
530 Views
Last Modified: 2012-08-13
Could some body help with some code for display multiple THintwindows and them remove the from the screen.

this is for creation of the Hintwindow

 for i := 0 to 8 do begin
  with THintwindow.create(self) do
  Begin
    Left := 0;
    Top := 10;
    Text := 'Help me No 1';
    Show;
   end;
   end;
 end;


this is for remove of the Hintwindow

 for i := 0 to 8 do begin
   THintwindow.ReleaseHandle;
 end

it will remove only one. I want it to remove all.


Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2006

Commented:
Is this like Delphi code or something. Apologies if Im talking crap. Just trying to help by making educated guesses.

Not really a Delphi expert, but looking at your code

does the first loop create 9 windows?
if so, does THintwindow.create return a value, this value representing the handle of the window? Are these handle values different or same?

reason why I say this is because your close loop just specifies releasing something but not sure what. Is it supposed to delete all open windows

If create returns different handle values then perhaps you need to capture all the window handles created by the create call
wow, you're doing it in a very wrong way!

you are creating hint windows without keeping the info about any
of it, and with "THintwindow.ReleaseHandle" you actually destroy
the last created window, because of the luck.

here is a proper way to go with:

// make this a global variable

var
  HintWnd :array[0..8] of THintwindow;
...
begin
  for i := Low(HintWnd) to High(HintWnd) do begin
  // same as:  "for i := 0 to 8 do begin" but better if you change the limits later
      HintWnd[i] := THintWindow.Create(nil);
      with HintWnd[i] do
      Begin
          Left := 0;
          Top := 10;
          Text := 'Help me No 1';
          Show;
      End;
   end; // for loop

...

  for i := Low(HintWnd) to High(HintWnd) do begin
     HintWnd[i].ReleaseHandle;
...

end


 end;



Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
nepostojeci the only thing missing is that the Hintwindows are not showing on the screen.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.