Re: Question about showing hints in status bar



On 13 Feb 2006 20:06:20 -0800, "Adam Sandler" <corn29@xxxxxxxxxx>
wrote:

J French wrote:
On 8 Feb 2006 09:40:39 -0800, "Adam Sandler" <corn29@xxxxxxxxxx>
wrote:

You don't need to, just do what DoDi suggested,

I'm confused by your post... I wrote I didn't want to go down the
rewriting the event handler road. You tell me all I need to do is do
what Dodi suggested. He suggested that I rewrite the event handler...

That was one of his suggestions

set and unset Application.OnHint in the Activate / DeActivate event of every Form

I wrote I already did this... In every FormActivate event handler I put
Application.OnHint := doOnHint and in every form's unit I have this

Do you zap Application.OnHint in the Form's DeActivate Event ?

private method:

procedure doOnHint;
begin
StatusBar.Panels[0].Text := Application.Hint;
end;

This doesn't work completely. Let's say form1 is the main form. For
all the things I hover over on form1, their hints go to form1's status
bar. Lets say I click a menu item and it launches form2. Form2 now
has Application.OnHint redirected and all the things I hover over on
form2 go to form2's status bar.

But when I close form2, the Application.OnHint doesn't automatically go
back to form1. form1 and form2 don't (and should not) have any
knowledge of who launched who and who has the redirected
Application.OnHint.

Surely, when you close Form2, another Form fires the Activate Event ?

Again, in Form2 are you zapping the OnHint in the DeActivate Event ?
- maybe as Rob suggested, that Event is not firing, but it needs
checking.

So as soon as I hover over something on form1, an
access violation error occurs (appropriately). Even if I did some
really smelly hardcoding and put in form2.FormDeactivate some call to
form1's Application.OnHint, that doesn't work. With all of this said,
I don't understand what goes in the OnDeactivate event handler?!?!
Well, the DeActivate event should fire as soon as a Form loses
'Application Focus'

Maybe it is something about how you are closing Form2
- is Form2 a designed Form ?
- do you Create it each time ?
- Do you have Form2.Destroy or Form2.Destroy in Unit2 ?

My hunch is that there is a bit more going on ...
- the AV might be a byproduct of something else, that the OnHint is
revealing

.