--- a/Win32FileDialog.st Sat Jan 22 15:32:55 2011 +0100
+++ b/Win32FileDialog.st Sun Jan 23 11:05:54 2011 +0100
@@ -14,7 +14,7 @@
Object subclass:#Win32FileDialog
instanceVariableNames:'fileName openFileNameStruct filters lpstrFilter lpstrFile
lpstrInitialDir lpstrTitle lpstrDefExt defFilter defExtension
- style title smalltalkFileFilters defFilterIndex parent'
+ style title smalltalkFileFilters defFilterIndex parent error'
classVariableNames:'InitialDirectory CommonDialogConstants FilterPatternDescriptions'
poolDictionaries:''
category:'Interface-Tools-File'
@@ -674,10 +674,27 @@
!Win32FileDialog methodsFor:'opening'!
-open
+asynchronousOpen
+ |rslt sema|
+
+ sema := Semaphore new.
+ [
+ [
+ self basicOpen
+ ] ensure:[
+ sema signal.
+ ].
+ ] fork.
+ sema wait.
+ ^ rslt
+
+ "Created: / 23-01-2011 / 10:59:35 / cg"
+!
+
+basicOpen
"Brings up the open file dialog."
- |error rslt openFileNameStructExternalBytes|
+ |rslt openFileNameStructExternalBytes|
[
self fillStruct.
@@ -688,8 +705,7 @@
openFileNameStruct flags:style
].
openFileNameStructExternalBytes := ExternalBytes from:openFileNameStruct asByteArray.
- rslt := OperatingSystem
- getOpenFilename:openFileNameStructExternalBytes address.
+ rslt := OperatingSystem getOpenFilename:openFileNameStructExternalBytes address.
rslt ifTrue:[
self getFileName
] ifFalse:[
@@ -700,11 +716,23 @@
openFileNameStructExternalBytes free.
self cleanUp.
].
+
+ "Created: / 23-01-2011 / 10:58:30 / cg"
+!
+
+open
+ "Brings up the open file dialog."
+
+ true "false" ifTrue:[
+ self synchronousOpen.
+ ] ifFalse:[
+ self asynchronousOpen.
+ ].
(error notNil and:[ error ~= 0 ]) ifTrue:[
self error:error
].
- "Modified: / 27-10-2010 / 11:28:09 / cg"
+ "Modified: / 23-01-2011 / 11:05:46 / cg"
!
openFile
@@ -830,6 +858,14 @@
self save.
"Modified: / 26-10-2010 / 18:47:35 / cg"
+!
+
+synchronousOpen
+ "Brings up the open file dialog."
+
+ self basicOpen.
+
+ "Modified: / 23-01-2011 / 10:59:20 / cg"
! !
!Win32FileDialog methodsFor:'private'!
@@ -1168,11 +1204,11 @@
!Win32FileDialog class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.11 2010-12-22 10:52:44 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.12 2011-01-23 10:05:54 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.11 2010-12-22 10:52:44 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.12 2011-01-23 10:05:54 cg Exp $'
! !
Win32FileDialog initialize!