Windows ListView control (or similar) that can have multiple columns of checkboxes? - c++

OK, so my Windows application involves a window that, among other things, has a list of objects in a pane. Each object has 8 boolean values that need to be determined — so I'd like a list of the objects, with eight columns of checkboxes after. I'm not using MFC, should that be relevant.
ListView looks the way I want it to, but apparently it doesn't accept checkboxes in SubItems (the LVS_EX_CHECKBOXES style only gives each row a checkbox on the left).
So what I need is some kind of alternative to ListView that does allow this. I've been looking, but nothing I've found seems to work.
I have seen reference to some DataGridView control, but I don't see that as an option in my Visual Studio 2010 "toolbox" — how does one access it, is it even available for non-MFC C++ projects? Most references to it seem to be for VB or C#.
Another thing I found is is this custom ListView, but it, again, seems to be for C# and not C++. I'd certainly accept suggestions on how to use this resource in my code, if there's a simple way to interface with the C# dialogue (I'm completely unfamiliar with C#).
Anyway, any thoughts, suggestions, or tips anyone has, would be most appreciated!
EDIT: This should maybe go in a new question, but it doesn't really seem deserving an entire question on its own: MFC seems to have more support for this kind of thing (insofar as most of the custom controls I can find to download are for MFC). My project does not actually require being non-MFC, it just is, at the moment. How much work am I looking at to convert it?

Well, I've taken the plunge and started using MFC; the CGridCtrl I downloaded seems to be working pretty well, though I still have a lot of work on it. I'm going to call this the answer, then, since there doesn't seem to be another forthcoming.

Related

VSIX Project - Properties tool window extension

There might be something wrong with the way I search for things but here is my problem. I'm looking for a way to implement a custom editing tool within the properties tool window in the Visual Studio editor. I've been looking through several documentation references, and they all lead to the use of different assemblies, but I can't get anything to work the way that I want.
First of all, I tried using the UITypeEditor class, with the step-by-step tuto I found here : https://learn.microsoft.com/fr-fr/dotnet/api/system.drawing.design.uitypeeditor?view=net-5.0
The problem I faced was that it only seemed to be working with Winforms projects, and I'm trying to use this with a WPF project.
Afterwards, I tried following this tutorial, in order to create a project template : https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-a-basic-project-system-part-1?view=vs-2019
This has led me to think that the methods used in the tutorial might have been either deprecated or improved with the used of AsyncPackages instead of ProjectPackages, and the appearance of the Microsoft.VisualStudio.Shell.Flavor assembly that seem to render useless the ProjectNode class (it doesn't even show up anymore, the method has been replaced with a void).
The last bit I tried exploring was the use of the ProjectSystem, as documented here : https://github.com/microsoft/VSProjectSystem
It was actually worse because I couldn't get it to work like I wanted, the project type I was creating could not register C# files and I wasn't able to add new classes (I might need to dig a bit deeper here but I don't know where to look).
So basically, I'm looking for help to extend the properties tool window, through an editor within the window, or a modal window opened by clicking on an ellipsis button in the properties window.
Thank you for reading this, if you have any info, I'm very interested.
I've actually found a thread leading to what I was trying to do here. This tutorial leads to a way to implement a customized editor, either inline, extended or in another dialog window. This was the thing I needed, and with a few tweaks I managed doing what I wanted.

Table/Grid using MFC

I just started developing an MFC application for the first time and I'm hoping to get more familiar with the whole "controls" concept. I am using the dialog editor in visual studio and so far I was not able to find functionality to add a simple table/grid. It seems quite basic to me, but I can't even find reliable information on how to do it on the internet.
I am looking for something similar to Qt's QTableWidget, something that I can later program with variable amount of rows and columns tailored to my application's use cases.
Do you have any ideas how to do it?
I use CGridCtrl which is very powerful and does a lot of the legwork for you.
Sounds like you're after a List View Control, which is wrapped by MFC's CListCtrl class. The dialog editor will enable you to add one and set its properties.

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.

mfc autosuggest textbox (like in Windows Start->Run dialog)

In Windows XP if you click Start, Run (or Windows-key + R) you get a little dialog for running things directly. If you start typing, a resizable scroll-list pops up underneath the edit-box.
I want something similar, so when a user is typing in a name to an edit-box, a list will suddenly appear if suggestions can be made. But I don't know if I need to write it all myself, or can use some existing controls/code from somewhere.
I'm currently looking at this one: http://www.codeproject.com/KB/combobox/akautocomplete.aspx Will try to remember to post my findings.
You'll have to create it yourself, IMHO. However if you google 'autosuggest textbox', you should find some examples on how to do it.
The examples might not be in in MFC though, but I'm sure they can help you along.
This one is a good start:

CMFCToolTipCtrl or CTooltipManager examples?

Has anyone tried using these new VS2008 MFC classes yet? I can't seem to find any examples anywhere. Even the VS2008 samples(1) don't mention these classes. (They use CToolTip.)
(1) Update: My mistake. I had downloaded the non-SP1 samples. I see that the SP1 samples have samples specifically for the 2008 Feature Pack, including the DlgToolTips and ToolTipDemo projects mentioned in an answer. Unfortunately, they don't address doc/view or CTooltipManager.
Specifically, I'm trying to display tooltips in a standard MFC view/document application where there are two side-by-side views whose parent is CSplitterWnd. I had this working pre-SP1, and I thought this'd be a good time to try the new Feature Pack tooltip classes.
Is there any way to make these things work without overriding PreTranslateMessage() and manually calling RelayEvent()? (I don't think I've seen anything in MFC as poorly designed as tooltips.)
It doesn't seem as simple as merely calling CTooltipManager::CreateToolTip() and then AddTool() on the created tip.
In case you haven't seen it, there is a very brief example here
Have you looked at the DlgToolTips and ToolTipDemo sample applications? These both use classes which inherit CMFCToolTipCtrl. DlgToolTips includes code that calls RelayEvent from PreTranslateMessage, but ToolTipDemo doesn't.