[Gambas-user] Using Character constants in Gambas

Caveat Gambas at ...1950...
Tue Mar 8 12:47:04 CET 2011


You're welcome :-)

I was thinking if you want your module to be used by others who may have
the bright idea of changing the public attributes, you should probably
code using the CONST keyword...it's also clearer that these values
should never be  changed...

PUBLIC CONST ErrorDialog AS Integer = 0
PUBLIC CONST WarningDialog AS Integer = 1
PUBLIC CONST InformationDialog AS Integer = 2
PRIVATE DefaultDialogType AS Integer = ErrorDialog
...


The following code will now produce a runtime error on the 2nd line:

  PRINT "before: " & DialogFactory.ErrorDialog
  DialogFactory.ErrorDialog = 5
  PRINT "after: " & DialogFactory.ErrorDialog

Regards,
Caveat


On Tue, 2011-03-08 at 03:07 -0800, vikram wrote:
> Hi Caveat,
> 
> Thanks, that is a lot simpler :)
> 
> Best Regards,
> Vikram Nair
> 
> 
> 
>       
> ------------------------------------------------------------------------------
> What You Don't Know About Data Connectivity CAN Hurt You
> This paper provides an overview of data connectivity, details
> its effect on application quality, and explores various alternative
> solutions. http://p.sf.net/sfu/progress-d2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list