Hello Peter,

Wednesday, April 24, 2002, 6:29:02 AM, you wrote:

DPW> Greetings List,

DPW> I am wondering if anybody has come across the following problem to do with
DPW> dialog controls

DPW> In simple terms, I have a dialog box with 4 controls (EditText, Button,
DPW> CancelButton & OKButton)

DPW> Pressing the Button calls the FileOpenDlg box allowing you to choose a file,
DPW> which is returned and displayed it in the EditText box.

DPW> If I open the dialog box, select a file by pressing the button which calls
DPW> FileOpenDlg which returns the selected filename to the EditText box then
DPW> close the dialog box by pressing Ok it works fine until I exit the dialog
DPW> with the CancelButton. 

DPW> Then the next time I open the dialog after pressing the CancelButton the
DPW> only way I seem to be able to get the filename to be returned to the
DPW> EditText box is to switch to another application then switch back to mapinfo
DPW> before pressing the Button . Everything works fine again until the next time
DPW> I exit the dialog with the CancelButton.
Hello!

I never met this problem in my practice. Take a look at code below,
likely it works. I did not test it yet, because have not MapInfo on my computer right
now, so be attentive.

Function SelectFileName() As String
 Dim s_filename As String                           
 '------------------------------                    
 'Dialog                                            
 '------------------------------                    
 Dialog                                             
       Title "Select File Name"                     
       Width 256 Height 40                          
       Control OKButton                             
               Title "OK"                           
               Position 5, 20                       
               Width 50 Height 15                   
       Control CancelButton                         
               Title "Cancel"                       
               Position 57, 20                      
               Width 50 Height 15                   
       Control EditText                             
               ID 100                               
               Value ""                             
               Into s_filename                      
               Position 4, 4                        
               Width 148 Height 13                  
       Control Button                               
               Title "..."                          
               Position 154, 3                      
               Width 50 Height 15                   
               Calling ShowFileOpenDialog           
                                                    
 If CommandInfo(CMD_INFO_DLG_OK) = 1 Then           
    SelectFileName = s_filename                     
 Else                                               
    SelectFileName = ""                             
 End If                                             
End Sub                                             
                                                    
Sub ShowFileOpenDialog                              
 Dim s_filename As String                           
 s_filename = FileOpenDlg("","","*","Open Table")
 If s_filename <> "" Then                           
  Alter Control 100 Value s_filename                
 End If                                             
End Sub                                             

-- 
Best regards,
Vladimir Lashin
microOLAP Technologies LLC
mailto:[EMAIL PROTECTED]
http://www.microolap.com/gis/ - GIS related products



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to