hi rob, I wanted to use some peace of your code. the main function is ok. I want to use TextFields. Is there a possibility to move all Labels, Textfields,... of an window?
When I try to work through the hash -> only the text field is moved but no prompt of it. I've enclosed my testcode. thx. juergen __CODE__ #!perl -w use strict; use warnings; my %config = ( config1 => 0, config2 => 0, config3 => "a" ); use Win32::GUI 1.05 qw( SB_VERT SB_LINEUP SB_LINEDOWN SB_PAGEUP SB_PAGEDOWN SB_THUMBTRACK SB_THUMBPOSITION ); my $window = Win32::GUI::DialogBox->new( -name => "scroll_test", -text => "Scroll Test", -size => [400, 400], -vscroll => 1, -onScroll => \&process_scroll, ); my $count = 0; foreach my $l (sort(keys %config)) { $count = $count + 1; $window->AddTextfield( -name => "$l", -text => "$config{$l}", -tip => "", -left => 35, -prompt => [ "$l:" , 150 ], -height => 20, -width => 200, -top => 25 + ($count * 20), -width => 100, -tabstop => 1, ); } $window->ScrollRange(SB_VERT, 0, 5 + (35 * 99) + $window->config1->Height()); $window->ScrollPage(SB_VERT, $window->ScaleHeight()); $window->Show(); Win32::GUI::Dialog(); sub process_scroll { my ( $self, $bar, $op, $pos ) = @_; my $prev_pos = $self->ScrollPos($bar); my $new_pos = $prev_pos; if ( $op == SB_LINEUP ) { # or SB_LINELEFT $new_pos -= 35; } elsif ( $op == SB_LINEDOWN ) { # or SB_LINERIGHT $new_pos += 35; } elsif ( $op == SB_PAGEUP ) { # or SB_PAGELEFT $new_pos -= $self->ScrollPage($bar); } elsif ( $op == SB_PAGEDOWN ) { # or SB_PAGERIGHT $new_pos += $self->ScrollPage($bar); } elsif ( $op == SB_THUMBTRACK ) { $new_pos = $pos; } elsif ( $op == SB_THUMBPOSITION ) { $new_pos = $pos; } $new_pos = $self->ScrollPos( $bar, $new_pos ); if ( $bar == SB_VERT ) { my $v_pos = 5; $v_pos += 35; foreach my $lab (sort(keys %config)) { $self->{"$lab"}->Top($v_pos - $new_pos + 15); } } $self->Redraw(1); 1; } __END__ -------- Original-Nachricht -------- > Datum: Thu, 1 May 2008 23:01:47 +0100 > Von: "Robert May" <r...@themayfamily.me.uk> > An: "Steven Vasilogianis" <steven.vasilogia...@gmail.com> > CC: perl-win32-gui-users@lists.sourceforge.net > Betreff: Re: [perl-win32-gui-users] Scrollbars > 2008/4/30 Steven Vasilogianis <steven.vasilogia...@gmail.com>: > > I have been having some trouble getting my scroll bars to work well. I > > have been modifying an example I found on Rob May's weblog > > (http://blog.robmay.me.uk/search/label/perl-win32-gui). > > > > Sample code is included below. The problems I am having are: > > > > 1) The ScrollRange() call does not seem to be doing anything - I can > > scroll well beyond the range specified. > > I don't think you can really. > > > 2) SB_PAGE(UP|DOWN) events are not working at all > > Because you never set the page size. > > > I am rather new to Win32::GUI and would appreciate any help. > > Here's a minimally adapted version of your code that works for me. > There are easier ways to do this, and you really need to see the next > few examples in the series of scrollbar articles - I wrote the code at > the same time as the first 7 articles, but haven't had time to turn > them into full articles yet. I will post to this list when I do. > > Regards, > Rob. > > #!perl -w > use strict; > use warnings; > > use Win32::GUI 1.05 qw( > SB_VERT SB_LINEUP SB_LINEDOWN SB_PAGEUP SB_PAGEDOWN > SB_THUMBTRACK SB_THUMBPOSITION > ); > > my $window = Win32::GUI::DialogBox->new( > -name => "scroll_test", > -text => "Scroll Test", > -size => [400, 400], > -vscroll => 1, > -onScroll => \&process_scroll, > ); > > my $v_pos = 5; > for ( 1..100 ) { > $window->AddLabel( > -name => "label$_", > -text => "Label $_", > -pos => [5, $v_pos], > -size => [100, 30], > ); > > $v_pos += 35; > } > > $window->ScrollRange(SB_VERT, 0, 5 + (35 * 99) + > $window->label1->Height()); > $window->ScrollPage(SB_VERT, $window->ScaleHeight()); > > $window->Show(); > Win32::GUI::Dialog(); > > sub process_scroll { > my ( $self, $bar, $op, $pos ) = @_; > > my $prev_pos = $self->ScrollPos($bar); > my $new_pos = $prev_pos; > > if ( $op == SB_LINEUP ) { # or SB_LINELEFT > $new_pos -= 35; > } elsif ( $op == SB_LINEDOWN ) { # or SB_LINERIGHT > $new_pos += 35; > } elsif ( $op == SB_PAGEUP ) { # or SB_PAGELEFT > $new_pos -= $self->ScrollPage($bar); > } elsif ( $op == SB_PAGEDOWN ) { # or SB_PAGERIGHT > $new_pos += $self->ScrollPage($bar); > } elsif ( $op == SB_THUMBTRACK ) { > $new_pos = $pos; > } elsif ( $op == SB_THUMBPOSITION ) { > $new_pos = $pos; > } > > $new_pos = $self->ScrollPos( $bar, $new_pos ); > print "NP: $new_pos\n"; > > if ( $bar == SB_VERT ) { > my $v_pos = 5; > for ( 1..100 ) { > $self->{"label$_"}->Top($v_pos - $new_pos); > > $v_pos += 35; > } > } > $self->Redraw(1); > > 1; > } > __END__ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ > -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/