Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 1445: C++/CLI array class suggestions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AndyM
Junior Member

10 Posts

Posted - Apr 26 2006 :  08:00:45 AM  Show Profile  Reply with Quote
I'm using VS 2005 for forms programming in C++.
If I create an array of a class, I can not get suggestions after typing a -> (or incorrectly a .)
The VS built-in intellisense works (sometimes).

e.g:
array<arrayType^>^ m_array;
m_array = gcnew array<arrayType^>(size);
//allocate...

m_array[x]-> //no suggestions box

Edited by - AndyM on Apr 26 2006 10:24:46 AM

jorgito11
Senior Member

USA
29 Posts

Posted - Apr 29 2006 :  09:06:51 AM  Show Profile  Reply with Quote
I have had this problem but it only appears inconsistantly. It appears that both VS and WT intellisense is having problems representing both the array's members along with the array element's members. I find I have more problems with user defined classes and value types.

Edited by - jorgito11 on Apr 29 2006 09:07:40 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Apr 30 2006 :  4:46:58 PM  Show Profile  Reply with Quote
using VS2005 i have a managed C++ console project. into the main cpp file i have placed the code:

using namespace System;

class FelineTest
{
public:
    int m_nSize;
    int m_nColour;
};

int _tmain()
{
    array<FelineTest^>^ m_array;
    return 0;
}


which fails to compile, starting with the error: "'array' : undeclared identifier"
array is not in the System::Collections namespace, which fits with the statement i found online that it is a built in type. since the code will not compile i do not have a lot of faith in my testing of VA.

can someone point me in the right direction here? i do not use C++/CLI myself, i do most of my work in unmanaged C++

zen is the art of being at one with the two'ness
Go to Top of Page

AndyM
Junior Member

10 Posts

Posted - May 02 2006 :  12:31:29 PM  Show Profile  Reply with Quote

It's not easy, such a class was derived from System::Windows::Forms::Form in my case, but try doing a new CLR console App and add code like so:



#include "stdafx.h"

using namespace System;

public ref class FelineTest
{
public:
	int m_nSize;
	int m_nColour;
};


int main(array<System::String ^> ^args)
{
    Console::WriteLine(L"Hello World");
    
    array<FelineTest^>^ m_array = gcnew array<FelineTest^>(5);
    for(int a=0; a<5; a++) m_array[a] = gcnew FelineTest;

    //m_array[0]-> //no suggestions box

    return 0;
}

Go to Top of Page

jorgito11
Senior Member

USA
29 Posts

Posted - May 03 2006 :  3:21:51 PM  Show Profile  Reply with Quote
With VAssistX enabled, the following example will force intellisense to work:

array<System::Int32> ^n = { 1, 2, 3, 4 };

Console::WriteLine(n->array<int>::Length);
Console::WriteLine(n[0].Int32::MaxValue);

However, "array<int>" and "Int32" will not automatically appear. This example will compile and run.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - May 03 2006 :  6:16:44 PM  Show Profile  Reply with Quote
*grrrr* thank you for the sample code AndyM. after much arguing with VS2005 it turns out that this simply will not compile at all if the code is on a network drive. as soon as I copy the project to the local hard drive everything is fine. it would not be so bad, but the compilation errors don't give any hint of this.

have you tried this code yourself? using VS2005, a new managed C++ console project, and VA 1445 i am getting a completion listbox every time. pressing CTRL-SPACE makes it appear instantly, although it is not appearing spontaneously.

zen is the art of being at one with the two'ness
Go to Top of Page

AndyM
Junior Member

10 Posts

Posted - May 04 2006 :  07:38:48 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

*grrrr* thank you for the sample code AndyM. after much arguing with VS2005 it turns out that this simply will not compile at all if the code is on a network drive. as soon as I copy the project to the local hard drive everything is fine. it would not be so bad, but the compilation errors don't give any hint of this.



.NET and VS2005 are fun aren't they!

quote:

