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

Fabien Bodard gambas.fr at ...176...
Thu Feb 25 12:33:24 CET 2010


  If cmbDemographicSource.index = -1 Or cmbVersion.index = -1 Then
     Message.Info("Please select the source program and version before
proceeding")
     Return False
  else
     Return True
  End If

2010/2/23 richard terry <rterry at ...627...>:
> 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
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>




More information about the Devel mailing list