I am trying to use a RichText control. The xrc was generated by
DialogBlocks - so it should be OK.

But the error I get is:
No handler found for XML node 'object', class 'wxRichTextCtrl'!
Error in resource.




<?xml version="1.0" encoding="UTF-8"?>
<resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc";>
    <object class="wxDialog" name="ID_DIALOG" subclass="Dialog">
        <style>wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|
wxTAB_TRAVERSAL</style>
        <exstyle>wxWS_EX_BLOCK_EVENTS</exstyle>
        <title>Dialog</title>
        <centered>1</centered>
        <object class="wxBoxSizer">
            <orient>wxVERTICAL</orient>
            <object class="sizeritem">
                <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
                <border>5</border>
                <object class="wxBoxSizer">
                    <orient>wxVERTICAL</orient>
                    <object class="sizeritem">
                        <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
                        <border>5</border>
                        <object class="wxRichTextCtrl"
name="ID_RICHTEXTCTRL">
                            <size>100,100</size>
                            <style>wxWANTS_CHARS</style>
                        </object>
                    </object>
                </object>
            </object>
        </object>
    </object>
</resource>



#!/usr/bin/perl -w

package MyDialog;

use strict;

use Wx qw(:everything);
use Wx::Event qw(:everything);
use Wx::XRC ; 
use base qw(Wx::Dialog);
use Wx::RichText ;

sub new {
    my( $class, $label ) = @_;
    #my $dialog = $class->SUPER::new( undef, -1, $label, [-1, -1], [250,
110] );
    my $my = $class->SUPER::new ;
    my $xrc = Wx::XmlResource->new();
    $xrc->InitAllHandlers();
    $xrc->Load("a.xrc") or die "Load failed : $!\n" ; 
    $xrc->LoadOnDialog($my,undef, "ID_DIALOG") ;#or die "Cannot
LoadOnDialog: $!\n" ; 

    $my->ShowModal ;
    $my->Destroy ; 
    return $my;
}

sub OnClose {
    my( $this, $event ) = @_;

    $this->Destroy;
}

package main;

use Wx ; 
my $app = Wx::SimpleApp->new;
my $dialog = MyDialog->new("Dialog",$app);
$dialog->Show;



Reply via email to