Hi,

I'm not a user of XRC so havn't got any tested code.

However, there is an example in Wx::Demo that does exactly what you require.

I think you are missing

use Wx::FS;

and AddTextFile is a static function so your call would be

Wx::MemoryFSHandler::AddTextFile('project_open',$xml);

Hope it helps

Regards

Mark


On 14/04/2011 15:13, Laslo Forro wrote:
Hi there,

I am trying to use a custom xml to generate parts of the GUI. The code
skeleton is:

package MyFrame;
use WX qw/:everything/;
use Wx::XRC;
use base qw(Wx::Frame);

sub new {
    my $self=$_[0]->SUPER::new();
    # Load and process xml into $xml
    .....
    # make a memory FH ( XRCCustom )
       Wx::FileSystem::AddHandler ( Wx::MemoryFSHandler->new );<-----
       Wx::MemoryFSHandler->AddTextFile('project_open',$xml);
   # load XmlResource
       my $xrc= Wx::XmlResource->new();
       $xrc->InitAllHandlers();
       $xrc->Load('memory:project_open');

   # do the rest blahblah
       return $self;
}

I receive a 'Can't locate Wx::MemoryFSHandler error' on the<---- line and
unfortunately I have not idea why.
Thanx for any hint in advance!

Bests,
Laslo Forro


Reply via email to