http://qs321.pair.com?node_id=385685


in reply to wxPerl: Font in Wx::TextCtrl

Wx::STC does not work any longer, the program just segfaults.
When you recompiled widgets, did you recompile STC? Didn't think so.
How do I change the font of the widget?...
*boggle* SetFont most certainly does something (it sets the font).
#!/usr/bin/perl -w -- # generated by wxGlade 0.3.4 on Wed Aug 25 07:21:59 2004 # 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; 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, $sty +le, $name ); $self->{text_ctrl_1} = Wx::TextCtrl->new($self, -1, "", wxDefaultP +osition, wxDefaultSize, wxTE_MULTILINE); $self->{text_ctrl_1}->SetValue("Pod ". ( "pod\n" x 666) ); $self->__set_properties(); $self->__do_layout(); return $self; # end wxGlade } sub __set_properties { my $self = shift; # begin wxGlade: MyFrame::__set_properties $self->SetTitle("frame_1"); $self->{text_ctrl_1}->SetFont(Wx::Font->new(28, wxDEFAULT, wxNORMA +L, wxNORMAL, 0, "MS Shell Dlg")); # end wxGlade } sub __do_layout { my $self = shift; # begin wxGlade: MyFrame::__do_layout $self->{sizer_1} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_1}->Add($self->{text_ctrl_1}, 1, wxEXPAND, 0); $self->SetAutoLayout(1); $self->SetSizer($self->{sizer_1}); $self->{sizer_1}->Fit($self); $self->{sizer_1}->SetSizeHints($self); $self->Layout(); # end wxGlade } # end of class MyFrame 1; package MyApp; use base qw(Wx::App); use strict; sub OnInit { my( $self ) = shift; Wx::InitAllImageHandlers(); my $frame_1 = MyFrame->new(); $self->SetTopWindow($frame_1); $frame_1->Show(1); return 1; } # end of class MyApp package main; unless(caller){ my $app = MyApp->new(); $app->MainLoop(); }

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: wxPerl: Font in Wx::TextCtrl
by busunsl (Vicar) on Aug 25, 2004 at 14:59 UTC
    When you recompiled widgets, did you recompile STC? Didn't think so.

    :-)

    Yes, I did. In the beginning I wrote a shellscript to compile wxWidgets. It included STC and XRC.

    *boggle* SetFont most certainly does something (it sets the font).

    Yes it should, but it didn't for me. Now I think it was due to using the predefined fonts like wxSWISS_FONT and such.

    Using your way (SetFont(Wx::Font->new(...))) works just fine!

    Many thanks again!