OK...forgive this dumb question... In C++ and Java, I've been accustomed to using the "this" qualifier to specify my objects. How would this happen in Perl? The code in question:
$accountName = ""; $count = 0; $top = 5; $left = 15; foreach my $row (1..222){ foreach my $col (1..5){ if ($col eq 1 && $accountName !~ $Sheet->Cells($row,$col)->{'V +alue'}){ $accountName = $Sheet->Cells($row,$col)->{'Value'}; $accounts[$count] = $accountName; if ($count eq 9 || $count eq 18) { $left += 150; $top = 5; } $labels[$count] = $main->AddLabel( -text => $accountName, -top => $top, -left => $left ); $top += 15; $comboboxes[$count] = $main->AddCombobox( -name => $accountName."ComboBox", -top => $top, -left => $left, -width => 125, -height => 150, -tabstop => 1, -style => WS_VISIBLE | 3 | WS_VSCROLL ); $count++; $top += 25; } else { if ($col eq 2){ $value = $Sheet->Cells($row,$col)->{'Value'}; $comboboxes[$count-1]->InsertItem($value); } } } } $Book->Close; sub ComboBox{ #Help here - this.$selection = GetString(SelectedItem); ??? } foreach my $x (0..$count){ $SUB = $accounts[$x]."ComboBox_Change"; *$SUB = \&ComboBox; }
Yes, it's been cleaned a bit and optimized since my last post... thanks guys. My problem is in the "ComboBox" function, I want to do a getstring on whichever combobox made the call... Thanks again. Josh Pavel

In reply to "this" variable? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.