Thread [WxPerl] Ausgaben in der Statusbar (8 answers)
Opened by MarkusH at 2013-03-31 17:11

MarkusH
 2013-03-31 21:57
#166770 #166770
User since
2012-04-08
161 Artikel
BenutzerIn
[default_avatar]
Hallo,

hier nun mal eine gekürzte Fassung
Code (perl): (dl )
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/perl -w -- 
# generated by wxGlade 0.6.5 (standalone edition) on Sun Mar 31 21:41:44 2013
# To get wxPerl visit http://wxPerl.sourceforge.net/

use Wx 0.15 qw[:allclasses];
use strict;

package MyFrame;

use Wx qw[:everything];
use base qw(Wx::Frame);
use strict;

my @loginBitmaps = (Wx::Bitmap->new("./res/red.bmp", wxBITMAP_TYPE_ANY), Wx::Bitmap->new("./res/green.bmp", wxBITMAP_TYPE_ANY));

sub new {
        my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_;
        $parent = undef              unless defined $parent;
        $id     = -1                 unless defined $id;
        $title  = ""                 unless defined $title;
        $pos    = wxDefaultPosition  unless defined $pos;
        $size   = wxDefaultSize      unless defined $size;
        $name   = ""                 unless defined $name;

# begin wxGlade: MyFrame::new

        $style = wxDEFAULT_FRAME_STYLE 
                unless defined $style;

        $self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
        

        # Menu Bar

        $self->{menubar} = Wx::MenuBar->new();
        my $wxglade_tmp_menu;
        $wxglade_tmp_menu = Wx::Menu->new();
        $wxglade_tmp_menu->Append(Wx::NewId(), "Import", "");
        $wxglade_tmp_menu->Append(Wx::NewId(), "export", "");
        $wxglade_tmp_menu->AppendSeparator();
        $wxglade_tmp_menu->Append(Wx::NewId(), "Beenden", "");
        $self->{menubar}->Append($wxglade_tmp_menu, "Test");
        $self->SetMenuBar($self->{menubar});
        
# Menu Bar end

        $self->{statusbar} = $self->CreateStatusBar(2, 0);
        
# Tool Bar
        $self->{toolbar} = Wx::ToolBar->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxTB_TEXT|wxTB_HORZ_LAYOUT|wxTB_HORZ_TEXT);
        $self->SetToolBar($self->{toolbar});
        $self->{toolbar}->AddTool(Wx::NewId(), "Login", $loginBitmaps[0], wxNullBitmap, wxITEM_CHECK, "Einloggen", "lange hilfe");
        $self->{toolbar}->AddSeparator();
        $self->{toolbar}->AddTool(Wx::NewId(), "item", wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, "", "");
        # Tool Bar end

        $self->__set_properties();
        $self->__do_layout();

# end wxGlade
        return $self;

}


sub __set_properties {
        my $self = shift;

# begin wxGlade: MyFrame::__set_properties

        $self->SetTitle("Test");
        $self->{statusbar}->SetStatusWidths(80,-1);
        
        my( @statusbar_fields ) = (
                "loginTimer",
                "status"
        );

        if( @statusbar_fields ) {
                $self->{statusbar}->SetStatusText($statusbar_fields[$_], $_)    
                for 0 .. $#statusbar_fields ;
        }
        $self->{toolbar}->Realize();

# end wxGlade
}

sub __do_layout {
        my $self = shift;

# begin wxGlade: MyFrame::__do_layout

        $self->Layout();

# end wxGlade
}

# end of class MyFrame

1;

1;

package main;

unless(caller){
        local *Wx::App::OnInit = sub{1};
        my $Test = Wx::App->new();
        Wx::InitAllImageHandlers();

        my $TEST = MyFrame->new();

        $Test->SetTopWindow($TEST);
        $TEST->Show(1);
        $Test->MainLoop();
}


Außerdem habe ich noch ein Bild angehängt. Der Pfeil gibt die Stelle an, an der ich gerne Meldungen ausgeben will - Feld 2.
Anhänge
image/jpeg
400 x 250
Test.jpg
$q =~ /(bb|[^b]{2})/

View full thread [WxPerl] Ausgaben in der Statusbar