self vs me

I upgraded to the current the current version of the desktop. I am now getting an error about Self. Unfortunately, I can’t copy the error message of the debugger. [quote]“Self” does not mean anything in a module method [/quote] When I look self in LR I only get the declaration and a reference to “Self vs Me” that leads nowhere.
In celltextchange I have this line of code:App.setWinMod(self, "Editing File -", App.Document.Name)
I couldn’t find any conversations that mentioned “Self”. Wierd.
How do I change this to correct code.

Does it tell location?
This could be in your code or some framework code.

tried to change the “self” in your line of code with “me” ?

It would help greatly if you posted the code in the first place. Only one cryptic line won’t help much.

What is setWinMod ? A method ?

What’s setWinMod and where is it located?
The error seems to indicate you defined the method in a module and it uses self – which will not work because a module has no object it references. Like Michel said: Please post that code and its location.

I’m writring this before I leave for work, sorry.
Self is referring to the object in that App.setWinMod(self, piece. It set as a property so I can change the property of changed.
I think I borrowed this code from someone’s posting here.

In code that is part of a window,

self = the window
me = the control on the window, or the window if the code is a window event

If the word self appears in a code-only module, there is no window to refer to.

If you did, you changed the name of the function.
But this is a good example of how copy & paste is a bad idea if you don’t actually understand what the code does.
Almost certainly you took it from code that was part of a window module, not a code module.

If it does something to a window passed into the ‘self’ parameter, then you might replace ‘self’ with the name of the window object.

In a larger sense, self always means, “the instance I’m in now.” If you are in a Window, it’s that, but if you are writing code in a class, it’s the class instance. The meaning of me can change though. In a class, it works the same as self, but in a Window, it refers to the control if you’re in that control’s event (as Jeff mentioned above), or the Window if you’re writing code outside of a control.

As a general rule, use self unless you mean to refer to a control within a Window.

In any case, both self and me are meaningless in a Module since there is no instance. Correspondingly, they are also meaningless in Shared Methods.

I don’t have a copy of my code with me. When I think about it I got the code from RealBasic programming. It’s been 10 years since I’ve set up this piece of code, so I’ll check that when I get home. Thank you for explaining me versus self. I’m pretty sure I copied the code correctly.

What is the place I report a bad link?
Self vs Me as an explanation doesn’t work

[quote=317886:@Arthur Gabhart]What is the place I report a bad link?
Self vs Me as an explanation doesn’t work[/quote]
Use the Feedback app and add a feedback report against the documentation.

Thanks. The link to the LR worked eventually.

Apologies, but I need to start over. The Debugger uses the word “Self” and if I looked for self specifically it does not show any code mentioned by the debugger. When I searched for “Self” in my program I turned up the App.setWinMod(self … stuff and it was totally irrelevant.

Restart
I have 3 properties (rather each property is an array of strings) in each window that the debugger mentions as being the source of the error [quote]“Self” does not mean anything in a module method[/quote]However, whenever I see any call to that property in the windows, I don’t use “Self”.

The Property (a consistent example)
BatchArray(-1,App.Cols) as String
This is an array of Strings
The “-1” is the initial cell of a window’s spreadsheet (BatchImport) using the array and also initial cell of an array of Strings (I hope I got all of the references correct)
App.Cols is a property meant to be universal and is very rarely changed.

App.Cols is mentioned in each error, but I don’t see why that property would be the “Self”. It is the total number of columns. Also, Cols is a constant that is set by me the programmer.
What is the “Self” or what could be wrong?

Arthur,

If you check “Break on exception” in the Project menu, the debugger will show you in the left hand side the methods and event handlers in which the error occurred, and on the right, the variables and messages.

It would help greatly if you posted the code in the method or event pointed to by the debugger.

Don’t forget to select the code and click on the code icon above the editor, to make it more legible, please.

Sorry. I pressed “Run” and I guess it is the “analysis” not debugger. It shows a stop sign with an exclamation mark. It doesn’t run. I’m not sure what to call it since it’s a pre-debugger.

In any case, this is an example of the array in use. It goes through the array from start to end. RCA2 is set to the constant (so I, the programmer, don’t have to look it up each time)

For rCA = 0 to RCA2 sts = BatchArray(RCA,0) + MnStuff.DataSep + BatchArray(RCA,1) + MnStuff.DataSep + BatchArray(RCA,2) + MnStuff.DataSep _ + BatchArray(RCA,3) + MnStuff.DataSep + BatchArray(RCA,4) + MnStuff.DataSep + BatchArray(RCA,5) _ + MnStuff.DataSep + BatchArray(RCA,6) + MnStuff.DataSep + BatchArray(RCA,7) + MnStuff.DataSep + BatchArray(RCA,8)_ + MnStuff.DataSep + BatchArray(RCA,9) + MnStuff.DataSep + BatchArray(RCA,10) + MnStuff.DataSep + BatchArray(RCA,11) ts = ts + sts + MnStuff.ParaSep Next

Arthur,

I am afraid you don’t understand. How do you expect any one of us to help without a full picture or where the error occurs ?
That loop you posted means absolutely nothing in the context of this conversation.

You are correct. I have no idea what a “Self” is since I don’t use the keyword self in this context. I also have no idea where the line error is, since it doesn’t Run. The analyzer points to a property or properties that don’t use self and in no place is Self used. I brought in code, since you mentioned lines of code and I hadn’t shown any. I figure why not. Maybe it’s in there.

Maybe I didn’t state enough of what the analyzer reported. This is more complete.

[quote]BatchImport.BatchArray(-1, App.Cols) Declaration - “Self” does not mean anything in a module method
BatchArray(-1, App.Cols) [/quote]
BatchImport is a window. Everything else has been mentioned immediately above.

I tried changing the call of the constant Cols from App.Cols to only Cols and the analyzer liked it less.

“Self” could be short for “selfie” - sorry couldn’t resist :slight_smile:

Where are you calling that from? You mentioned you imported some code from another project. Maybe on the other project “App.Cols” was valid but on this one it doesnt exist, or is not visible ( i.e. out of scope).

Cute. Nice interjection of humor.
Thanks. I am thinking of reposting this since I got misled by the analyzer/debugger.
I just upgraded from 2014 to 2016 and this error didn’t show up until now.
I have 3 properties (of some hundred) that are being flagged as errors at their declaration. They each use a constant in an array declaration.
It has something to do with it being a constant, since I changed it to another declared constant and it gave the same error.

Can you post a screenshot of the IDE when the error occurs? Guaranteed the information is right in front of you, but you’re not seeing it (this is a matter of experience, not skill). Post a pic and I’m sure someone will point to where you need to look.

Cols example
TotPrefLines example

The first screenshot is the analyzer with Cols. The 2nd is when I changed the name and the same error showed. I’m in the process of changing it from a constant. I have already (sort of) proved to myself that somewhere in the platform there’s an error. I removed the constant and added a property. Now I have a lot of other errors (from castings?), but that error disappeared.
If you have other ideas, I’m open