Board index » cppbuilder » ShowHint: Hints only on the main form?

ShowHint: Hints only on the main form?

hi,
I have in a main form a statusbar1 (ParentShowHint and ShowHint = true),
and in a second form a statusbar2 (ShowHint=true). The helpcontext from
the button on the second form is shown in the statusbar1, not in
statusbar2. What must I do to show this in statusbar2?

thanks, Mustafa Sami Cebi

 

Re:ShowHint: Hints only on the main form?


Hello Mustafa

while your second form is active you must the Application->OnHint-method
redirect to your second form. See the following example.

1. Make a pointer to save the old OnHint-method
======================================
class TFormTest: public TForm
{
__published:
.....
private:
 TNotifyEvent OnHintOld;
public:

Quote
};

2. By opening the window save the old OnHint-method and set the new
OnHint-method
============================================
void __fastcall TFormTest::FormShow(TObject *Sender)
{
    OnHintOld = Application->OnHint;    // save old method
    Application->OnHint = ShowHint;    // set new method

Quote
}

3. By closing the window set back the old OnHint-method
============================================
void __fastcall TFormTest::FormClose(TObject *Sender, TCloseAction &Action)
{
 Application->OnHint = OnHintOld;    // reset old method

Quote
}

4. On the ShowHint()-method in your second form assign the help text to your
second statusbar
void __fastcall TFormTest::ShowHint(TObject *Sender)
{
 StatusBar1->SimpleText = Application->Hint;

Quote
}

I hope it's a help for you
Josef Halder
rhal...@w-4.de

----------------------------------------------------------------------------
-------------
Mustafa Cebi schrieb in Nachricht <3765046C.455D...@weilberg.de>...

Quote
>hi,
>I have in a main form a statusbar1 (ParentShowHint and ShowHint = true),
>and in a second form a statusbar2 (ShowHint=true). The helpcontext from
>the button on the second form is shown in the statusbar1, not in
>statusbar2. What must I do to show this in statusbar2?

>thanks, Mustafa Sami Cebi

Re:ShowHint: Hints only on the main form?


: Mustafa Cebi <plan...@weilberg.de> wrote:

Quote
>The helpcontext from
>the button on the second form is shown in the statusbar1, not in
>statusbar2. What must I do to show this in statusbar2?

Hook the Application->OnHint event and grab the text to dispay from there.

Mustafa, this here isn't really where the people who know about your
problem hang out, so a much better place for your question probably is the
group

  news:borland.public.cppbuilder.vcl

To learn more about this server and the group that it carries, have a look
at http://www.borland.com/newsgroups/

Thanks!

--
Stefan Hoffmeister (TeamB)     http://www.econos.de/
Please do apply judgement when sending email.

Other Threads