[Gambas-devel] Return after a dialog > end program prematurely

richard terry rterry at ...627...
Tue Feb 23 12:58:42 CET 2010


This seems really odd, perhaps it is my typing, but for a number of versions 
I've noticed this odd behaviour which I can't track down, but what is 
happening is that when  a dialog box is presented during a function that 
returns something eg boolean, then when the program continues to execute back 
in the calling routine, when it gets to the 'end' of a subroutine, the 'end' 
terminates the program and drops the user back into the IDE. If no dialog in 
the subroutine, nothing happens. Almost like the 'end' is becoming a signal to 
quit the program.

The following is a typical subroutine:

Public Sub EditArea_Buttons_Click()

  Select Case Last.tag
  Case "clear"
      Editarea_Clear()
  Case "analyse"
      Analyse_Data()
  Case "import"
      Import()
  End Select
End

Notice, that it ends with end, not end sub ?am I typing it wrong?

Now, prior to importing, I want to analyse the thousands of lines of patient 
demographic data, to make sure they all have appropriate sex, title, suburbs, 
postcodes, as legacy data is often falty, so I do this:

Public Sub Analyse_Data()
   '-------------------------------------------------------------
   'Analyse the file, point out any glaring errors but don't save
   'Display progress as we go by counter, the patients details
   'show error messages
   '-------------------------------------------------------------
    If Not Valid_Selection() Then Return 
...etc

Public Sub Valid_Selection() As Boolean
  
   If cmbDemographicSource.index = -1 Or cmbVersion.index = -1 Then
      Message.Info("Please select the source program and version before 
proceeding")
      Return False
   End If

Now, if this subroutine returns false and I step through the subroutine, when 
it gets to the 'end' statement  designated here by *****, then the program 
literally ends, and deposits me back in the IDE ( or quits if compiled)


Public Sub EditArea_Buttons_Click()

  Select Case Last.tag
  Case "clear"
      Editarea_Clear()
  Case "analyse"
      Analyse_Data()
  Case "import"
      Import()
  End Select
End ******


Any thoughts?

Regards

Richard





More information about the Devel mailing list