[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Placing the x-coordinate of the cursor in a variable

Posted on 2004-08-11
3
Medium Priority
?
144 Views
Last Modified: 2010-05-18
To test whether I indeed have the value of the x-coordinate placed in the variable X upon clicking on the form I create a project with the following code in it:


private: System::Void Form1_MouseDown(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)                     
                  {
               points->Add( __box( Point( e->X, e->Y ) ) );
               MessageBox::Show( e->X.ToString(), e->Y.ToString());
                  }

with the following included in the IntializeComponent function:

this->MouseDown += new System::Windows::Forms::MouseEventHandler(this, Form1_MouseDown);


Above code works very well.

However, when placing the same code (except for the change of the name of the form) in my main project within the form (say, plotting.h) the same:


private: System::Void plotting_MouseDown(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)                     
                  {
            points->Add( __box( Point( e->X, e->Y ) ) );
                MessageBox::Show( e->X.ToString(), e->Y.ToString() );
                  }

and

this->MouseDown += new System::Windows::Forms::MouseEventHandler(this, plotting_MouseDown);


gives me the following errors:

plotting1.h(193): error C2065: 'points' : undeclared identifier
plotting1.h(193): error C2227: left of '->Add' must point to class/struct/union

Notice that upon compiling even the name of the form is changed from plotting.h to plotting1.h. What could be the reason for that?
0
Comment
Question by:judico
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:judico
ID: 11778895
I just fixed it. I've forgotten to place 'using namespace <whatever>;' in plotting1.cpp. The rest of the code is

private: System::Void plotting1_MouseDown(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)                     
                  {
               points->Add( __box( Point( e->X, e->Y ) ) );
             MessageBox::Show( e->X.ToString(), e->Y.ToString() );
                  }

with

this->MouseDown += new System::Windows::Forms::MouseEventHandler(this, plotting1_MouseDown);
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11859259
User resolved; closed, 250 points refunded.

Netminder
Site Admin
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question