Deferred events

Steven Swerling sswerling at yahoo.com
Thu Feb 24 21:56:12 UTC 2005


Sorry for lack of response of this. I *will* look at this. I ought to, 
after all my yacking on this. I want to work on the packaging stuff 
first, though, so it'll take me a day or two before I look.

Thanks.

Rob Gayvert wrote:
> Steven Swerling wrote:
> 
>> Rob Gayvert wrote:
>>
>>> Or you could also just disable the button, no?  The scenario that 
>>> Cees describes with a lengthy database query is very similar. If the 
>>> handler is executing Smalltalk code, then subsequent clicks elsewhere 
>>> could likewise be handled immediately and either ignored or with some 
>>> kind of busy response. But what if it's off in a primitive or FFI 
>>> call for an extended period? I don't know what the wx core will do 
>>> with clicks or keystrokes in this case.  Maybe there's something we 
>>> can use here from the implementation of WxWindowDisabler.
>>
>>
>>
>> Yes, agreed on all counts. I lost a little bit the courage of my 
>> convictions as soon as I hit the send button on that last deferred 
>> events email. Cees was right that it doesn't clean up the problem, it 
>> just shifts it.
>>
>> Perhaps, as you proceed with this difficult problem, you might want to 
>> leave hooks in the vm so that you can experiment *from smalltalk* with 
>> different approaches. For example, if you implement a loop in the VM 
>> that "eats" events during a lengthy sync callback, perhaps you could 
>> leave a hook in Smalltalk that turns the filter on and off. That way 
>> the masses can experiment with approaches to the problem by 
>> controlling event processing from the image. The guy that writes a 
>> better WinAmp decides not to eat any events, and just handle the 
>> consequences by putting checks into his own code. The guy that writes 
>> a banking application says "no, too risky" and disables the interface 
>> during transaction download.
> 
> 
> Here's a first pass at adding deferred event handling. There's a 
> 'Deferred Events' demo in 'Other Samples' that exercises several 
> variations on this theme.  WxWindowDisabler seems to do a good job of 
> blocking all events.
> 
> 
> ------------------------------------------------------------------------
> 
> 'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 23 February 2005 at 12:36:18 pm'!
> WxObject subclass: #WxEvtHandler
> 	instanceVariableNames: 'eventHandlers'
> 	classVariableNames: 'CallbackProcesses CompositeEvents CurrentEvent DeferredEventProcess DeferredEvents EventClasses EventProcess EventSymbols ShowEvents Synonyms'
> 	poolDictionaries: ''
> 	category: 'WxWidgets-Events'!
> WxPanel subclass: #WxDeferredButtonDemo
> 	instanceVariableNames: 'button1 button2 button3 button4 button5 button6 button7'
> 	classVariableNames: ''
> 	poolDictionaries: ''
> 	category: 'WxWidgets-Demo'!
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 10:15'!
> addDeferredEvent: anArray
> 
> 	self class deferredEvents nextPut: anArray.! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:28'!
> handleEvent: aWxEvent
> 
> 	"Evaluate some Smalltalk code to process the given event. We get here from a synchronous event
> 	 callback from wx."
> 	
> 	| arr eventSymbol handler |
> 
> 	eventSymbol := self class valueToSymbol: aWxEvent getEventType.
> 	
> 	(self eventHandlers includesKey: eventSymbol) ifFalse: [
> 		"try a synonym"
> 		eventSymbol := self class synonyms keyAtValue: eventSymbol ifAbsent: [ eventSymbol ]. 
> 	].
> 
> 	handler := self eventHandlers at: eventSymbol ifAbsent: [ 
> 		Transcript show: self; show: ': no handlers for '; show: eventSymbol; cr. 
> 		^false 
> 	].
> 
> 	"Each handler should be an array containing an object, an action, and optionally a boolean deferred value.
> 	 The action may be a selector, a block, or an array. A block action is evaluated with the event; the object is
> 	 ignored. An array action allows an argument to be passed in along with a selector. If the handler is deferred,
> 	 it is placed in the DeferredEvents queue for evaluation after "
> 	
> 	arr := handler at: aWxEvent getId ifAbsent: [ 
> 		handler at: -1 ifAbsent: [ 
> 			Transcript show: 'WxEvtHandler.handleEvent: no handler for ', aWxEvent asString; cr. 
> 			^false 
> 		]
> 	].
> 
> 	((arr size > 2) and: [ arr third ]) ifTrue: [ 
> 		self addDeferredEvent: (Array with: aWxEvent clone with: arr first with: arr second).
> 		^true 
> 	].
> 	
> 	self class processAction: (Array with: aWxEvent with: arr first with: arr second).
> 
> 	^true! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:22'!
> on: eventSymbol id: id send: selector
> 
> 	self on: eventSymbol id: id send: selector to: self.
> ! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:21'!
> on: eventSymbol id: id send: selector to: anObject
> 
> 	self on: eventSymbol id: id send: selector to: anObject deferred: false.
> ! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:20'!
> on: eventSymbol id: id send: selector to: anObject deferred: aBoolean
> 
> 	| eventType |
> 
> 	"Make sure eventSymbol is a unary selector -- it's easy to goof and tough to find"
> 	eventSymbol isUnary 
> 		ifFalse: [ self error: 'event symbol #', eventSymbol, ' should be unary' ].
> 
> 	(CompositeEvents includesKey: eventSymbol) ifTrue: [
> 		^self onComposite: eventSymbol id: id send: selector to: anObject 
> 	].
> 
> 	eventType := self class symbolToValue: eventSymbol.
> 
> 	(eventType == 0) ifTrue: [
> 		self error: 'unknown event symbol #', eventSymbol.
> 	].
> 
> 	(self handlerFor: eventSymbol) at: id put: (Array with: anObject with: selector with: aBoolean).
> 
> 	Wx connect: self 
> 		id: id 
> 		type: (self class symbolToValue: eventSymbol).
> 
> ! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:22'!
> on: eventSymbol id: id sendDeferred: selector
> 
> 	^self on: eventSymbol id: id send: selector to: self deferred: false
> ! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:22'!
> on: eventSymbol id: id sendDeferred: selector to: anObject
> 
> 	self on: eventSymbol id: id send: selector to: anObject deferred: true.
> ! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:23'!
> on: eventSymbol sendDeferred: selector 
> 
> 	self on: eventSymbol sendDeferred: selector to: self.! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:23'!
> on: eventSymbol sendDeferred: selector to: anObject
> 
> 	self on: eventSymbol id: wxIdAny send: selector to: anObject deferred: true.! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:20'!
> onComposite: eventSymbol id: id send: selector to: anObject
> 
> 	self onComposite: eventSymbol id: id send: selector to: anObject deferred: false.! !
> 
> !WxEvtHandler methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:20'!
> onComposite: eventSymbol id: id send: selector to: anObject deferred: aBoolean
> 
> 	( CompositeEvents at: eventSymbol ifAbsent: [ ^nil ]) do: [:evt |
> 		self on: evt id: id send: selector to: anObject deferred: aBoolean
> 	].! !
> 
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 09:58'!
> build
> 	
> 	self setBackgroundColour: wxWhite. 
> 
> 	button1 := WxButton parent: self id: wxIdAny label: 'Regular send with delays' position: 20 at 20.
> 	button1 on: #wxEvtCommandButtonClicked send: #onClick1: to: self.
> 	button1 setToolTipString: 'Push me and wait...'.
> 
> 	button2 := WxButton parent: self id: wxIdAny label: 'Defer with delays' position: 20 at 60. 
> 	button2 on: #wxEvtCommandButtonClicked sendDeferred: #onClick2: to: self.
> 	button2 setToolTipString: 'Push me and wait...'.
> 
> 	button3 := WxButton parent: self id: wxIdAny label: 'Defer with wxSleep' position: 20 at 100.
> 	button3 on: #wxEvtCommandButtonClicked sendDeferred: #onClick3: to: self.
> 	button3 setToolTipString: 'Push me and wait...'.
> 
> 	button4 := WxButton parent: self id: wxIdAny label: 'Regular send without disabling - keep clicking to hit limit' position: 20 at 140.
> 	button4 on: #wxEvtCommandButtonClicked send: #onClick4: to: self.
> 	button4 setToolTipString: 'Push me and wait...'.
> 
> 	button5 := WxButton parent: self id: wxIdAny label: 'Regular send with WxWindowDisabler' position: 20 at 180.
> 	button5 on: #wxEvtCommandButtonClicked send: #onClick5: to: self.
> 	button5 setToolTipString: 'Push me and wait...'.
> 
> 	button6 := WxButton parent: self id: wxIdAny label: 'Regular send with long primitive' position: 20 at 220.
> 	button6 on: #wxEvtCommandButtonClicked send: #onClick6: to: self.
> 	button6 setToolTipString: 'Push me and wait...'.
> 
> 	button7 := WxButton parent: self id: wxIdAny label: 'Defer with long primitive' position: 20 at 260.
> 	button7 on: #wxEvtCommandButtonClicked sendDeferred: #onClick7: to: self.
> 	button7 setToolTipString: 'Push me and wait...'.
> 
> 
> 	! !
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 08:15'!
> onClick1: aCommandEvent
> 
> 	Wx logMessage: 'Button 1 click'.
> 
> 	button1 disable.
> 	
> 	1 to: 5 do: [:i |
> 		Wx logMessage: 'Button 1 step ', i asString.
> 		(Delay forSeconds: 1) wait.
> 	].
> 
> 	button1 enable.! !
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 08:10'!
> onClick2: aCommandEvent
> 
> 	Wx logMessage: 'Button 2 click'.
> 	
> 	button2 disable.
> 	
> 	1 to: 5 do: [:i |
> 		Wx logMessage: 'Button 2 step ', i asString.
> 		(Delay forSeconds: 1) wait.
> 	].
> 
> 	button2 enable.! !
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 08:19'!
> onClick3: aCommandEvent
> 
> 	Wx logMessage: 'Button 3 click'.
> 	
> 	button3 disable.
> 	 
> 	1 to: 5 do: [:i |
> 		Wx logMessage: 'Button 3 step ', i asString.
> 		Wx sleep: 1.
> 	].
> 
> 	button3 enable.! !
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 08:25'!
> onClick4: aCommandEvent
> 
> 	Wx logMessage: 'Button 4 click'.
> 
> 	1 to: 5 do: [:i |
> 		Wx logMessage: 'Button 4 step ', i asString.
> 		(Delay forSeconds: 1) wait.
> 	].
> 
> ! !
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 08:41'!
> onClick5: aCommandEvent
> 
> 	Wx logMessage: 'Button 5 click'.
> 	
> 	WxWindowDisabler disableEventsWhile: [	
> 		1 to: 5 do: [:i |
> 			Wx logMessage: 'Button 5 step ', i asString.
> 			(Delay forSeconds: 1) wait.
> 		].
> 	].
> 
> 	Wx logMessage: 'Button 5 done'.
> 
> ! !
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 10:03'!
> onClick6: aCommandEvent
> 
> 	| x |
> 	
> 	Wx logMessage: 'Button 6 click'.
> 	
> 	button6 disable.
> 	
> 	x := FloatArray new: 2000000.
> 	x += 1.
> 	Wx logMessage: 'Starting long primitive'.
> 	x squaredLength. 
> 	Wx logMessage: 'Done with long primitive'.
> 
> 	button6 enable.
> 
> 	Wx logMessage: 'Button 6 done'.
> ! !
> 
> !WxDeferredButtonDemo methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 10:02'!
> onClick7: aCommandEvent
> 
> 	| x |
> 	
> 	Wx logMessage: 'Button 7 click'.
> 	
> 	button7 disable.
> 	
> 	x := FloatArray new: 2000000.
> 	x += 1.
> 	Wx logMessage: 'Starting long primitive'.
> 	x squaredLength. 
> 	Wx logMessage: 'Done with long primitive'.
> 
> 	button7 enable.
> 	
> 	Wx logMessage: 'Button 7 done'.
> 
> ! !
> 
> 
> !WxDemoFrame methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 22:06'!
> demoItems
> 
> 	^#(
> 		( 'Frames and Dialogs' (
>         		('Dialog' 'WxSampleDialog' ('WxDialog'))
>         		('Frame' 'WxFrameDemo' ('WxFrame'))
>         		"('MDIWindows' 'WxMDIWindowsDemo')"
>         		('MiniFrame' 'WxMiniFrameDemo' ('WxMiniFrame'))
>        		('Wizard' 'WxWizardSample' ('WxWizardDemoTitledPage' 'WxWizardDemoSkipNextPage' 'WxWizard'  'WxWizardPageSimple' ))
> 		))
> 		( 'Common Dialogs' (
>         		('ColourDialog' 'WxColourDialogDemo' ('WxColourDialog') ) 
>         		('DirDialog' 'WxDirDialogDemo' ('WxDirDialog') ) 
>        		('FileDialog' 'WxFileDialogDemo' ('WxFileDialog') ) 
> 		     ('FindReplaceDialog' 'WxFindReplaceDialogDemo' ('WxFindReplaceDialog') ) 
>         		('FontDialog' 'WxFontDialogDemo' ('WxFontDialog') )
>         		('MessageDialog' 'WxMessageDialogDemo' ('WxMessageDialog') )
>         		('PageSetupDialog' 'WxPageSetupDialogDemo' ('WxPageSetupDialog') )
>         		('PrintDialog' 'WxPrintDialogDemo' ('WxPrintDialog') )
>         		('ProgressDialog' 'WxProgressDialogDemo' ('WxProgressDialog') )
>         		('SingleChoiceDialog' 'WxSingleChoiceDialogDemo' ('WxSingleChoiceDialog') )
>         		('TextEntryDialog' 'WxTextEntryDialogDemo' ('WxTextEntryDialog') )
>        	))
> "
> 		( 'More Dialogs' (
>         		('ImageBrowser' 'WxImageBrowserDemo') 
>         		('MultipleChoiceDialog' 'WxMultipleChoiceDialogDemo') 
>        		('ScrolledMessageDialog' 'WxScrolledMessageDialogDemo') 
>        	))
> "
> 		( 'Core Windows/Controls' (
>         		('BitmapButton' 'WxBitmapButtonDemo' ('WxBitmapButton') ) 
>         		('Button' 'WxButtonDemo' ('WxButton') )
>         		('CheckBox' 'WxCheckBoxDemo' ('WxCheckBox') )
>        		('CheckListBox' 'WxCheckListBoxDemo' ('WxCheckListBox') ) 
>         		('Choice' 'WxChoiceDemo' ('WxChoice') ) 
>         		('ComboBox' 'WxComboBoxDemo' ('WxComboBox') ) 
>         		('Gauge' 'WxGaugeDemo' ('WxGauge') )
>        		('Grid' 'WxGridDemo' ('WxSimpleGrid' 'WxStdEdRendGrid' 'WxCustomDataTableGrid' 'WxHugeTableGrid' 'WxEnterHandlerGrid' 'WxCustEditorGrid' 'WxDragableGrid' 'WxDragAndDropGrid' ))
> 			('GridMegaExample' 'WxGridMegaDemo' ('WxMegaFontRenderer' 'WxMegaGrid' 'WxMegaImageRenderer' 'WxMegaTable'))
> 			('ListBox' 'WxListBoxDemo' ('WxListBox') )
> 			('ListCtrl' 'WxListCtrlDemo' ('WxListCtrl') )
> 			('ListCtrlVirtual' 'WxVirtualListCtrlDemo' ('WxVirtualListCtrl') )
> 			('Listbook' 'WxListbookDemo' ('WxListbook') )
> 			('Menu' 'WxMenuDemo' ('WxMenu') )
> 			('Notebook' 'WxNotebookDemo' ('WxDemoColorPanel' 'WxScrolledWindowDemo' 'WxSimpleGrid' 'WxListCtrlDemo'))
> "
> 			('PopupMenu' 'WxPopupMenuDemo' ('WxMenu') )
> 			('PopupWindow' 'WxPopupWindowDemo' ('WxPopupWindow' 'WxPopupTransientWindow') )
> "
> 			('RadioBox' 'WxRadioBoxDemo' ('WxRadioBox') )
> 			('RadioButton' 'WxRadioButtonDemo' ('WxRadioButton') )
> 			('SashWindow' 'WxSashWindowDemo' ('WxSashWindow') )
> 			('ScrolledWindow' 'WxScrolledWindowDemo' ('WxScrolledWindow') )
> 			('Slider' 'WxSliderDemo' ('WxSlider') )
> 			('SpinButton' 'WxSpinButtonDemo' ('WxSpinButton') )
> 			('SpinCtrl' 'WxSpinCtrlDemo' ('WxSpinCtrl') )
> 			('SplitterWindow' 'WxSplitterWindowDemo' ('WxSplitterWindow') )
> 			('StaticBitmap' 'WxStaticBitmapDemo' ('WxStaticBitmap') )
> 			('StaticText' 'WxStaticTextDemo' ('WxStaticText') )
> 			('StatusBar' 'WxStatusBarDemo' ('WxStatusBar') )
> 			('TextCtrl' 'WxTextCtrlDemo' ('WxTextCtrl') )
> 			('ToggleButton' 'WxToggleButtonDemo' ('WxToggleButton') )
> 			('ToolBar' 'WxToolBarDemo' ('WxToolBar') )
> 			('TreeCtrl' 'WxTreeCtrlDemo' ('WxTreeCtrl') )
> 			('Validator' 'WxValidatorDemo' ('WxDemoValidator' 'WxDemoValidatorDialog' 'WxDemoTextValidator'))
>       	)) 
> "
> 		( 'Custom Controls' (
>         		('AnalogClockWindow' 'WxAnalogClockWindowDemo')
>         		('ColourSelect' 'WxColourSelectDemo')
>         		('Editor' 'WxEditorDemo')
>        		('GenericButtons' 'WxGenericButtonsDemo') 
>         		('GenericDirCtrl' 'WxGenericDirCtrlDemo') 
>         		('LEDNumberCtrl' 'WxLEDNumberCtrlDemo') 
>         		('MultiSash' 'WxMultiSashDemo')
>        		('PopupControl' 'WxPopupControlDemo')
> 			('ColourChooser' 'WxColourChooserDemo')
> 			('TreeListCtrl' 'WxTreeListCtrlDemo')
>        	)) 
> "
> 		( 'More Windows/Controls' (
>         		('CalendarCtrl' 'WxCalendarCtrlDemo' ('WxCalendarCtrl') )
>         		('ContextHelp' 'WxContextHelpDemo' ('WxContextHelp') )
>         		('MimeTypesManager' 'WxMimeTypesManagerDemo' ('WxMimeTypesManager') )
>         		('StyledTextCtrl1' 'WxStyledTextCtrlDemo1' ('WxStyledTextCtrl') )
>         		('VListBox' 'WxVListBoxDemo' ('WxVListBox') )
> 
> "        		('ActiveXFlashWindow' 'ActiveXFlashWindowDemo')
>         		('ActiveXIEHtmlWindow' 'ActiveXIEHtmlWindowDemo')
>         		('ActiveXPDFWindow' 'ActiveXPDFWindowDemo')
>         		('Calendar' 'CalendarDemo')
>         		('DynamicSashWindow' 'DynamicSashWindowDemo')
>         		('EditableListBox' 'EditableListBoxDemo')
>         		('FancyText' 'FancyTextDemo')
>         		('FileBrowseButton' 'FileBrowseButtonDemo')
>         		('FloatBar' 'FloatBarDemo')
>         		('FloatCanvas' 'FloatCanvasDemo')
>         		('HtmlWindow' 'HtmlWindowDemo')
>         		('IntCtrl' 'IntCtrlDemo')
>         		('MVCTree' 'MVCTreeDemo')
>         		('MaskedEditControls' 'MaskedEditControlsDemo')
>         		('MaskedNumCtrl' 'MaskedNumCtrlDemo')
>         		('ScrolledPanel' 'ScrolledPanelDemo')
>         		('SplitTree' 'SplitTreeDemo')
>         		('StyledTextCtrl2' 'WxStyledTextCtrlDemo2')
>         		('TablePrint' 'TablePrintDemo')
>         		('Throbber' 'ThrobberDemo')
>         		('TimeCtrl' 'TimeCtrlDemo')
> "
>        	)) 
> 		( 'Window Layout' (
>         		('GridBagSizer' 'WxGridBagSizerDemo' ('WxGridBagSizer') )
>         		('LayoutConstraints' 'WxLayoutConstraintsDemo' ('WxLayoutConstraints') )
>          		('Sizers' 'WxSizersDemo' ('WxSizersDemoTestFrame' 'WxSizersDemoSampleWindow' 'WxSizer' 'WxBoxSizer' 'WxGridSizer' 'WxFlexGridSizer') )
>        		('XmlResource' 'WxXmlResourceDemo' ('WxXmlResource') )
> 			('XmlResourceHandler' 'WxXmlResourceHandlerDemo' ('WxXmlResourceCustomHandler' 'WxXmlCustomPanel') )
> 			('XmlResourceSubclass' 'WxXmlResourceSubclassDemo' ('WxXmlCustomPanel2') )
>        		"('LayoutAnchors' 'WxLayoutAnchorsDemo')
>        		('Layoutf' 'WxLayoutfDemo') 
>         		('RowColSizer' 'WxRowColSizerDemo') 
>         		('ScrolledPanel' 'WxScrolledPanelDemo')"
>        	)) 
> "
> 		( 'Processes and Events' (
>         		('EventManager' 'WxEventManagerDemo')
>         		('KeyEvents' 'WxKeyEventsDemo')
>         		('Process' 'WxProcessDemo')
>        		('CustomEvents' 'WxCustomEventsDemo') 
>         		('Threads' 'WxThreadsDemo') 
>         		('Timer' 'WxTimerDemo') 
>         	)) 
> 		( 'Clipboard and DnD' (
>         		('CustomDragAndDrop' 'WxCustomDragAndDropDemo')
>         		('DragAndDrop' 'WxDragAndDropDemo')
>         		('URLDragAndDrop' 'WxURLDragAndDropDemo')
>        	)) 
> "
> 		( 'Using Images' (
>         		('ArtProvider' 'WxArtProviderDemo' ('WxArtProvider') )
>         		('Cursor' 'WxCursorDemo' ('WxCursor') )
>         		('DragImage' 'WxDragImageSampleCanvas' ('WxDragImageSample' 'WxDragShape') )
>        		('Image' 'WxImageDemo' ('WxImage') ) 
>         		('ImageAlpha' 'WxImageAlphaDemo' ('WxImage') ) 
>          		('Mask' 'WxMaskDemo' ('WxImage') )
>        		"('ImageFromStream' 'WxImageFromStreamDemo') 
>        		('Throbber' 'WxThrobberDemo')"
>        	)) 
> 		( 'Miscellaneous' (
>         		('DrawXXXList' 'WxDrawXXXListDemo' ('WxDC') )
>         		('FileHistory' 'WxFileHistoryDemo' ('WxFileHistory') )
>        		('FontEnumerator' 'WxFontEnumeratorDemo' ('WxFontEnumerator') ) 
>         		('PrintFramework' 'WxPrintFrameworkDemo' ('WxDemoPrintout') )
>        		('ShapedWindow' 'WxShapedWindowDemo' ('WxFrame') )
>         		"('ColourDB' 'WxColourDBDemo')
>         		('Joystick' 'WxJoystickDemo') 
>         		('OGL' 'WxOGLDemo') 
> 			('Sound' 'WxSoundDemo')
> 			('Unicode' 'WxUnicodeDemo')"
>        	)) 
> 		( 'Other Samples' (
>         		('Minimal' 'WxMinimalSample')
> 			('AboutBox' 'WxHtmlAboutSample' ('WxHtmlWindow') )
>         		('Deferred Events' 'WxDeferredButtonDemo'  )
>         		('Dialogs' 'WxDialogSample' ('WxDialogSampleCanvas') )
>         		('Controls' 'WxControlsSample' ('WxControl') )
> 			('HelpController' 'WxHelpControllerDemo' ('WxHelpController') )
>        		"('DragImage2' 'WxDragImageSample' ('WxDragImageSampleCanvas' 'WxDragShape') ) 
>         		('StyledText' 'WxSTCSample' ('WxStyledTextCtrl') ) 
>         		('SplitterWindow2' 'WxSplitterSample' ('WxSplitterTestCanvas') )"
>        		('SqueakDevTools' 'WxDevToolsSample' ('BrowserPresenter') )
> 			('XRC Sample' 'WxXrcDemoFrame' ('WxXrcDemoPreferencesDialog' 'WxXrcDemoResizableListCtrl') )
> 			('XRC Viewer' 'WxXrcViewerDemo' ('XMLDOMParser') )
>        	)) 
> 	)! !
> 
> 
> !WxEvtHandler class methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 10:15'!
> deferredEvents
> 
> 	^ DeferredEvents ifNil: [ DeferredEvents := SharedQueue new ]! !
> 
> !WxEvtHandler class methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 10:16'!
> initialize
> 
> 	DeferredEvents := nil.
> 	
> 	self initializeSynonyms.
> 	self initializeCompositeEvents.
> 	self initializeEventSymbols.
> 	self initializeEventClasses.
> 	
> 	! !
> 
> !WxEvtHandler class methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 18:28'!
> processAction: anArray
> 
> 	| obj  action evt |
> 	
> 	evt := anArray first.
> 	obj := anArray second.
> 	action := anArray third.
> 
> 	action isBlock ifTrue: [
> 		"special case of a block context"
> 		action value: evt.
> 		^true
> 	].
>  
> 	(action class == Array) ifTrue: [
> 		"special case of a selector-arg pair (see WxMenu>>add:target:selector:argument)"
> 		obj perform: action first with: action second.
> 		^true
> 	].
> 
> 	action isUnary ifTrue: [
> 		obj perform: action.
> 	]
> 	ifFalse: [
> 		obj perform: action with: evt.
> 	].! !
> 
> !WxEvtHandler class methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 10:16'!
> runDeferredEventProcess
> 
> 	DeferredEventProcess ifNotNil: [ self stopDeferredEventProcess ].
> 	 
> 	DeferredEventProcess := 
> 	[
> 		[ true ] whileTrue: [
> 			self processAction: self deferredEvents next.
> 		].
> 	] forkAt: Processor userSchedulingPriority.
> 
> 
> 			! !
> 
> !WxEvtHandler class methodsFor: 'as yet unclassified' stamp: 'rtg 2/23/2005 08:27'!
> runEventProcess
> 
> 	EventProcess ifNotNil: [ self stopEventProcess ].
> 	 
> 	EventProcess := 
> 	[
> 		[ true ] whileTrue: [
> 			(Delay forMilliseconds: 5) wait.
> 			[ Wx processEvents == true ] whileTrue: [].
> 			
> 		].
> 	] forkAt: Processor userSchedulingPriority.
> 
> 
> 			! !
> 
> !WxEvtHandler class methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 21:47'!
> startingUp: resuming
> 
> 	self runEventProcess. 
> 	self startCallbackProcesses.
> 	self runDeferredEventProcess.
> ! !
> 
> !WxEvtHandler class methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 21:45'!
> stopDeferredEventProcess
> 
> 	DeferredEventProcess ifNotNil: [ DeferredEventProcess terminate ].
> 	DeferredEventProcess := nil.! !
> 
> 
> !WxDeferredButtonDemo class methodsFor: 'as yet unclassified' stamp: 'rtg 2/22/2005 22:05'!
> testPanel: parent
> 
> 	^(self parent: parent) build
> 
> 	! !
> 
> 
> !WxWindowDisabler class methodsFor: 'generated' stamp: 'rtg 2/23/2005 08:39'!
> disableEventsWhile: aBlock
> 
> 	| disabler |
> 	
> 	disabler := self new.
> 	[ aBlock value ] ensure: [ disabler delete ].! !
> 
> WxEvtHandler initialize!
> 
> !WxEvtHandler class reorganize!
> ('as yet unclassified' callbackProcesses checkCallbackException cloneCurrentEvent compositeEvents convertWxEventNameToSymbol: deferredEvents eventClassForEventType:eventObject: eventClasses eventDeleted: eventProcess eventSymbols initialize initializeCompositeEvents initializeEventClasses initializeEventSymbols initializeSynonyms processAction: processEvent runCallbackProcess: runDeferredEventProcess runEventProcess showEvents showEvents: shuttingDown: startCallbackProcesses startingUp: stopCallbackProcess: stopCallbackProcesses stopDeferredEventProcess stopEventProcess symbolToValue: synonyms valueToSymbol:)
> ('generated' new)
> !
> 
> WxEvtHandler startingUp: true.!




More information about the Wxsqueak mailing list