[partial fix] XRC restore view

Steven Swerling sswerling at yahoo.com
Thu Mar 17 22:42:48 UTC 2005


Rob Gayvert wrote:
> Steven Swerling wrote:
> 
>> Hi Rob,
>>
>> I wanted to work on the problem of WxMorphic panels surviving an image 
>> save, and it seems that it doesn't work even for regular wx browsers. 
>> Wasn't that working before?
>>
>> Does it work for you, or did I manage to break something?
> 
> 
> Yes, it was working in 0.3, but it's definitely busted now, even for the 
> simplest workspace. I'll have to track down what changed for the worse.
> 

This is not the proposed fix, per se, but it will definitely get you 
going in the right direction.

When WxStyledTextCtrlXmlHandler takes a look at the XML node for 
WxPluggableTextView, it says it can handle it (using 
#isOfClass:classname). But in #doCreateResource, it's hardwired to use 
WxStyledTextCtrl.  I fixed it in the following (probably unacceptable) way:

===1. Add an iv called "subclassToUse" to WxStyledTextCtrlXmlHandler
===2. #canHandle looks like this:
canHandle: xmlNode

	"Transcript show: 'WxStyledTextCtrlXmlHandler.canHandle'; cr."

	WxStyledTextCtrl withAllSubclassesDo: [:cls |

		(self isOfClass: xmlNode classname: cls wxClassName) ifTrue: [
			subclassToUse _ cls.
			^true
		].

	].
	^false

===3. #doCreateResource looks like this:
doCreateResource
	ctrl := subclassToUse
		parent: self getParentAsWindow
		id: self getID
		position: self getPosition
		size: self getSize
		style: (self getStyle: 'style' defaults: wxTabTraversal)
		name: self getName.
		
	ctrl setText: (self getText: 'value').
	^ctrl
====
Note that connectEvents is still not working but I haven't figured out 
why yet, it looks like the hookup is happening when you step through 
connectEvents.



More information about the Wxsqueak mailing list