logo       

Re: Differences using wxWidgets 2.7.0: msg#00076

Subject: Re: Differences using wxWidgets 2.7.0
John,

The SubclassFactory is exactly the mechanism I am using but it wasn't
working for subclasses of Wx::Grid. This was my hack to get around the
problem at the time.

But I have learnt quite a bit more about the XS layer, so you will see in
later mails I have now added code to Grid.XS to wrap the default constructor
(without parameters).

Thanks for your input.

Regards
Mark

-----Original Message-----
From: wxperl-users-bounces@xxxxxxxxxxxxxxxxxxxxx
[mailto:wxperl-users-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of John Ralls
Sent: 25 July 2006 05:49 PM
To: wxperl-users
Subject: Re: [wxperl-users] Differences using wxWidgets 2.7.0


On Jul 25, 2006, at 12:16 AM, Mark Wardell wrote:

> Hello,
>
> Further investigation has revealed that $this->FindWindow( $name ) 
> returns a HASH ref for all other controls I have tested but ONLY 
> returns a SCALAR ref for controls of type Wx::Grid.
>
> I use this _BAD_ method of reblessing as a way of initialising 
> subclassed controls (as below) that I am loading from XRC and have no 
> other way of initialising them. SubclassFactory provides a way to 
> override the default
> ->new() method (with no parameters), but there is no other way to
> override a
> Create or Show to provide any further customisation. So I am forced to 
> manually Init each control in my OnInitDialog handler.
>
> if (my $grid = $self->FindWindow('DiscountGrid')) {
>       bless $grid, 'Grid::DiscountGrid';
>       print "Grid::DiscountGrid => $grid\n";
>       $grid->InitControl( $self );
> }
>
> I suppose I could prevent the reblessing by simply declaring the 
> subclassing in the XRC definition but I would still have the problem 
> of FindWindow returned a SCALAR instead of a HASH and I need the HASH 
> as I use a lot of code like below:
>
> $self->{Option1} = $var;
>
> Can anyone offer any pointers where I can start looking or possible 
> alternative solutions.
>
> Thanks in advance.
>
> Mark

Yeah, http://wxperl.pvoice.org/kwiki/index.cgi?SubclassingXRC.

Perl's OO works, but it's a hack, and a bit fragile because it doesn't
enforce anything (which is why you can rebless in the first place, but also
why it will produce interesting results sometimes).  
If you declare
your subclass the documented way (either with use base or by putting the
superclass in the @ISA) then call SUPER::new in your own new (or don't write
a new at all) then your subclass object will be correctly blessed.

Regards,
John Ralls

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's
Techsay panel and you'll get the chance to share your opinions on IT &
business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
wxperl-users mailing list
wxperl-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/wxperl-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe