I have a problem with tabstops when using Win32::GUI::TabFrame. Tabbing does not work as expected and I'm sure it is my fault but I can't figure it out.
Problem #1 is that back-tabbing (shift+tab) sets the focus on the tab label itself.
Problem #2 is that I cannot tab off the tab label.
Here is a small test script that will reproduce the issues:
#!c:\perl\bin\wperl.exe use strict; use Win32::GUI; use Win32::GUI::TabFrame; my $mainform; $mainform = Win32::GUI::Window->new(-name=>'main',-text=>'tabframe tes +t',-width=>800,-height=>600,-dialogui=>1); $mainform->AddTabFrame(-name=>"tab",-panel=>"Page",-width=>770,-height +=>550,-left=>10,-top=>10,-addstyle=>WS_TABSTOP); $mainform->tab->InsertItem(-text=>" Tab1 ",-border=>0,top=>10,-addstyl +e=>WS_TABSTOP); $mainform->tab->Page0->AddTextfield(-name=>'tab0_text1', -text=>'tab0_ +text1', -left=>200, -top=>10, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->Page0->AddTextfield(-name=>'tab0_text2', -text=>'tab0_ +text2', -left=>200, -top=>40, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->Page0->AddTextfield(-name=>'tab0_text3', -text=>'tab0_ +text3', -left=>200, -top=>70, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->InsertItem(-text=>" Tab2 ",-border=>0,top=>10,-addstyl +e=>WS_TABSTOP); $mainform->tab->Page1->AddTextfield(-name=>'tab1_text1', -text=>'tab1_ +text1', -left=>200, -top=>10, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->Page1->AddTextfield(-name=>'tab1_text2', -text=>'tab1_ +text2', -left=>200, -top=>40, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->Page1->AddTextfield(-name=>'tab1_text3', -text=>'tab1_ +text3', -left=>200, -top=>70, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->InsertItem(-text=>" Tab3 ",-border=>0,top=>10,-addstyl +e=>WS_TABSTOP); $mainform->tab->Page2->AddTextfield(-name=>'tab2_text1', -text=>'tab2_ +text1', -left=>200, -top=>10, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->Page2->AddTextfield(-name=>'tab2_text2', -text=>'tab2_ +text2', -left=>200, -top=>40, -height=>24, -width=>80,-tabstop=>1); $mainform->tab->Page2->AddTextfield(-name=>'tab2_text3', -text=>'tab2_ +text3', -left=>200, -top=>70, -height=>24, -width=>80,-tabstop=>1); $mainform->Show(); Win32::GUI::Dialog(); exit; main_Terminate { $mainform->Hide(); return -1; }
I have tried using $mainform = Win32::GUI::DialogBox->new(-name=>'main',-text=>'tabframe test',-width=>800,-height=>600,-dialogui=>1); to create the main window but it has no effect.

I have tried changing the way I set tabstops from -addstyle=>WS_TABSTOP to -tabstop=>1 again this has no effect

I have tried to remove the tabstop setting from the tabframe $mainform->AddTabFrame(-name=>"tab",-panel=>"Page",-width=>770,-height=>550,-left=>10,-top=>10); but this causes the program to lock up when I try to backtab.

I have tried removing the tabstop from the tabs themselves $mainform->tab->InsertItem(-text=>" Tab1 ",-border=>0,top=>10); but that has no effect either.

I also tried setting the tabstop on the tabs to 0 $mainform->tab->InsertItem(-text=>" Tab1 ",-border=>0,top=>10,-tabstop=>0); but that also has no effect.

It is entirely possible that I am way off base with the whole thing as I am still pretty new to perl GUI's in windows. I also know that the community is much more in tune with Tk than Win32::GUI however that is not an option for me. I also noticed that information on Win32::GUI::TabFrame is almost nonexistent so for those of you have not seen or heard of it, here it is (with one tiny mod by me to resolve a display issue I was having):
package Win32::GUI::TabFrame; my $VERSION = "0.02"; use Win32::GUI; use Win32::GUI::Frame; @ISA = qw(Win32::GUI::TabStrip); my %Instance = {}; # # new # sub new { my $class = shift; my $parent = shift; my %options = @_; my $panel = "Panel"; # Default Panel Name $panel = $options{-panel} if exists $options{-panel}; # New TabStrip my $self = new Win32::GUI::TabStrip ($parent, %options); # Init instance variable $self->{'#LastPanel'} = 0; $self->{'#Panel'} = $panel; # Keep object reference $Instance{$options{-name}} = $self; # Add Click Event eval qq( sub main::$options{-name}_Click { return Win32::GUI::TabFrame->ClickEvent($options{-name}); } ); return bless $self, $class; } # # AddSSTab # sub Win32::GUI::Window::AddTabFrame { return Win32::GUI::TabFrame->new(@_); } # # DisplayArea # sub DisplayArea { my $self = shift; my ($left,$top,$right,$botton) = $self->AdjustRect($self->GetClien +tRect()); return ($left, $top, $right - $left, $botton - $top); } # # Insert Element # sub InsertItem { my $self = shift; my %options = @_; # Add a panel my $count = $self->Count(); my $name = $self->{'#Panel'}.$count; my $border = 0; my $text = ""; if (exists $options{-border}) { $border = $options{-border} } if (exists $options{-paneltext}) { $text = $options{-paneltext} } my ($x,$y,$width,$height) = $self->DisplayArea(); #following line added by ChrisR to resolve display issue if($count == 0){$y=$y+18;$height=$height-18;} my $panel = $self->AddFrame ( -name => $name, -text => $text, -pos => [$x, $y], -size => [$width, $height], -border => $border, ); # Only show first page $panel->Hide() unless ($count == 0); # Add TabStrip $self->SUPER::InsertItem(%options); return $panel; } # # Resize # sub Resize { my $self = shift; my $width = shift; my $height = shift; $self->SUPER::Resize ($width, $height); my ($ax,$ay,$awidth,$aheight) = $self->DisplayArea(); my $count = $self->Count(); for ($i = 0; $i < $count; $i++) { my $page = $self->{'#Panel'}.$i; $self->{$page}->Move ($ax , $ay); $self->{$page}->Resize($awidth, $aheight); } } # # Reset : # sub Reset { my $self = shift; my $count = $self->Count(); for ($i = 0; $i < $count; $i++) { my $page = $self->{'#Panel'}.$i; $self->{$page}->DestroyWindow(); } $self->{'#LastPage'} = 0; return $self->SUPER::Reset(); } # # DeleteItem : # sub DeleteItem { die "Win32:GUI::TabFrame : Methode DeleteItem not working"; } # # ClickEvent # sub ClickEvent { my $class = shift; my $name = shift; my $element = $Instance{$name}; my $page = $element->{'#Panel'}.$element->{'#LastPanel'}; # Hide Last Page $element->{$page}->Hide(); # Show New Page $element->{'#LastPanel'} = $element->SelectedItem(); $page = $element->{'#Panel'}.$element->{'#LastPanel'}; $element->{$page}->Show(); } 1;

Does anybody have any ideas?

In reply to Help with tabstops in Win32::GUI by ChrisR

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.