Grid view in MFC - c++

I've to create an application which is made up in a tabular way, with rows and columns having cells, in a grid like format. There have to be appropriate cell-level controls as well.
Because of certain constraints, this has to be done in MFC.
I tried searching for something like Grid view/tabular view in MFC, but couldn't locate it. All I managed to get were user developed libraries on other sites, but which I cannot use because of license restrictions.
As a starting point, what should I be looking for? I've worked on Qt before, but not MFC, and am fining it difficult to locate appropriate tutorials regarding grid/tabular view.
Kindly give me a starting point, or a library name for me to start looking into.
Thanks.

Either you use something open source like the ultimate grid or CGridCtrl, or you use a library like BCGSuite. You say 'cannot use because of licence restrictions' but you don't say what you mean. CGridCtrl for example can be used in commercial and free applications. For a high-quality (i.e., with support for modern features like theming), you'll need a commercial library.

Related

Windows MFC macros

I'm trying to learn the MFC to code for Windows and I've come across things like the ID_FILE_EDIT macros that are defined as being unicode values I think. I understand, I think, that the macros specify the item in the menu pulldowns. Question is, how do I define my own and where do I put them. I'm trying to get custom menus and custom menu buttons to stem from the MFC. Like I want under file 'new, open existing doc and stuff like that'. I've got VS2013 pro and all the headers I could ever want. Second question is where do I start with the MFC. Should I start by practicing making windows then pulldowns and then... something else? I know where the documentation is at and I understand where the class references are. Really just confused on using it to make my own stuff.
ID_FILE_EDIT (and other defines, like ID_FILE_NEW, ID_FILE_OPEN, etc.) are macros to specify a name for an unique resource identifier that is used to identify a menu command and/or toolbar item. They are typically defined in a header file named resource.h.
Microsoft has released a numbering and naming convention as a Technical Note (TN), because the names and values ​​represented by these macros must follow a certain pattern: http://msdn.microsoft.com/en-us/library/t2zechd4.aspx
Under normal circumstances you can use Visual-Studio's built-in resource editor to create dialogues, menus, buttons, and all the other UI stuff. These editors also assign automatically unique ID's for any resource and generate the macros.
Your second question can not be answered easily. MFC applications are a wide field, ranging from simple, dialogue-based programs to sophisticated Model-View-Controller-based applications. If you just want to play around with MFC to familiarize yourself with the basic concepts of this framework, I recommend to start with a dialogue-based app.
Regards,
Stephan
In VC++ 6.0, Insert menu - Resource - Menu. Is how you add/edit a menu.
Where is the formatting bar gone on answers.
To learn MFC basics, manually build up the Scribble example application (http://msdn.microsoft.com/en-us/library/92y4h944%28v=vs.90%29.aspx) with which whole generations of MFC programmers made their first contacts with MFC. Don't just read it, start with an empty application and gradually add the stuff as in the tutorials. It'll show you a lot. If you don't know the win32 api yet though, you may want to start with reading the Petzold from front to back. Good luck, remember that these are libaries and API's from a time when it wasn't considered unreasonable to spend 3 months full time to learn something.

Building an excel like data grid in a windows application in C++

I need to create a window application that has an excel grid that users can enter data into, via keyboard or cut and paste. I would like to be able to expand and contract it in both axes on the fly. I'm just starting out programming windows applications, so any pointers to examples or keywords that I can refine my search with, would be extremely helpful.
Thanks,
James
Take a look at The Ultimate Grid. It has lots of features.
EDIT:
It used to be a commercial product, but it was later open sourced
If you are using MFC, take a look at here for data grid control. I've used it several times and it did the job.

Look for ways to enable printing from my C++/MFC application

Since time immemorial I've been trying to avoid printing from my Windows-based applications due to the lack of native support for it. Whenever absolutely necessary I was resorting to dynamically making a simple HTML layout and then opening it in a web browser with a short Java Script in it to pop up a printing dialog for a user. Now I need to find something more substantial.
Let me explain. I have a project that deals with medical charts and it has to be able to print into those charts (at specific locations) as well as print on to a Letter/A4 size page in general. It also has to provide a preview of what is being printed in a paged-view environment.
In light of that I was wondering what is available from MFC/C++ environment (not C#) in regarding to printing?
PS. I was thinking to look into the RTF format but that seems like quite a daunting task, so I was also wondering, is there any libraries/already written code that can allow to compose/view/print RTFs? If not, what else is out there that can provide printing support like I explained above?
"lack of native support"? It's been covered by Petzold since forever, and it's integrated straight into GDI. Compared to UNIX, it's a complete breeze. And MFC makes it even easier.
Anyway, here's how you do print preview with MFC, and here's how you subsequently print. Lots of links from there, and it's all straightforward. Printers are just another Device Context on which you can draw.
I always found it very convenient to generate PDF files from my MFC/C++ application, There are many libraries out there which enable easy creation of PDF files, preview functionality and so on (also open source). I'm using this (also handles RTF):
PDF Library
There is no support like you call a framework method with some parameters and the framework prints a document or the content of a window for you. You need to manually draw everything on the printing device context. So as already said, you might find it more convenient to use a PDF generator, but of course that depends on your application requirements.
Please try www.oxetta.com , it's a free report builder solution that easily integrates into a C/C++ application.

Stock Charts in C++

I am trying to create some charts of data (eg http://www.amibroker.com/). Is there a C++ library that can do this without a lot of extra work? I'm thinking Qt or wxWindows would have something like it, but it wasn't immediately obvious.
Thanks!
FLTK is a light and portable C++ toolkit for GUI. There's a chart class. Sample.
Qwt does at least some of the things you are trying to achieve (basic plots, bar charts and so on), and integrates well with Qt.
I think you need to pick your GUI framework first, then find a charting control for the given framework, since that affects what charting controls you could feasibly use. For example, must this be portable?
For the project I'm working on (a large MFC application) we use Cedric Moonen's ChartCtrl. We've had a pretty good experience with it so far.
I've done some graph plotting with gnuplot lately, which is quite powerful. Although I think it is Linux only, which may or may not be a problem.
Also, believe it or not, some amazing things can be done with LaTeX. I've used the tkz (tikz) library to produce some awesome graphs.
Both solutions plot to a file which you can include in your interface.
They aren't C++ libraries but you can easily create the datafiles and call the necessary programs from within your C++ program (Being creative with system() and possible some shell scripts).

Need a client-side interactive 2D world map: best map package? Or best C++ graphics/canvas library to make one?

I need a 2d political map of the world on which I will draw icons, text, and lines that move around. Users will interact with the map, placing and moving the icons, and they will zoom in and out of the map.
The Google Maps interface isn't very far from what I need, but this is NOT web related; it's a Windows MFC application and I want to talk to a C++ API for a map that lives in the application, not a web interface. Ideally I don't want a separate server, either, and any server MUST run locally (not on the Internet). What canned map package or graphics library should I use to do this? I have no graphics programming experience.
This is strictly 2D, so I don't think something like Google Earth or WorldWind would be appropriate. Good vector graphics support would be cool, and easy drawing of bitmaps is important.
All the canned options seem web oriented. SDL is about all I know of for flexible canvas programming, but it seems like making my own map would be a lot of work for what is probably a common problem. Is there anything higher level? Maybe there's a way to interact with an adobe Flash object? I'm fairly clueless.
Perhaps:
http://www.codeplex.com/SharpMap
ESRI MapObjects
http://www.esri.com/software/mapobjects/index.html
ESRI MapObjects LT
http://www.esri.com/software/mapobjectslt/index.html
See
http://www.esri.com/software/mapobjectslt/about/mo_vs_lt.html
for a comparison of the two MapObjects feature sets.
ESRI may have a replacement to the MapObjects libraries
You could extend your search by using the term GIS (Geographic Information System). I'm sure its gonna be easier. There's a lot of stuff out there on that subject.
Here's a page I found: http://www.ucancode.net/Gis-Source-Code.htm
or: http://opensourcegis.org/
You might want to try the Mapnik C++/Python GIS Toolkit.
You can take a look at the Marble Widget, which is part of KDE's Marble project. There are Windows binaries for this, too, but they might be dependent on Qt.
Yes, Marble has also the advantage that it provides kind of a ready made solution in a single control (called "widget" in Qt's technical terms).
The dependency on Qt (which is the only dependency btw.) might also be seen as an advantage: Qt's upcoming version is licensed under the LGPL, so even if you plan to use this in a proprietary application then there shouldn't be any real worries. And of course Qt and Marble are cross-plattform and provide an API that is very intuitive and easy to understand. Unlike common GIS solutions the Marble API and the usage of the widget is rather focused on people who don't know much about GIS. So its usage is quite easy to understand even if you feel scared by technical terms used in GIS.
Marble offers several interfaces to programming:
You can either create your own Marble plugins and paint inside those or you can subclass the MarbleWidget control. For a simple HelloWorld application see:
http://techbase.kde.org/Projects/Marble/MarbleCPlusPlus