Wish Process_Globals in class modules

Misterbates

Active Member
Licensed User
I have a few classes where the Initialize method takes a number indicating the "type" of class instance to instantiate, e.g.
B4X:
Public Sub Initialize(vCallback As Object, DialogType As Int)

I'd like to be able to enumarate (and make visible) values for the DialogType within the class module itself
B4X:
Public const DIALOGTYPE_TOAST As Int = 0
Public const DIALOGTYPE_MESSAGE As Int = 1

This doesn't work at present however because class modules only have a Class_Globals Sub and that Sub is not called until Initialize is executed ... which makes it difficult to pass one of the valid values to the initialize sub!

I'd like to request a PROCESS_GLOBALS sub be available in class modules. Anything declared in the sub would be treated in the same way as other PROCESS_GLOBALS subs - the values would be available to all other subs and would be initialized at the start of execution. Note that this effectively means that these variables would be "class factory" variables rather than "class instance" variables - but that would work great for the above requirement.

To use one of the variables, other code could either use Classname.VariableName or ClassInstanceName.VariableName
 

Misterbates

Active Member
Licensed User
Yep, that's what I've done (I called it {ClassName}Const) ... sure would be nice to include "externally visible" class constants with the class though :)
 
Top