Marynella,
Once you add a checkbox, you can use the Show() and Hide() methods to... well, hide and show it. Here is some sample code to demonstrate:
use strict;
use Win32::GUI;
my $Window = new Win32::GUI::Window(
-name => "Window",
-left => 100,
-top => 100,
-width => 150,
-height => 150,
-title => "checkbox test",
);
$Window->AddCheckbox(
-name => 'mycheckbox',
-left => 10,
-top => 10,
-height => 15,
-width => 15,
);
$Window->AddButton(
-text => 'Hide checkbox',
-left => 10,
-top => 35,
-height => 30,
-width => 100,
-name => 'btnHide',
);
$Window->AddButton(
-text => 'Show checkbox',
-left => 10,
-top => 75,
-height => 30,
-width => 100,
-name => 'btnShow',
);
$Window->Show();
Win32::GUI::Dialog();
sub Window_Terminate {
return -1;
}
sub btnShow_Click {
$Window->mycheckbox->Show();
}
sub btnHide_Click {
$Window->mycheckbox->Hide();
}
Update:
If you really want to *remove* a checkbox or combobox, something like this might work:
Win32::GUI::DestroyWindow($Window->{mycheckbox}{-handle});
delete $Window->{mycheckbox}; #use hashref syntax instead of autoload
+ed methods
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.