Selva,

How exactly is this other window with toolbar created? Is it from a completely separate script or from a module that your script loads? Is it created using Win32::GUI in Perl? Could you provide a small example of your problem?

Sorry for the confusion.

Kevin.
Kevin.
Thanks for the update. The one you have referred will get the tool bar button count for which you create the window and add content to that window and you are getting the same. But I look for the situation, where I have to get the Toolbar button count on existing window which I will not create on run time. I am looking some solution on the same . Any further thoughts from you is very much helpful.
Thx in advance and I  hope that I have clarified my requirement.
Selva D

--- On *Mon, 10/5/10, Kevin Marshall /<kejoh...@hotmail.com>/* wrote:


    From: Kevin Marshall <kejoh...@hotmail.com>
    Subject: RE: [perl-win32-gui-users] Is it possible to work on
    toolbar controls with win32::GUI
    To: ganapathy_se...@yahoo.com
    Cc: "Perl-Win32-GUI-Users List"
    <perl-win32-gui-users@lists.sourceforge.net>
    Date: Monday, 10 May, 2010, 7:44 AM

    Selva,

    You can use the ButtonCount() method to retrieve the number of
    buttons in the toolbar and the GetButtonText() method to retrieve
    the text of the specified button. Here is some sample code:

    #!perl
    use strict;
    use warnings;

    use Data::Dump qw(dump);
    use Win32::GUI qw();
    use Win32::GUI::Constants qw(TBSTATE_ENABLED BTNS_SHOWTEXT
    IDB_STD_SMALL_COLOR CW_USEDEFAULT);

    my $win = Win32::GUI::Window->new(
        -name => 'win',
        -text => 'Toolbar Sample',
        -size => [320,240],
        -left => CW_USEDEFAULT,
    );

    $win->AddToolbar(
        -name => 'toolbar',
        -adjustable => 1,
        -flat => 1,
        -multiline => 1,
        -nodivider => 1,
    );
    my @buttons = (qw(Cut Copy Paste Undo Redo Delete New Open Save
    Preview
        Properties Help Find Replace Print));
    $win->toolbar->LoadImages(IDB_STD_SMALL_COLOR);
    $win->toolbar->AddString($_) foreach @buttons;
    $win->toolbar->AddButtons(
        scalar @buttons,
        map {($_,$_+1,TBSTATE_ENABLED,BTNS_SHOWTEXT,$_)} 0..$#buttons
    );

    $win->Show();

    Win32::GUI::Dialog();

    sub win_Resize {
        $win->toolbar->Width($win->Width());
        return 1;
    }

    sub toolbar_ButtonClick {
        my($index,$dropdown) = @_;
        printf "Button %02d of %02d text => %s\n", $index,
            $win->toolbar->ButtonCount(),
    $win->toolbar->GetButtonText($index);
        return 1;
    }
    __END__

    Hope this helps,

    Kevin.

    > Date: Tue, 4 May 2010 05:38:04 -0700
    > From: ganapathy_se...@yahoo.com
    > To: perl-win32-gui-users@lists.sourceforge.net
    > Subject: [perl-win32-gui-users] Is it possible to work on
    toolbar controls with win32::GUI
    >
    > Hi,
    > I exhaustively looked at win32::GUI and please clarify on the same.
    > I just want to get the toolbar item- count and also the text of
    the items in toolbar. I saw win32::GUI was creating an window and
    doing adding some control for the same.
    > Is there any way to test the toolbar controls for the existing
    toolbar by passing the window handler.
    >
    > I also tried with win32::GUItest..but not succeeded.(by using
    sendmessage ) Please any clue on this?
    >
    > Thanks
    > Selva D
    >
    >
    >
    >
    >
    >
    
------------------------------------------------------------------------------
    > _______________________________________________
    > Perl-Win32-GUI-Users mailing list
    > Perl-Win32-GUI-Users@lists.sourceforge.net
    > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
    > http://perl-win32-gui.sourceforge.net/

    ------------------------------------------------------------------------
    Looking for a hot date? View photos of singles in your area!
    <http://clk.atdmt.com/NMN/go/150855801/direct/01/>



------------------------------------------------------------------------------

_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to