It would be convenient to declare a groupbox and then identify the groupbox as the parent control for other controls to facilitate positioning and operations on the entire group (I think this would also be useful for tabstrips, per the question the other day). The example below shows how moving the groupbox also moves the child controls on resizing the main window. However, I've noticed a couple of problems:
* The syntax for accessing the child controls is subtly different. For instance, instead of $obMW->txParent you must use $obMW->gp->{txChild}; * Tabstops don't seem to work for the child controls; * Disabling the group disables the child controls, but there is no visual feedback (i.e. they don't get greyed out). The first point isn't major, but I wonder if the second two aren't related to it. Are these bugs, unimplemented features or do I misunderstand something? Glenn M. #!perl -w use strict; use Win32::GUI; my $obMW; $obMW = Win32::GUI::Window->new( -title => "Hierarchical Controls", -pos => [ 100, 100 ], -size => [ 240, 150 ], -minsize => [ 240, 150 ], -dialogui => 1, -onResize => sub { $obMW->gp->Move(0, $obMW->Height-90); 1 }, ); $obMW->AddButton( -name => "btParent", -text => "Button 1", -size => [ 70, 22 ], -pos => [ 20, 20 ], -tabstop => 1, -onClick => sub { $obMW->txParent->Text("Button 1"); $obMW->gp->{txChild}->Text("Button 1"); $obMW->gp->Enable($obMW->gp->IsEnabled ? 0 : 1); 1; }, ); $obMW->AddTextfield( -name => "txParent", -text => "Textfield 1", -size => [ 100, 22 ], -pos => [ 100, 22 ], -tabstop => 1, ); $obMW->AddGroupbox( -name => "gp", -size => [ ($obMW->GetClientRect)[2]-10, 52 ], -pos => [ 0, 60 ], ); $obMW->AddButton( -name => "btChild", -parent => $obMW->gp, -text => "Button 2", -size => [ 70, 22 ], -pos => [ 20, 15 ], -tabstop => 1, -onClick => sub { $obMW->txParent->Text("Button 2"); $obMW->gp->{txChild}->Text("Button 2"); $obMW->txParent->Enable($obMW->txParent->IsEnabled ? 0 : 1); $obMW->btParent->Enable($obMW->btParent->IsEnabled ? 0 : 1); 1; }, ); $obMW->AddTextfield( -name => "txChild", -parent => $obMW->gp, -text => "Textfield 2", -size => [ 100, 22 ], -pos => [ 100, 15 ], -tabstop => 1, ); $obMW->Show(); Win32::GUI::Dialog(); undef $obMW;