• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

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

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.


0
erwingosepa
Asked:
erwingosepa
1 Solution
 
rockiroadsCommented:
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
0
 
nepostojeci_emailCommented:
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;



0
 
erwingosepaAuthor Commented:
nepostojeci the only thing missing is that the Hintwindows are not showing on the screen.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now