have you tried this code yourself? using VS2005, a new managed C++ console project, and VA 1445 i am getting a completion listbox every time. pressing CTRL-SPACE makes it appear instantly, although it is not appearing spontaneously.



yes I tried it, didn't work for me, so... interesting. thanks for the feedback.
Ctrl-space often works, but it's not ideal to use that - ideally it's redundant with Visual Assist.
Go to Top of Page

AndyM
Junior Member

10 Posts

Posted - May 04 2006 :  07:48:05 AM  Show Profile  Reply with Quote
Ok if I use "Get Content From Default Intellisense" (off by default isn't it?) then it gives me suggestions when I type ->.

But Visual Assist works much more consistently, in general, with this option off...

No conversion from . to -> (no problem but typing is faster when this is done ;) ).

Edited by - AndyM on May 08 2006 06:15:00 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - May 08 2006 :  3:21:10 PM  Show Profile  Reply with Quote
lets tackle this one problem at a time, if I may.

i have just double checked, i created a new managed C++ console project in VS2005, with VA 1445
for me, using the code from further up this thread, CTRL-SPACE produces the same list regardless of VA's default intellisense option. we should be getting the same results here.

my complete cpp (called managed_cpp_console.cpp) is:

// managed_cpp_console.cpp : main project file.

#include "stdafx.h"

using namespace System;

public ref class FelineTest
{
public:
    int m_nSize;
    int m_nColour;
};


/*
int main(array<System::String ^> ^args)
{
    Console::WriteLine(L"Hello World");
    return 0;
}
*/

int main(array<System::String ^> ^args)
{
    Console::WriteLine(L"Hello World");

    array<FelineTest^>^ m_array = gcnew array<FelineTest^>(5);
    for(int a=0; a<5; a++) m_array[a] = gcnew FelineTest;

    m_array[0]->
    //m_array[0]-> //no suggestions box

    return 0;
}



in case it matters i have single blank line at the bottom of the file. the IDE's parsing is enabled, i presume the same must be true on your system. can you try this code yourself and see what happens?

if VA is not properly understanding the code at your end, as this suggests, then we have very little hope of fixing the rest.

zen is the art of being at one with the two'ness
Go to Top of Page

AndyM
Junior Member

10 Posts

Posted - May 09 2006 :  06:32:03 AM  Show Profile  Reply with Quote
Yes CTRL-SPACE always works at this point - just no automatic popup window.

Edited by - AndyM on May 09 2006 06:32:41 AM
Go to Top of Page

jorgito11
Senior Member

USA
29 Posts

Posted - May 12 2006 :  08:24:54 AM  Show Profile  Reply with Quote
For me, CONTROL-SPACE or Auto Intellisense does not work in the code below:


public ref class FelineTest
{
public:
        int m_nSize;
        int m_nColour;

        FelineTest(int size, int colour)
                : m_nSize(size), m_nColour(colour) {}
};

int main(array<System::String ^> ^args)
{	

        array<FelineTest^> ^m_array = gcnew array<FelineTest^>
        {
                gcnew FelineTest(0, 1), 
                gcnew FelineTest(1, 2), 
                gcnew FelineTest(3, 4), 
                gcnew FelineTest(5, 6), 
                gcnew FelineTest(7, 8)
        };


        for (int i = 0; i < m_array->Length; ++i)
        {
                Console::WriteLine(L"Size={0}, Colour={1}", 
                        m_array[i]->m_nSize, m_array[i]->m_nColour);

        }
	
    return 0;
}

Edited by - jorgito11 on May 12 2006 8:52:53 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - May 16 2006 :  6:35:47 PM  Show Profile  Reply with Quote
firstly apologies for the delay in getting back to you on this AndyM, there have been various computer problems at my end.

jorgito11 thank you for this clear example, now i am seeing exactly the same problem.

case=1204

zen is the art of being at one with the two'ness
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Mar 30 2009 :  08:46:58 AM  Show Profile  Reply with Quote
case=1204 is fixed in build 1721

Whole Tomato Software, Inc.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000