Leser: 4
![]() |
|< 1 ... 46 47 48 49 50 51 52 ... 64 >| | ![]() |
631 Einträge, 64 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/Perl/bin/perl use strict; use warnings; use Tk; use Tk::Text; my $mw = tkinit; my $text = $mw->Scrolled('Text', -scrollbars => 'se',)->pack(-fill => 'both', -expand => 1); $text->insert('end',"Dies ist ein roter Test\n"); $text->tagAdd('red_text',"1.13","1.18"); $text->insert('end',"Dies ist ein blauer Test\n"); $text->tagAdd('blue_text','end -1 lines','end -1 lines'); $text->tagConfigure('red_text', -foreground => 'red'); $text->tagConfigure('blue_text', -foreground => 'blue'); $mw->Button(-text => 'Button')->pack(); $mw->MainLoop();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
package TextCtrlPrintout; use strict; use vars qw(@ISA); @ISA = qw(Wx::Printout); =head1 METHODS =head2 new( $wx_textctrl ) =cut sub new { my $class = shift; my $textctrl = shift; my $this = $class->SUPER::new( @_ ); $this->{DOCUMENT} = $textctrl; # Seitenanzahl ausrechnen. $this->{PAGE_COUNT} = 1; return $this; } # /new =head2 GetPageInfo() wxPrintout::GetPageInfo void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) Called by the framework to obtain information from the application about minimum and maximum page values that the user can select, and the required page range to be printed. By default this returns 1, 32000 for the page minimum and maximum values, and 1, 1 for the required page range. If minPage is zero, the page number controls in the print dialog will be disabled. wxPerl note: When this method is overridden in a derived class, it must not take any parameters, and returns a 4-element list. =cut sub GetPageInfo { my $this = shift; Wx::LogMessage( "GetPageInfo" ); # Entweder hier ausrechnen wieviele Seiten es werden, oder wo anders # ausrechnen und hier zurück geben. return ( 1, $this->{PAGE_COUNT}, 1, $this->{PAGE_COUNT} ); # dast stimmt so natürlich nicht } # /GetPageInfo =head2 HasPage() wxPrintout::HasPage bool HasPage(int pageNum) Should be overridden to return true if the document has this page, or false if not. Returning false signifies the end of the document. By default, HasPage behaves as if the document has only one page. =cut sub HasPage { my $self = shift; my $page = shift; Wx::LogMessage( "HasPage: %d", $_[0] ); return 1 if $page <= $self->{PAGE_COUNT}; return 0; } # /HasPage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
=head2 OnBeginDocument() wxPrintout::OnBeginPrinting void OnBeginPrinting() Called by the framework at the start of printing. OnBeginPrinting is called once for every print job (regardless of how many copies are being printed). =cut sub OnBeginDocument { my $this = shift; Wx::LogMessage( "OnBeginDocument: %d, %d", @_ ); return $this->SUPER::OnBeginDocument( @_ ); } # /OnBeginDocument =head2 OnEndDocument() wxPrintout::OnEndDocument void OnEndDocument() Called by the framework at the end of document printing. OnEndDocument is called once for every copy printed. The base wxPrintout::OnEndDocument must be called from within the overridden function, since it calls wxDC::EndDoc. =cut sub OnEndDocument { my $this = shift; Wx::LogMessage( "OnEndDocument" ); return $this->SUPER::OnEndDocument(); } =head2 OnBeginPrinting() wxPrintout::OnBeginPrinting void OnBeginPrinting() Called by the framework at the start of printing. OnBeginPrinting is called once for every print job (regardless of how many copies are being printed). =cut sub OnBeginPrinting { my $this = shift; Wx::LogMessage( "OnBeginPrinting" ); return $this->SUPER::OnBeginPrinting(); } # /OnBeginPrinting =head2 OnEndPrinting() wxPrintout::OnEndPrinting void OnEndPrinting() Called by the framework at the end of printing. OnEndPrinting is called once for every print job (regardless of how many copies are being printed). =cut sub OnEndPrinting { my $this = shift; Wx::LogMessage( "OnEndPrinting" ); return $this->SUPER::OnEndPrinting(); } # /OnEndPrinting
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
=head2 OnPrintPage wxPrintout::OnPrintPage bool OnPrintPage(int pageNum) Called by the framework when a page should be printed. Returning false cancels the print job. The application can use wxPrintout::GetDC to obtain a device context to draw on. =cut sub OnPrintPage { my( $this, $page ) = @_; my $dc = $this->GetDC(); # ... ToDo } # /OnPrintPage 1;
lichtkind+2007-08-08 22:18:43--wenn ich solche sachen wüsste hätte der ediotr längst druckfunktion. eine einfache textbox heisst in Wx Wx::TextControl.
![]() |
|< 1 ... 46 47 48 49 50 51 52 ... 64 >| | ![]() |
631 Einträge, 64 Seiten |