[Gambas-user] R: Struct declaration scope and array of Struct

Ru Vuott vuott at ...325...
Sat Jan 26 02:34:08 CET 2013


> 
> 1. Even if I declare a *Public* Struct, all other classes in
> which I try to
>    use this Struct give me an error about an
> unknown identifier. In what
>    regard is the Struct 'global'?
> 

You have declare also "Public" the variable of relative Structure type.

Example.

In FMAIN I have:
***********
Public class1 As New Class1  ' secondary Class


Public Struct structura    ' my Structure
  a As Byte
  b As Integer
End Struct


' Now the variable of Structure type:

 ***Public*** variabilis As New Structura  <-------



Public Sub Form_Open()

  With variabilis
    .a = 2
    .b = 1000
  End With

   class1.prova()

End


''''''''''''''''''''''

In Class1 I have:


Public Sub prova()

  With FMain.variabilis
    Print .a
    Print .b
  End With
  
End


Well, in my console I see:

2
1000

''''''''''''''''''''''''''''''''''
Obviously, symbols of modules and Form controls have to be Public in the project.




More information about the User mailing list