in reply to Re: Tk Optionmenu - how to set the default selection
in thread Tk Optionmenu - how to set the default selection

Well, there-in lies the solution. Just setting the attribute of -textvariable a second time fixed the issue.

Adding

$platformDropdown -> configure( -textvariable => \$platformChoice );
to the end does the trick.... which pokes the TK engine and says "Hey, set the value to THIS". Even though the variable already contained the right value, I guess TK needs to have some sort of event to know it needs to update. So the corrected code, that now works, looks like:
my %solutionMatrix; my $defaultPlatform = "Mod1"; $solutionMatrix{"Mod1"} = [ 'a','b','c' ]; $solutionMatrix{"Mod2"} = [ 'q' ]; my $platformDropdown = $selectionFrame -> Optionmenu ( -textvariab +le => \$platformChoice, -indicatoron => 1 ) -> pack( -side => "left") +; # --- now populate the options in the platform and customer dr +opdown list, # which is in the hash of arrays, %solutionMatrix foreach my $platform ( sort keys %solutionMatrix ) { # $platform is a choice for the platform dropdown # @{$solutionMatrix{$platform} is an array of solutions fo +r the customer dropdown $platformDropdown -> addOptions([$platform=>$platform]); } $platformChoice = $defaultPlatform; # set default $platformDropdown -> configure( -textvariable => \$platformCho +ice );