Since some time now my hint texts won't show in my application. I have had
this problem before and it seemed to be solved by changing the hintpause
time or color... At this moment this fix does not work anymore. I have
checked all hint related issues and are all set to what I think should be
needed. Even a new button on the Form with hinttext added, ShowHint :=
TRUE won't work..
any ideas...someone?
kind regards,
Dick
--- posted by geoForum on http://delphi.newswhat.com
Which Delphi version?
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Try this:
Define a new hint window class
Type
TMyHintWindow = class( THintWindow )
pubic
Procedure CreateParams( var params: TCreateParams ); override;
end;
procedure TMyHintWindow.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
params.wndParent := GetActiveWindow;
end;
In your main forms OnCreate event you do this:
HintWindowClass := TMyHintWindow;
Test whether that solves the problem on your machine.
If it does not try to make the hint window topmost:
procedure TMyHintWindow.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
params.ExStyle := params.ExStyle OR WS_EX_TOPMOST;
end;
I have tried all kinds of combinations of your suggestion, in vain I'm
afraid..
Also I tested to enable and disable the hints in other projects as below :
procedure Txxx.FormCreate(Sender: TObject);
begin
with Application do
begin
ShowHint := TRUE;
ParentShowHint := FALSE; //or TRUE;
HintPause := 100; // or 500 as default
HintHidePause := 5000; // or 2500 as default
HintColor := clAqua; // or not defined as default
end;
end;
Everything works fine there. Then I tried this again in the problem
project. Alas..
Also I have :
- delete the .res file
- rebuild every time I changed something
- tried to run the application not from the Delphi IDE
- tried to run the application on another PC
- tried to, with your suggestion, a new button on the form
- checked all 'suspicious' hint related assignments and disabled them
A collegue of mine thought he remembered something he read about the
registry?? So, we looked, but could not find anything that could be linked
to this problem.
The registry has nothing to do with hint processing. It looks like your
problem is not that the hint window is covered by the form it is supposed to
appear above, but the hint seems not to trigger.
If you attach a handler to the Application.OnHint event in this application,
does it ever fire? If not something in your application is blocking the
standard idle processing done in Application.Idle.
Do you have a handler for the Application.OnIdle event in this project?
Or perhaps a second message loop that effectively replaces the one in
Application.Run for the duration of your apps life?
Is this perhaps a DLL project used by a non-Delphi host app, or an
ActiveForm project?
Do you have any message handlers for the CM_HINTSHOW message around?
Data please! <g>
>If you attach a handler to the Application.OnHint event in this application,
>does it ever fire?
Yes. We placed a TApplicationEvents component on one of the forms, and
added a writeln('bjg') in the procedure. Works as expected, moving the
mouse shows the 'bjg' on the terminal.
>If not something in your application is blocking the
>standard idle processing done in Application.Idle.
Searched the files for Idle, nothing there.
>Do you have a handler for the Application.OnIdle event in this project?
No.
>Or perhaps a second message loop that effectively replaces the one in
>Application.Run for the duration of your apps life?
No.
>Is this perhaps a DLL project used by a non-Delphi host app,
No.
> or an ActiveForm project?
No.
>Do you have any message handlers for the CM_HINTSHOW message around?
No.
Futhermore we tested by moving the forms from runtime creation to compile
time creation, this helped. Moving the from 'auto-create' to available
solved it. This is not usable ofcourse at this moment, since I need the
forms. It is perhaps something to bare in mind for future projects.
Could this be a resource problem of some kind? Just something I heard.. In
Dutch we have got a saying for this kind of remarks. The closest I found
is : "he has heard something about it, but he does not know the rights of
it'....
Thanks again, regards,
Certainly, especially if you run on Win9x. Less likely on NT plaforms, though.
If you can reproduce the problem reliably when running the app under the IDE
debugger you have a chance to debug this. Place a breakpoint into your OnHint
handler. When it triggers open the Forms unit and find the
TApplication.ActivateHint function. Find the statement
if CanShow and Assigned(FOnShowHint) then
FOnShowHint(HintInfo.HintStr, CanShow, HintInfo);
in it and place a breakpoint on the next statement. Run to it, then single-step
from there.
When single stepping, I am not even getting to this.
> if CanShow and Assigned(FOnShowHint) then
> FOnShowHint(HintInfo.HintStr, CanShow, HintInfo);
The result of :
if FShowHint and (FHintControl <> nil) and ForegroundTask and
(FHintControl = GetHintControl(FindDragTarget(CursorPos, True))) then
is FALSE already.
The FShowHint and ForeGroundTask are TRUE. Since I could not check if what
ForeGroundTask was (inaccessible value in the watch window), I put it in a
writeln in the actual onHint handler. I am not sure this is the same however..
I also tried to edit Forms, 'Use Debug DCU's' _is_ checked, but did not
succeed. The reason was to find out if FHintControl is really FALSE.
I have tried this in another project too. The results are the same, the
part after 'if ShowHint' is not executed.
I haven't got a clue where I am looking for right now.
<Sigh>. This is probably one of the cases that are hard to impossible to trace
correctly in the debugger since stopping the app on a breakpoint changes the
timings and the environment the code executes in.
> I haven't got a clue where I am looking for right now.
Unfortunately neither have I.
I am planning to change the way the forms are made, since it seems form
related. For future projects anyway, and perhaps for the current one also.
This project is rather 'old' and not everything is made by myself, so it
will probably take more time to change it all. But, I am not sure I want
to put the effort in it..
>> I haven't got a clue where I am looking for right now.
>
>Unfortunately neither have I.
Hm, this dramatically reduces the chances that I will..
Last week I ran the app on another machine, and guess what? Hints were
there! At least for some time... Opening additional windows changed this.
Trying again and again did not help anymore.. I will test this again after
a restart.
Anyway, thanks for the help. If I find the solution I will surely post it.
If you get a 'eureka!' some time, could you please send me an e-mail?
kind regards,