Loading ...
Sorry, an error occurred while loading the content.

Listbox functions

Expand Messages
  • xGunneRx <xgunnerx@yahoo.com>
    Can anyone show me a good source example of GetListText() when using it on a listbox? I ve tried to get list text without much sucess. :( TIA! xGunneRx
    Message 1 of 6 , Dec 13, 2002
    • 0 Attachment
      Can anyone show me a good source example of GetListText() when using
      it on a listbox? I've tried to get list text without much sucess. :(

      TIA!
      xGunneRx
    • Ernesto Guisado <erngui@acm.org>
      Hi, ... using ... 1) I just opened a application I know contains a listbox (I used WinAT). 2) Run spy--.pl (in win32-guitest eg) and it shows the listbox
      Message 2 of 6 , Dec 15, 2002
      • 0 Attachment
        Hi,

        --- In perlguitest@yahoogroups.com, "xGunneRx <xgunnerx@y...>"
        <xgunnerx@y...> wrote:
        > Can anyone show me a good source example of GetListText() when
        using
        > it on a listbox? I've tried to get list text without much sucess. :(

        1) I just opened a application I know contains a listbox (I used
        WinAT).
        2) Run spy--.pl (in win32-guitest\eg) and it shows the listbox
        information:
        <snip>
        +0x000107A0, 'Command Scheduler', WINAT
        ++0x000107A2, '&Remove', Button
        ++0x000107A4, '', ListBox
        ++0x000107A6, '&Add...', Button
        ++0x000107A8, '&Change...', Button
        </snip>
        3) Use Win32::GuiTest to print the content of the first item in the
        list:

        perl -e "use Win32::GuiTest; print Win32::GuiTest::GetListText
        (0x000107A4, 0);"

        4) Alternativelly you can use GetListContents(0x000107A4) to get all
        the items in the list.

        Seems to work.

        My guess is your control looks like a built-in listbox, but really
        isn't. Perhaps some Java thingy or some cross-platform GUI. Spy--.pl
        should tell you what it isn't (check if the class name is "ListBox").

        To help you here's a version of spy.pl that shows contents of
        listboxes as "<item1|item2!...>":

        use Win32::GuiTest qw/FindWindowLike GetWindowText GetClassName
        GetChildDepth GetDesktopWindow GetListContents/;

        for (FindWindowLike()) {
        $s = sprintf("0x%08X", $_ );
        $s .= ", '" . GetWindowText($_) . "', " . GetClassName($_);
        $depth = GetChildDepth(GetDesktopWindow(), $_);
        print "+" x $depth, $s, "\n";
        if (GetClassName($_) eq "ListBox") {
        print "+" x ($depth+1), "<", join("|", GetListContents
        ($_)), ">\n";
        }
        }


        HTH,
        Ernesto.
        -- Ernesto Guisado <mailto:erngui@...>, <http://triumvir.org>
      • xGunneRx <xgunnerx@yahoo.com>
        ... Ok that seems to work. However, if I do something like pass a variable into the function it seems to blow up: #!/usr/bin/perl -w use strict; use
        Message 3 of 6 , Dec 16, 2002
        • 0 Attachment
          > 3) Use Win32::GuiTest to print the content of the first item in the
          > list:
          >
          > perl -e "use Win32::GuiTest; print Win32::GuiTest::GetListText
          > (0x000107A4, 0);"

          Ok that seems to work. However, if I do something like pass a
          variable into the function it seems to blow up:
          <snip>
          #!/usr/bin/perl -w
          use strict;
          use Win32::GuiTest qw(:ALL);

          my $check = '0x00350096';

          my $w = GetListText($check, 0);
          print "$w\n";
          </snip>

          This prints "uiTest" which is not in the list. Seems to do this for
          any listbox I define in $check. Im using the latest non-beta version.

          Thanks!
          xGunneRx
        • xGunneRx <xgunnerx@yahoo.com>
          lol nm i figured it out- my $check = int(0x00350096); ... the ... version.
          Message 4 of 6 , Dec 16, 2002
          • 0 Attachment
            lol nm i figured it out-> my $check = int(0x00350096);



            --- In perlguitest@yahoogroups.com, "xGunneRx <xgunnerx@y...>"
            <xgunnerx@y...> wrote:
            > > 3) Use Win32::GuiTest to print the content of the first item in
            the
            > > list:
            > >
            > > perl -e "use Win32::GuiTest; print Win32::GuiTest::GetListText
            > > (0x000107A4, 0);"
            >
            > Ok that seems to work. However, if I do something like pass a
            > variable into the function it seems to blow up:
            > <snip>
            > #!/usr/bin/perl -w
            > use strict;
            > use Win32::GuiTest qw(:ALL);
            >
            > my $check = '0x00350096';
            >
            > my $w = GetListText($check, 0);
            > print "$w\n";
            > </snip>
            >
            > This prints "uiTest" which is not in the list. Seems to do this for
            > any listbox I define in $check. Im using the latest non-beta
            version.
            >
            > Thanks!
            > xGunneRx
          • xGunneRx <xgunnerx@yahoo.com>
            The below works... however: my $self = shift; my $check = $self- {Org_ListBoxID}; # check contains the listbox id $check = int($check); $word =
            Message 5 of 6 , Dec 16, 2002
            • 0 Attachment
              The below works... however:

              <snip>
              my $self = shift;
              my $check = $self->{Org_ListBoxID}; # check contains the listbox id
              $check = int($check);
              $word = GetListText($check, 0);
              print $word . "\n";
              </snip>

              Prints garble. What am I doing wrong?

              --- In perlguitest@yahoogroups.com, "xGunneRx <xgunnerx@y...>"
              <xgunnerx@y...> wrote:
              > lol nm i figured it out-> my $check = int(0x00350096);
              >
              >
              >
              > --- In perlguitest@yahoogroups.com, "xGunneRx <xgunnerx@y...>"
              > <xgunnerx@y...> wrote:
              > > > 3) Use Win32::GuiTest to print the content of the first item in
              > the
              > > > list:
              > > >
              > > > perl -e "use Win32::GuiTest; print Win32::GuiTest::GetListText
              > > > (0x000107A4, 0);"
              > >
              > > Ok that seems to work. However, if I do something like pass a
              > > variable into the function it seems to blow up:
              > > <snip>
              > > #!/usr/bin/perl -w
              > > use strict;
              > > use Win32::GuiTest qw(:ALL);
              > >
              > > my $check = '0x00350096';
              > >
              > > my $w = GetListText($check, 0);
              > > print "$w\n";
              > > </snip>
              > >
              > > This prints "uiTest" which is not in the list. Seems to do this
              for
              > > any listbox I define in $check. Im using the latest non-beta
              > version.
              > >
              > > Thanks!
              > > xGunneRx
            • Dennis K. Paulsen <ctrondlp@netins.net>
              GetListText s first parameter needs to be the handle to the list box not the control id. The handle of the control can be obtained through FindWindowLike by
              Message 6 of 6 , Dec 17, 2002
              • 0 Attachment
                GetListText's first parameter needs to be the handle to the list box
                not the control id. The handle of the control can be obtained
                through FindWindowLike by specifying its fourth parameter.

                Regards,
                Dennis K. Paulsen

                --- In perlguitest@yahoogroups.com, "xGunneRx <xgunnerx@y...>"
                <xgunnerx@y...> wrote:
                > The below works... however:
                >
                > <snip>
                > my $self = shift;
                > my $check = $self->{Org_ListBoxID}; # check contains the listbox id
                > $check = int($check);
                > $word = GetListText($check, 0);
                > print $word . "\n";
                > </snip>
                >
                > Prints garble. What am I doing wrong?
                >
                > --- In perlguitest@yahoogroups.com, "xGunneRx <xgunnerx@y...>"
                > <xgunnerx@y...> wrote:
                > > lol nm i figured it out-> my $check = int(0x00350096);
                > >
                > >
                > >
                > > --- In perlguitest@yahoogroups.com, "xGunneRx <xgunnerx@y...>"
                > > <xgunnerx@y...> wrote:
                > > > > 3) Use Win32::GuiTest to print the content of the first item
                in
                > > the
                > > > > list:
                > > > >
                > > > > perl -e "use Win32::GuiTest; print Win32::GuiTest::GetListText
                > > > > (0x000107A4, 0);"
                > > >
                > > > Ok that seems to work. However, if I do something like pass a
                > > > variable into the function it seems to blow up:
                > > > <snip>
                > > > #!/usr/bin/perl -w
                > > > use strict;
                > > > use Win32::GuiTest qw(:ALL);
                > > >
                > > > my $check = '0x00350096';
                > > >
                > > > my $w = GetListText($check, 0);
                > > > print "$w\n";
                > > > </snip>
                > > >
                > > > This prints "uiTest" which is not in the list. Seems to do this
                > for
                > > > any listbox I define in $check. Im using the latest non-beta
                > > version.
                > > >
                > > > Thanks!
                > > > xGunneRx
              Your message has been successfully submitted and would be delivered to recipients shortly.