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:
Related
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.
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.
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.
What is the best way for, using WinApi, find a given control in a external program window?
For example, I'm trying to change Internet Explorer's url text box. I am having trouble getting programatically the handle to the text box. I know its type is "Edit" but I'd like to avoid having to search through all the child windows for the "Edit" control (that's how I'm currently doing).
Is there any kind of unique identifier for a given control on a window? I tried using "Control ID" but it doesn't seem to be working.
Thanks
When you're delving into the windows of another application that wasn't designed to give you any particular special access to its windows, then you don't really have any simple solution. Functions like FindWindowEx, GetWindow, EnumChildWindows, and the rest are what you have to work with.
However, it's often not a great idea to even do this. Internet Explorer may have certain types of windows in a certain hierarchy in the particular version that you're developing against right now. But those windows and hierarchy may be different in previous versions and could be considerably different in future versions. You have no guarantee about these things.
In some cases, you might do well to investigate if there are alternative and more official ways to control the other program. For instance, Internet Explorer exposes a COM object that can be used for many purposes. Because this is an official interface, you have better guarantees about what previous versions this will be supported on and that it won't break for future versions.
The best way to do it is find it step by step.. E.g. Find the IE window with FindWindow, then find the child of that with FindWindowEx, then find the child of that with FindWindowEx ... until you get down to the textbox.
There is 1 program I can think of that will generate VB code from dragging a icon from the application to any part of any other application.. VB is way old but it'll give you a very good idea how to do it!
It's called API Spy, found under 'Downloadable Applications (Windows Only)' on http://patorjk.com/blog/software/
I'm working on an application using OpenGL and C++ that parses some structured input from a file and displays it graphically. I'd like to start an Open File dialog when the application loads to allow the user to choose the file they want to have displayed. I haven't been able to find what I need on the web. Is there a way to achieve this in C++? If so, how? Thank you in advance.
You have two choices, a quick one, and a good one:
Quick and pretty simple, use the Navigation Services framework from Carbon and NavCreateGetFileDialog(). You'll be done quick, and you'll have to learn almost nothing new, but your code won't run in 64-bit (which Apple is pushing everyone towards) and you'll have to link the Carbon framework. Navigation Services is officially removed in 64-bit, and is generally deprecated going forward (though I expect it to linger in 32-bit for quite a while).
A little more work the first time you do it (because you need to learn some Objective-C), but much more powerful and fully supported, wrap up NSOpenPanel in an Objective-C++ class and expose that to your C++. This is my Wrapping C++ pattern, just backwards. If you go this way and have trouble, drop a note and I'll try to speed up posting a blog entry on it.
To add to what Rob wrote:
Unfortunately, there's no simple equivalent to Windows's GetOpenFileName.
If you use Carbon: I don't really think NavCreatGetFileDialog is easy to use... you can use this code in the CarbonDev to see how to use it. The code there returns CFURLRef. To get the POSIX path, use CFURLGetFileSystemReprestnation.
That said, I recommend you to use Cocoa. Rob will write a blog post how to use NSOpenPanel from GLUT :)