Hi,

I am working on an application in which I reuse the same dialog for performing 
different tasks. I have a PUBLIC INTEGER variable(named dialogType) in the 
dialog's .class file. When creating instances of this dialog I set the 
DialogInstance.dialogType to the value(0,1,2,...) which indicates the purpose 
of the dialog. The value of DialogInstance.dialogType is used within the dialog 
to decide what to do with the user input.

I am using numeric values to indicate the dialog type. This isn't very elegant. 
I am looking for the Gambas equivalent of doing a #define CHARCONST value in C.

I have tried using a Collection.

DIM DialogType AS NEW Collection
DialogType["SomeType0"] = 0
DialogType["SomeType1"] = 1
DialogType["SomeType2"] = 2
DialogType["SomeType3"] = 3
DialogType["SomeType4"] = 4

I am thinking of placing the collection's definition in a Module and then using 
it to replace the numeric constants:
DIM DialogInstance as DialogName
DialogInstance = NEW DialogName
DialogInstance.dialogType = ModuleName.DialogType["SomeType0"]
'current code
'DialogInstance.dialogType = 0

Is there a better way of using character constants in Gambas?

Gambas 2.21/Debian 6

Thanks,
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to