The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Reusable SLX Classes
Posted: 21 Jul 06 8:51 AM
|
fiogf49gjkf0d I've been coding up some classes for general use and I was wondering if there was a way to make Architect's Intellisense pickup the class structure. Is this only for Sales Logix default classes or am I just missing somthing? |
|
|
|
Re: Reusable SLX Classes
Posted: 21 Jul 06 2:25 PM
|
fiogf49gjkf0d Let's take "SLX Database Support" as an example of how SLX does things. If you look at the SLX_DB class, it is precisely how I define all of my classes. I use public and private methods where necessary to segregate the information. I keep ALL of my information contained within each class, just like Ryan's History example on this very site (I cheated and used his as a base for all of my work, tweaking as I went).
Intellisense does not work for the SLX_DB class and I can illustrate this by going to this line in the GetFields() function: Set objRS = objSLXDB.GetNewRecordset
If I were to simply type objSLXDB(period) I would get no Intellisense. Why does this not show up yet GetFields() shows up perfectly? Two simple keywords: public and private. If you omit public, intellisense works but if you include that or the private keyword it doesn't show up.
Personally I consider this a bug. The SLX_DB class was introduced in 6.2 and they were obviously aware of this issue because of the way the SLX Database Support script is laid out. The evidence suggests that SLX is going to address the issue at some point, otherwise they would have removed the public keyword from GetNewConnection and every other class they've designed and said "It's functioning as designed if you omit those keywords". It could also be considered a very minor bug to them that may not get fixed until v9. Since I don't have access to the known issues list for v7 beta I'm not even sure this is on their radar. |
|
|
|
Re: Reusable SLX Classes
Posted: 21 Jul 06 5:32 PM
|
fiogf49gjkf0d For those that appreciate brevity: exclude the public identifier on your members and intellisense works.
Timmus |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 10:52 AM
|
fiogf49gjkf0d I removed all of the public and private statements from my members, functions and properties. Also the class itself has no public declaration. The intellisense still does not pickup my object's structure. I'm using 6.2.4. Just as a test I created a simple test class
Class Test Sub TestMethod() End Sub End Class
I saved the class, and included it in another script. Then I created a new instance of the Test class and afterwards I tried to call the TestMethod method. No intellisense.
Dim test test = new Test() Test.TestMethod
I kept it simple to avoid any outside influence. Is there anything I'm obviously doing wrong? Or any additional thoughts as to why the class isn't showing up in Intellisense? |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 11:19 AM
|
fiogf49gjkf0d Class members will not show up with Intellisence, regardless of private/public. Getfields shows up because it is not a member of the SLX Database class object. |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 11:27 AM
|
fiogf49gjkf0d Originally posted by Doug Miller
Class members will not show up with Intellisence, regardless of private/public. Getfields shows up because it is not a member of the SLX Database class object. |
|
So the final answer is that you can not create a class that shows up in Intellisense? |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 1:53 PM
|
fiogf49gjkf0d Try this: Dim objectTest (I like knowing it's an object, and there's not much of a character restriction on names) set objectTest = new Test Test.TestMethod or with Test .TestMethod wend
Classes are object instances, so they need the set command. Also notice no () after Test as I have never done that in enumerating my classes. Even though I include a Class_Initialize() method which should be the constructor that would house the parameters, I don't think you're allowed to pass construction parameters to a class. Then again, it may be that I simply never tried it.
Also my knowledge tends to stick to a particular version. I'm not on SP4 yet and I don't think they changed anything in this area between SP3 but I may be relying on SP2 or prior knowledge since I haven't really done any major tweaking since then (we upgraded right after SP2 dropped, so I did a lot of prodding in that version).
Timmus: I'll try to include a short version from now on, since I tend to rant about things I consider bugs. It tends to occure more when I'm not sure this is even a blip on the developer's to-do list. |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 2:09 PM
|
fiogf49gjkf0d Originally posted by Chris Erichson
So the final answer is that you can not create a class that shows up in Intellisense? |
|
Correct, you will not be able to create a class that shows up with Intellisense. |
|
|
| |
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 2:12 PM
|
fiogf49gjkf0d Originally posted by Jeremy Brayton
Also my knowledge tends to stick to a particular version. I'm not on SP4 yet and I don't think they changed anything in this area between SP3 but I may be relying on SP2 or prior knowledge since I haven't really done any major tweaking since then (we upgraded right after SP2 dropped, so I did a lot of prodding in that version).
|
|
Bah I'm not all here today. This paragraph is in reference to my observation that by omitting the public keyword, Intellisense worked. It worked during testing at one point but my mind is so jumbled it may have been some 6.1 stuff bubbling up to the surface.
I just tested this in SP3 and omitting the public/private keyword does nothing differently. I also have properties that won't show up in Intellisense either so I'd say it looks like something we'll be living with for a while, though it would be a nice thing to have sooner rather than later. |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 2:23 PM
|
fiogf49gjkf0d Originally posted by Jeremy Brayton
Bah I'm not all here today. This paragraph is in reference to my observation that by omitting the public keyword, Intellisense worked. It worked during testing at one point but my mind is so jumbled it may have been some 6.1 stuff bubbling up to the surface.
I just tested this in SP3 and omitting the public/private keyword does nothing differently. I also have properties that won't show up in Intellisense either so I'd say it looks like something we'll be living with for a while, though it would be a nice thing to have sooner rather than later. |
|
Yes, Intellisense would be nice to have, but I believe Sage has hardcoded the Intellisense we do get (so application. works). Something I do consider a bug is that private methods of your classes will show up in the include scripts listing, while properties don't show at all. |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 2:34 PM
|
fiogf49gjkf0d Sorry for the poor example. I should have re-looked at what was posted. But in any case, thanks for the clarification. |
|
|
|
Re: Reusable SLX Classes
Posted: 24 Jul 06 2:55 PM
|
fiogf49gjkf0d Originally posted by Timmus Agersea
I was just poking fun, Jeremy.
BTW I am not sure what your example above is attempting to prove regarding intellisense? I believe Doug is correct and that intellisense does not work on any members of our custom classes. In fact, it doesn't work on any object and I assume that is because of late binding (but I am guessing ). Try this code:
dim oRS set oRS = CreateObject("ADODB.Recordset") oRS.
You will be waiting for a long time if you wait for intellisense to kick in after the period.
|
|
Kick me while I'm down, I see how it is . I wasn't offended by any means, I should try to keep things short any way since it's seemingly difficult to portray what I mean in paragraph form.
My example was flawed as you mention but I mentally draw a line in the sand between a CreateObject instance and a include script class that is parsed before intellisense even begins to fire. To find the properties of an object enumerated by CreateObject, you would need some kind of reflection which I don't think is possible with VBScript. To find the properties of an object enumerated through an include script, the intellisense would just need to know that the property keyword defines a property, and the public keyword defines what methods it should "see" (though one could argue private methods should be seen, perhaps in a different color).
Originally posted by Doug Miller
Yes, Intellisense would be nice to have, but I believe Sage has hardcoded the Intellisense we do get (so application. works). Something I do consider a bug is that private methods of your classes will show up in the include scripts listing, while properties don't show at all. |
|
You brought up memory about the listing. It wasn't until 6.2 that classes even had methods showing up in the listing. I'd have about 5 class scripts that looked like there was nothing in either of them.
So this does suggest that Intellisense is very much in Sage's court and not some 3rd party developer who threw together a VBScript parser in a weekend. |
|
|
|