Hi all, I've created a user-control, which resides in library of other controls I use in my application. The control has two or three textboxes and some drawn graphics. I've put this control in my main application and it basically works fine. Next I have a class, and I create an instance which stores my data and I serialise this class to file for use later on. The user-control is used to change the values in this object and I do that using an event which is fired when the TextChanged event occurs. What makes it more complicated is I can have multiple instances of the class which I need to switch between and the user-control needs to display the data in the textboxes for the objectI've selected. My problems see to start when I reload my serialized file or switch between the objects. So for example, when I initialise the control I do: usercontrol.textboxA = X.GetParamA; usercontrol.textboxB = X.GetParamB; When I switch between say object X and Y I do usercontrol.textboxA = Y.GetParamA; // This can cause issues as TextChanged is called usercontrol.textboxB = Y.GetParamB; When the user changes a value in the textbox I fire the event which is caught in the form containing the user-control I do: // Get selected object X or Y in this case Y.GetParamA = usercontrol.textboxA; Y.GetParamB = usercontrol.textboxB; This really doesn't feel like the right way to tackle this and I fear my design is off. I though of passing in a reference to my objects or maybe there is a better way to use the events... Any suggestions would be great. Thanks
_Tom_
Posts
-
.NET Form -
Using a C++ Static Library in C# code??Hi I'm currently developing a windows application in c#. I have a set of static libraries written in c++ which I used in a VC++ application. The libraries have numerous classes which would be useful. So I'd like to instantiate object of these classes in my c# code. The question is should I discard the libraries and re-write the code or can I make this into managed code or can I leave it and use it as is. Any suggestions would be great! Cheers
-
Creating a PDF fileThanks, I visited Adobe and the reference material is quite good, however it lacks real world examples, e.g. if you'd like to create a table or insert an image things start to go wrong very quickly. Also I created a pdf by printing a word document through a driver I found and if you open the file in textpad you cant see any of the text, as if its been hidden away or encoded in some way. There seems to be a variety of Libraries out there and Text3PDF on code project is very good but I'd really like to create my own library, so I dont have to worry about license fees, having my own license updated or pay royalities. This really seems to be a tricky area... Thanks for all the help tho, as it really helpful.
-
Creating a PDF fileHi I have a need to generate reports, in PDF, in my VC++ application. I've seen numerous libraries that will take the pain away and make my life easier but I'd like to create my own library that will allow me to generate these reports. If anyone could point me in the direction of some examples or tutorials I would be grateful. Thanks
-
Changing Active ViewHi Thanks for the suggestion of using MDIActivate, unfortunately this doesn't seem to do trick when I call the following: pMainFrm->MDIActivate((CWnd*)pView); Where pView is a pointer to the view I want to activate and bring to the front of all other view windows. I was wondering if I should be casting here and whether I had used the function correctly. Thanks Tom
-
Changing Active ViewDear All, I have a MDI application and I'm currently trying to programmatically change the active view. So in sort I have a combo box on my toolbar which list the views currently open. When I select a different view in this combobox I want that view to come into focus. Basically it should do exactly the same as selecting the view from the 'Window' main menu option. I have tried sending the WM_MDIACTIVATE message to the main frame but this doesn't seem to work. Any suggestions would be gratefully received. Many thanks Tom
-
SerializationHi all, I have strange error during serialization. I do the following: ar << m_nTime; // (Value typically > 120000) ar << m_bFlag; // (type BOOL) and the m_bFlag always returns as 0; If I do the following: ar << m_nTime; int tmp; tmp = m_bFlag ? 1 : 0; ar << tmp; everything works fine. I'm certainly a little confused and if anyone has some ideas that would be great. Thanks Tom
-
.NETThats great, thanks for the pointer...
-
.NETDear all, I'm just starting out in .NET and creating a simple application to store the personel information on staff, e.g. name, address, age etc etc. My question is which would be the best storage for this type of information. I'm considering XML or a database. The application will be run on a single machine so it just needs to be something simple. It would be nice to be able to load the information into Excel too... Any pointers would be a real help so I start down the right path. Many thanks Tom
-
CDC memory leakHi all, I'm stuggling to resolve a memory leak. The code below gets updated every few seconds and changes the image displayed depending on the state of m_bOn.. CDC* pDC = CDC::FromHandle( lpDrawItemStruct->hDC ); if ( pDC ) { CRect rect = lpDrawItemStruct->rcItem; int nSavedDC = pDC->SaveDC(); pDC->SelectStockObject( NULL_BRUSH ); pDC->FillSolidRect( rect, ::GetSysColor( COLOR_BTNFACE ) ); if( m_bOn ) { pDC->BitBlt( m_ptCentre.x, m_ptCentre.y, m_nWidth, m_nHeight, &m_dcMem, 1 * m_nWidth, 0, SRCCOPY ); } else { pDC->BitBlt( m_ptCentre.x, m_ptCentre.y, m_nWidth, m_nHeight, &m_dcMem, 0 * m_nWidth, 0, SRCCOPY ); } pDC->RestoreDC( nSavedDC ); } I know the leak is here somewhere but I can't see what would be wrong! I'd really appreciate some help or some pointers in the right direction. Many thanks Tom
-
ChartingHi all, I am currently trying to find a charting package for our VC++ application. We have a requirement to display data in line, area, scatter, and possibly 2d contour maps. We are displaying large amounts of data which means refreshing quarter of million points in a scatter plot becomes very time consuming. I would be grateful if anyone could recommend any charting packages which may help. Many thanks in advance...
-
Compiling VC++ application on VC7Hi I seem to having a number of issues when I try to compile my VC++ VC6 application of VC7. The main error I get is: error C2065: 'alloca' : undeclared identifier c:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include\cstringt.h line 187 Any ideas?? Many thanks Tom
-
Virtual Com Port (C++)Hi Could anyone point me in the direction of information regarding the creation of a virtual com port. I have searched with little success... Many thanks Tom