On 15 January 2013 at 08:30 Dave Hayes <d...@jetcafe.org> wrote:

> 2) I have added a help button to my dialogs. I'd like a separate help
> window to pop up with a close button, which is independent of the actual
> dialog window it's attached to.
>
Use

wxHF_DIALOG|wxHF_MODAL|

like this:

################################### Start of set up help
###############################

    # very important for HTB to work
    Wx::FileSystem::AddHandler( new Wx::ZipFSHandler );

# Set up both type of help.

    $i_Main_Menu->{html_help} = Wx::HtmlHelpController->new
                             (
wxHF_MERGE_BOOKS|wxHF_CONTENTS|wxHF_INDEX|wxHF_SEARCH|wxHF_MERGE_BOOKS|wxHF_DIALOG|wxHF_MODAL|wxHF_DIALOG|wxHF_MODAL|wxHF_FLATTOOLBAR|wxHF_BOOKMARKS
);
################################### End of set up help
#################################


Then your button looks like this:

    $i_Main_Menu->{Ctl_User_Help_Btn} =
Wx::Button->new($i_Main_Menu->{Ctl_Main_Menu_Panel_1}, wxID_ANY, __t("&Help"));

   
$i_Main_Menu->{Ctl_Main_Menu_Grid_Sizer_4}->Add($i_Main_Menu->{Ctl_User_Help_Btn},
0, 0, 5);
    Wx::Event::EVT_BUTTON( $i_Main_Menu, __attribute_exists($i_Main_Menu,
"Ctl_User_Help_Btn"), \&on_user_help );

Then the event handler looks like this:

sub on_user_help {
    my( $self, $event ) = @_;

    my $help_file =
$gl_installation_path.'/help/'.$gl_language_country.'/iMage_help.htb';
    $self->{html_help}->AddBook( $help_file, 1 );
    $self->{html_help}->Display(__t("Main Menu"));

}

Regards

Steve.



> I'm real unclear as to how to do this.
>
> If I make the new help window a child of the dialog, and call Show() on
> it, the close button does not work. If I call ShowModal() then the help
> window blocks any action in the dialog.
>
> So if I then make the new help window childless (undef as the parent, as
> I understand) it seems to work in reverse. The close button in the
> dialog will not work until I close the dialog.
>
> How do I instantiate an independent window?
>
> Thanks in advance for any answers provided. :)
> --
> Dave Hayes - Consultant - Altadena CA, USA - d...@jetcafe.org
> >>>> *The opinions expressed above are entirely my own* <<<<
>
> "He was angry with me, he attacked me, he defeated me, he
> robbed me" Those who dwell on such thoughts will never be
> free from hatred. Those who do not dwell on such thoughts
> will surely become free from hatred.

Reply via email to