S Smee Well-Known Member Licensed User Longtime User Jun 27, 2012 #1 I have this type in 3 different modules 2 are like this Type RowCol (Row As Int, Col As Int) in one of them it is as follows Code: Copy 'Cells row,col and key data Type RowCol ( Row As Int,Col As Int,Key As Int) the program compiles in all versions before 2.00 but in 2 I get the error Code: Copy Compiling code. Error Error parsing program. Error description: An item with the same key has already been added. Occurred on line: 42 Type RowCol (Row As Int, Col As Int) I tried to comment 2 of them out but then the compiler does not recognise the type
I have this type in 3 different modules 2 are like this Type RowCol (Row As Int, Col As Int) in one of them it is as follows Code: Copy 'Cells row,col and key data Type RowCol ( Row As Int,Col As Int,Key As Int) the program compiles in all versions before 2.00 but in 2 I get the error Code: Copy Compiling code. Error Error parsing program. Error description: An item with the same key has already been added. Occurred on line: 42 Type RowCol (Row As Int, Col As Int) I tried to comment 2 of them out but then the compiler does not recognise the type
klaus Expert Licensed User Longtime User Jun 27, 2012 #2 Where did you declare the Types, in Process_Globals or Globals ? If declared in Globals it should work. Best regards. Upvote 0
Where did you declare the Types, in Process_Globals or Globals ? If declared in Globals it should work. Best regards.
S Smee Well-Known Member Licensed User Longtime User Jun 27, 2012 #3 Two were declared in Globals one in process I changed that to globals but it did not fix the problem Upvote 0
stevel05 Expert Licensed User Longtime User Jun 27, 2012 #4 I just did a small test, the type declaration is available to all modules if you declare it in Globals or Process_Globals, you are getting the error because you have changed the signature and added a third parameter. I seem to remember reading about this somewhere in the recent documentation, but can't find it now. Upvote 0
I just did a small test, the type declaration is available to all modules if you declare it in Globals or Process_Globals, you are getting the error because you have changed the signature and added a third parameter. I seem to remember reading about this somewhere in the recent documentation, but can't find it now.
S Smee Well-Known Member Licensed User Longtime User Jun 27, 2012 #5 yes i changed the names of all 3 declarations and the program compiled. I guess the dim in one module must "run through" all modules now. Have to remember that for future programs Upvote 0
yes i changed the names of all 3 declarations and the program compiled. I guess the dim in one module must "run through" all modules now. Have to remember that for future programs
stevel05 Expert Licensed User Longtime User Jun 27, 2012 #6 It's not the dim that is carried over, that will be governed by the normal rules. i.e. in Process_Globals it will be accessible everywhere but cannot involve a type that has Activity objects. In Globals it will be available only in that module. It is the Type declaration itself that is available everywhere regardless of which globals it is entered in. Upvote 0
It's not the dim that is carried over, that will be governed by the normal rules. i.e. in Process_Globals it will be accessible everywhere but cannot involve a type that has Activity objects. In Globals it will be available only in that module. It is the Type declaration itself that is available everywhere regardless of which globals it is entered in.
S Smee Well-Known Member Licensed User Longtime User Jun 28, 2012 #7 Thanks for clarification Steve, So it is probably better to have a Single Code Module where Types are declared and then they can be accessed by all modules. Would this be a correct assumption? Upvote 0
Thanks for clarification Steve, So it is probably better to have a Single Code Module where Types are declared and then they can be accessed by all modules. Would this be a correct assumption?
stevel05 Expert Licensed User Longtime User Jun 28, 2012 #8 That seems reasonable, or at least make sure you only declare the type once. Whether it's in a separate module or an activity/code module/class that it's most relevant to. Now of course what I didn't try was to make a type private. That's one for tomorrow I think. Sent from my HTC Sensation XE with Beats Audio Z715e using Tapatalk 2 Upvote 0
That seems reasonable, or at least make sure you only declare the type once. Whether it's in a separate module or an activity/code module/class that it's most relevant to. Now of course what I didn't try was to make a type private. That's one for tomorrow I think. Sent from my HTC Sensation XE with Beats Audio Z715e using Tapatalk 2
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2012 #9 A type cannot be private. Once declared it is available everywhere (similar to Class modules). Upvote 0
stevel05 Expert Licensed User Longtime User Jun 28, 2012 #10 Thanks Erel, I thought that might be the case. Upvote 0
eps Expert Licensed User Longtime User Jun 28, 2012 #11 I had a similar problem last night, but it was because of a duplicated code module, that I didn't use. The previous version, 1.8 compiled the code fine, but 2.0 is a little tighter on the checking. I would check that you haven't got a code module of a different name which declares the variables all over again.. Well that was the error I had and resolved it! HTH Upvote 0
I had a similar problem last night, but it was because of a duplicated code module, that I didn't use. The previous version, 1.8 compiled the code fine, but 2.0 is a little tighter on the checking. I would check that you haven't got a code module of a different name which declares the variables all over again.. Well that was the error I had and resolved it! HTH