WinWorkstation.st
changeset 8528 f22907717fa6
parent 8527 9ac7c1dcce68
child 8530 4b7259e14175
equal deleted inserted replaced
8527:9ac7c1dcce68 8528:f22907717fa6
 16593             filterString:
 16593             filterString:
 16594                 'expecco Testsuite', null, '*.ets', null, 
 16594                 'expecco Testsuite', null, '*.ets', null, 
 16595                 'expecco Logfile', null, '*.elf', null, 
 16595                 'expecco Logfile', null, '*.elf', null, 
 16596                 null
 16596                 null
 16597             filterIndex:2
 16597             filterIndex:2
 16598             doSave:false. 
 16598             doSave:false.            
 16599 
 16599 
 16600     ########### example2 without owning view and termination ##########
 16600     ########### example2 without owning view and termination ##########
 16601 
 16601 
 16602         |null p|
 16602         |null p|
 16603 
 16603 
 16617                     doSave:false.    
 16617                     doSave:false.    
 16618             ] fork.
 16618             ] fork.
 16619 
 16619 
 16620         Delay waitForSeconds:5. 
 16620         Delay waitForSeconds:5. 
 16621 
 16621 
 16622         p terminate.  
 16622         p terminate.          
 16623 
 16623 
 16624     ########### example2 with owning view (makes the launcher modal) ##########
 16624     ########### example2 with owning view (makes the launcher modal) ##########
 16625 
 16625 
 16626         |null owningViewId|
 16626         |null owningViewId|
 16627 
 16627 
 16636             filterString:
 16636             filterString:
 16637                 'expecco Testsuite', null, '*.ets', null, 
 16637                 'expecco Testsuite', null, '*.ets', null, 
 16638                 'expecco Logfile', null, '*.elf', null, 
 16638                 'expecco Logfile', null, '*.elf', null, 
 16639                 null
 16639                 null
 16640             filterIndex:2
 16640             filterIndex:2
 16641             doSave:false.    
 16641             doSave:false.     
 16642 
 16642 
 16643     ########### example3 with owning view (makes the launcher modal) and termination ##########
 16643     ########### example3 with owning view (makes the launcher modal) and termination ##########
 16644 
 16644 
 16645         |null owningViewId p|
 16645         |null owningViewId p|
 16646 
 16646 
 16662                     doSave:false.    
 16662                     doSave:false.    
 16663             ] fork.
 16663             ] fork.
 16664 
 16664 
 16665         Delay waitForSeconds:5. 
 16665         Delay waitForSeconds:5. 
 16666 
 16666 
 16667         p terminate.
 16667         p terminate.                  
 16668     "
 16668     "
 16669 
 16669 
 16670     "Created: / 22-10-2018 / 11:20:31 / sr"
 16670     "Created: / 22-10-2018 / 11:20:31 / sr"
 16671     "Modified (comment): / 22-10-2018 / 14:03:20 / sr"
 16671     "Modified (comment): / 22-10-2018 / 15:12:56 / sr"
 16672 !
 16672 !
 16673 
 16673 
 16674 primCloseNativeFileDialogByDataAddress:dataAddress
 16674 primCloseNativeFileDialogByDataAddress:dataAddress
 16675     threadHandleAddress:threadHandleAddress
 16675     threadHandleAddress:threadHandleAddress
 16676 
 16676 
 16678      this is called as an ensure, when the native file dialog process gets terminated
 16678      this is called as an ensure, when the native file dialog process gets terminated
 16679      this is required because windows does not cleanup the dialog by itself when its thread gets terminated"
 16679      this is required because windows does not cleanup the dialog by itself when its thread gets terminated"
 16680 
 16680 
 16681 %{  /* STACK: 100000 */ 
 16681 %{  /* STACK: 100000 */ 
 16682     if (__isExternalAddress(dataAddress)) {
 16682     if (__isExternalAddress(dataAddress)) {
 16683 	    fileDialogData *pFdd = __externalAddressVal(dataAddress);
 16683         fileDialogData *pFdd = __externalAddressVal(dataAddress);
 16684 		DWORD fileDialogThreadId = pFdd->fileDialogThreadId;
 16684         DWORD fileDialogThreadId = pFdd->fileDialogThreadId;
 16685 		
 16685                 
 16686 		if (fileDialogThreadId != 0) {
 16686         if (fileDialogThreadId != 0) {
 16687             EnumWindows(enumWindowsToFindAndDestroyFileDialogProc, fileDialogThreadId);
 16687             EnumWindows(enumWindowsToFindAndDestroyFileDialogProc, fileDialogThreadId);
 16688 		}
 16688         }
 16689         if (__isExternalAddress(threadHandleAddress)) {
 16689         if (__isExternalAddress(threadHandleAddress)) {
 16690             HANDLE fileDialogThread = _HWNDVal(threadHandleAddress);
 16690             HANDLE fileDialogThread = _HWNDVal(threadHandleAddress);
 16691             TerminateThread(fileDialogThread, 0); 
 16691             TerminateThread(fileDialogThread, 0); 
 16692             CloseHandle(fileDialogThread);
 16692             CloseHandle(fileDialogThread);
 16693         };  
 16693         };  
 16695         free(pFdd);
 16695         free(pFdd);
 16696     }
 16696     }
 16697 %}.
 16697 %}.
 16698 
 16698 
 16699     "Created: / 22-10-2018 / 13:53:02 / sr"
 16699     "Created: / 22-10-2018 / 13:53:02 / sr"
       
 16700     "Modified: / 22-10-2018 / 15:07:54 / sr"
 16700 !
 16701 !
 16701 
 16702 
 16702 primGetNativeFileDialogResultByDataAddress:dataAddress
 16703 primGetNativeFileDialogResultByDataAddress:dataAddress
 16703     "returns nil if the native file dialog is still open
 16704     "returns nil if the native file dialog is still open
 16704      returns an empty string if the file dialog was canceled
 16705      returns an empty string if the file dialog was canceled
 16733 
 16734 
 16734     |fileDialogDataAddress fileDialogThreadHandle|
 16735     |fileDialogDataAddress fileDialogThreadHandle|
 16735 
 16736 
 16736 %{  /* STACK: 100000 */ 
 16737 %{  /* STACK: 100000 */ 
 16737     int i;
 16738     int i;
 16738     fileDialogData *pFileDialogData = malloc(sizeof(fileDialogData));
 16739     fileDialogData *pFdd = malloc(sizeof(fileDialogData));
 16739     ZeroMemory(pFileDialogData, sizeof(fileDialogData)); 
 16740     ZeroMemory(pFdd, sizeof(fileDialogData)); 
 16740 
 16741 
 16741     if (__isUnicode16String(defaultFilename)) {
 16742     if (__isUnicode16String(defaultFilename)) {
 16742         for (i = 0; i < __unicode16StringSize(defaultFilename); i++) {
 16743         for (i = 0; i < __unicode16StringSize(defaultFilename); i++) {
 16743             pFileDialogData->filename[i] = __unicode16StringVal(defaultFilename)[i];
 16744             pFdd->filename[i] = __unicode16StringVal(defaultFilename)[i];
 16744         }
 16745         }
 16745         pFileDialogData->filename[i] = 0;
 16746         pFdd->filename[i] = 0;
 16746     };        
 16747     };        
 16747     if (__isUnicode16String(dialogTitle)) {
 16748     if (__isUnicode16String(dialogTitle)) {
 16748         for (i = 0; i < __unicode16StringSize(dialogTitle); i++) {
 16749         for (i = 0; i < __unicode16StringSize(dialogTitle); i++) {
 16749             pFileDialogData->title[i] = __unicode16StringVal(dialogTitle)[i];
 16750             pFdd->title[i] = __unicode16StringVal(dialogTitle)[i];
 16750         }
 16751         }
 16751         pFileDialogData->title[i] = 0;  
 16752         pFdd->title[i] = 0;  
 16752     };         
 16753     };         
 16753     if (__isExternalAddress(owningViewId)) {
 16754     if (__isExternalAddress(owningViewId)) {
 16754         pFileDialogData->owningWindow = _HWNDVal(owningViewId);
 16755         pFdd->owningWindow = _HWNDVal(owningViewId);
 16755     };  
 16756     };  
 16756     if (__isUnicode16String(filterString)) {
 16757     if (__isUnicode16String(filterString)) {
 16757         for (i = 0; i < __unicode16StringSize(filterString); i++) {
 16758         for (i = 0; i < __unicode16StringSize(filterString); i++) {
 16758             pFileDialogData->filter[i] = __unicode16StringVal(filterString)[i];
 16759             pFdd->filter[i] = __unicode16StringVal(filterString)[i];
 16759         }
 16760         }
 16760         pFileDialogData->filter[i] = 0;  
 16761         pFdd->filter[i] = 0;  
 16761     };   
 16762     };   
 16762     if (__isInteger(filterIndexArg)) {
 16763     if (__isInteger(filterIndexArg)) {
 16763         pFileDialogData->filterIndex = filterIndexArg;
 16764         pFdd->filterIndex = filterIndexArg;
 16764     }
 16765     }
 16765     pFileDialogData->trueForSave = doSave == true;
 16766     pFdd->trueForSave = doSave == true;
 16766     pFileDialogData->fileDialogDidReturn = FALSE;
 16767     pFdd->fileDialogDidReturn = FALSE;
 16767 
 16768 
 16768     fileDialogDataAddress = __MKEXTERNALADDRESS(pFileDialogData);   
 16769     fileDialogDataAddress = __MKEXTERNALADDRESS(pFdd);   
 16769     fileDialogThreadHandle = __MKEXTERNALADDRESS(openFileDialogInNewThread(pFileDialogData));
 16770     fileDialogThreadHandle = __MKEXTERNALADDRESS(openFileDialogInNewThread(pFdd));
 16770 %}.
 16771 %}.
 16771 
 16772 
 16772     ^ Array
 16773     ^ Array
 16773         with:fileDialogDataAddress
 16774         with:fileDialogDataAddress
 16774         with:fileDialogThreadHandle
 16775         with:fileDialogThreadHandle
 16775 
 16776 
 16776     "Created: / 22-10-2018 / 13:31:46 / sr"
 16777     "Created: / 22-10-2018 / 13:31:46 / sr"
       
 16778     "Modified: / 22-10-2018 / 15:11:47 / sr"
 16777 ! !
 16779 ! !
 16778 
 16780 
 16779 !WinWorkstation methodsFor:'native widget support'!
 16781 !WinWorkstation methodsFor:'native widget support'!
 16780 
 16782 
 16781 nativeDialogs
 16783 nativeDialogs