[Gambas-user] Modules
B Bruen
bbruen at ...2308...
Tue Sep 16 01:02:46 CEST 2014
On Tue, 16 Sep 2014 00:03:22 +0200
Benoît Minisini <gambas at ...1...> wrote:
> Le 15/09/2014 23:52, John Leake a écrit :
> >>
> >> Private by default. It's like a class, except everything is static.
> >>
> > So if I have a module containing some general purpose functions that I
> > wish to share across all the forms in a project, can simply declare
> > these functions as Public within the module ?
> >
>
> Yes.
>
> --
> Benoît Minisini
>
Also, if you need to share objects around the various parts of the project you can declare them in the module as either public variables or (if you want to add some shareable features) as properties of the module.
However, remember this: As you are accessing static features you need to explicitly use the module name qualifier when you reference them in other code.
So for example:
in module "MyUtil"
Public CurrentCustomer As CCustomer
Public Sub Execute_Current_Customer(PrejudiceLevel As Integer)
CurrentCustomer = Null
End
in, say, "FMain"
Public Sub Load(CustID)
MyUtil.CurrentCustomer.Load(CustID)
If MyUtil.CurrentCustomer.IsLatePayer then
MyUtil.Execute_Current_Customer(iExtreme)
EndIf
etc
hth
Bruce
--
B Bruen <adamnt42 at ...626...>
Note: temporary change to email address
More information about the User
mailing list