Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1445: C++/CLI array class suggestions

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
AndyM Posted - Apr 26 2006 : 08:00:45 AM
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
12   L A T E S T    R E P L I E S    (Newest First)
support Posted - Mar 30 2009 : 08:46:58 AM
case=1204 is fixed in build 1721
feline Posted - May 16 2006 : 6:35:47 PM
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
jorgito11 Posted - May 12 2006 : 08:24:54 AM
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;
}
AndyM Posted - May 09 2006 : 06:32:03 AM
Yes CTRL-SPACE always works at this point - just no automatic popup window.
feline Posted - May 08 2006 : 3:21:10 PM
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.
AndyM Posted - May 04 2006 : 07:48:05 AM
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 ;) ).
AndyM Posted - May 04 2006 : 07:38:48 AM
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.
feline Posted - May 03 2006 : 6:16:44 PM
*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.
jorgito11 Posted - May 03 2006 : 3:21:51 PM
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.
AndyM Posted - May 02 2006 : 12:31:29 PM

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;
}

feline Posted - Apr 30 2006 : 4:46:58 PM
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++
jorgito11 Posted - Apr 29 2006 : 09:06:51 AM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000