logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Getting the Index of a Widget in a Sizer: msg#00047

Subject: Re: Getting the Index of a Widget in a Sizer
--- Ed Heil <ed@xxxxxxxxxxxxx> wrote:

> I've just beat my brain against the wxwidgets docs trying to figure out
> how to ask a sizer at what index it is holding a given control.
> 
> I finally ended up trying to hack together my own method for doing it. 
> There *are* methods to get the Wx::SizerItem associated with an index,
> and to get the Wx::SizerItem associated with a widget.  I figured I
> could loop through indices until it nulled out or the two SizerItems are
> the same.  No dice -- had some problems with the fact that I need to use
> the overloaded GetItem method in two different ways...
> 
> package Wx::Sizer;
> 
> sub GetIndexOfWindow {
>    my $self=shift;
>    my $window=shift;
>    my $sizeritem = $self->GetItem($window);
>    my $indexitem;
>    my $index=0;
>    while($indexitem = $self->GetItem($index)) {
>       if ($sizeritem == $indexitem) {
>          return $index;
>       }
>    }
>    return undef;
> }
> 
> Relevant error:
> 
> unable to resolve overloaded method for Wx::Sizer::GetItem at
> DWx/Goodies.pm line 54

What's line 54? 
What arguments are you passing to GetItem?

If you

   print $self->GetItem(0),$/;
   print $self->GetItem(0),$/;

you'll see something like

   Wx::SizerItem=SCALAR(0x2217224)
   Wx::SizerItem=SCALAR(0x2217248)

So $sizeritem == $indexitem will always be false.
Mattia will know how to fix that



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


<Prev in Thread] Current Thread [Next in Thread>