[Gambas-user] gb3: structure declaration not allowed in a different module

Fabien Bodard gambas.fr at ...626...
Sat Nov 19 10:49:49 CET 2011


2011/11/19 Randall Morgan <rmorgan62 at ...626...>:
> Couldn't you simply change this to a class with only properties and get the
> functionality you're looking for?

yep ...

structure in gambas are quite different than the vb ones.  In fact
they are internal range value. To use structure in gambas like in vb
you need to use a class like in java. Name it TClass

in gambas3 you have the possibility to arrange the classes in
directories ... use a special dir to put the TClasses in it.

Structure are only for use in stream or external api call. Maybe in
the future this way change, maybe not. Gambas evoluate slowly since 10
years so be patient. (slowly but we are always here :)  )


for us since the start a Type struct is :


'Gambas Class

Public sVar as string
Public iVal as Integer



the use

Dim hMyType as new MyType
hMyType.sVar = "toto"
hMyType.iVal = 2


etc, etc

if this explanation is not enougth please tel me exactly what yau want
to do.... There is not many things not possible in gb
>
> On Fri, Nov 18, 2011 at 11:38 PM, Kevin Fishburne <
> kevinfishburne at ...1887...> wrote:
>
>> I had structure declarations running out of my eyes and ears across
>> about 10 modules, so I decided to create a "Structures" module to
>> contain them all. Here's an example:
>>
>> ' Gambas module file
>>
>> ' Structure module
>>
>> ' General declarations.
>>
>> ' Audio effect structure.
>> Public Struct Audio_Effect  ' Structure containing one effect's data.
>>   Sample As Sound     ' Waveform data (file).
>>   Chan As Channel     ' Default channel to play on.
>>   Current As Single   ' Current amplitude.
>>   Target As Single    ' Target amplitude.
>>   Scale As Single     ' Target amplitude multiplier.
>>   Velocity As Single  ' Speed at which current amplitude is moving
>> toward target amplitude.
>> End Struct
>>
>> In the Audio module I'd have this:
>>
>> ' General declarations.
>> Public Environment[16] As Struct Structures.Audio_Effect ' Environmental
>> effects.
>>
>> When the array attempts creation I get an error saying that "Structures"
>> wasn't a structure. It also fails if I don't specify the module name
>> prefix.
>>
>> Why can't I create an array of structures in module A using a structure
>> defined in module B? Is there some workaround other than moving all my
>> structure definitions back into the modules which reference them?
>>
>> --
>> Kevin Fishburne
>> Eight Virtues
>> www: http://sales.eightvirtues.com
>> e-mail: sales at ...1887...
>> phone: (770) 853-6271
>>
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
>
> --
> If you ask me if it can be done. The answer is YES, it can always be done.
> The correct questions however are... What will it cost, and how long will
> it take?
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fabien Bodard




More information about the User mailing list