custom combobox win32 - c++

I am trying to implement an auto-suggest feature in an win32 combobox (C++). I want to achieve a behaviour that is similar to the google auto suggest function. When the user types something into the edit-control of the combobox, its listbox opens and shows all possible matches. The Problem is the default behaviour of a win32 combobox is to always select the closest match and put the complete text (selected) into the edit control when the list is opened. I need to avoid this behaviour. The list should just open - dont select something and dont change the text in the edit-control!
I have tried to subclass the combobox and catch the CBN_DROPDOWN message, but this changes nothing on the default behavior.
Does anyone have a further idea? I dont want the auto-complete feature that just completes the text in the edit-control without opening the list.
Thx in advance
Greets, Michael

Related

[MFC]how to make disable an Item in combobox?

I'm using Visual Studio 2012 with mfc standard library.
I want to make one Item is not able to be selected but Item can see in the list.
How can i do that? I'm a novice in MFC. plz help me
Though This is not a exact solution, I can make this.
When the Item is selected, there is no action and leave a message about the Item is invalid
So, If I just can change the color of the Item then, It's about to complete the function what I want. but I don't know even how to change color just one Item.
plz Give me a help!T.T
To change the color of just one item in a list box you have to completely replace the list box painting. You set the "owner draw" style and then write a message handler for WM_DRAWITEM. It will be called for each item in the list box. There are several examples at codeproject: here is one of them:
http://www.codeproject.com/Articles/135855/Owner-Drawn-CListBox
I don't think there is support for this in MFC.
But you can make your own list, that is derived from the MFC one. In that you can overload OnItemChange(NMHDR* pNMHDR, LRESULT* pResult) I think this is the one that's called when the user selects a different item in the list. You can then check what item is selected and give the user a warning saying "You can't select this item." I know it's not pretty, but I don't know of an other way...

How to display list of opened tabs in Qt 4.8 on Ctrl+Tab

Is there any straightforward (without listening to key events) way to display the list of opened tabs in Qt, like following (in Visual Studio). I just want to make sure Qt does not offer such a feature, before implementing such a widget by myself.
At least in a primitive way like in NotePad++ (meant no offense). Now, when I am using QTabBar and press Ctrl+Tab it shows something like this,
And I don't know actually what is that !
The default behaviour of ctrl-tab is to cycle through the tabs. You will need to customize that to display your own dialog. You don't need to connect to any signals to do this, simply pass a reference to the tab widget/bar into the dialog. You can then use that reference to retrieve the names and to change the tab.

Qt C++ - displaying the links in QText Browser

Right now I am displaying the result in QTextBrowser. Results will be something like /home/User/, /media/Arena/ etc i.e path to different folders. Now I want to open the folder in a window by clicking on this result which is displayed in QTextBrowser. But I have no ideas how to do that. So can anyone let me know how to do it.
Thanx in advance.
P.S. I am using QtCreator & see the image http://i53.tinypic.com/qyxp1s.png.
can you insert html rather than plain text into the QTextBrowser widget? then you can use a URL to describe the paths.
BasementCat's right. You can use setHtml QTextBrowser's method to set HTML into the widget. You'll then probably need to call setOpenLinks(false) to disable default behavior and connect custom slot to widget's anchorClicked(QUrl const&) signal to handle links.

Binding a static text box to a checkbox

I need some help in MFC. The following is my problem:
I have two controls a static text and a checkbox
When using MFC Wizard, i place a '&' in front of one of the letters in the static text, while executing if i press Alt+, the checkbox either gets enabled or disabled.
Now my problem is i am adding these controls programaticaly, and even though i have the '&' placed in the static text, if i press the Alt+, it doesn't change the state of the checkbox control.
My queries are:
Can anyone kindly let me know if there is some binding which has to be done in case we are adding the controls programatically.
If someone can briefly explain how the binding is taken care by MFC it will be gr8 help
edit:
One more thing the checkbox won't have any text associated with it.
Since the static text is not associated with the checkbox control, how can the system know which checkbox it should link? I bet if you look at the TAB ordering and the group settings of the controls, you will arrive at your solution.

How to underline individual items in a CListCtrl

We want some items in a CListView to appear like hypertext links.
I can make everything underlined by setting the lfUnderline flag in LOGFONT, and creating a font from this, before calling SetFont - but this applies to the whole CListView.
Does anyone know how to make individual items in a CListView to appear underlined?
You can do this by using the custom-draw notifications and modifying the font on the particular item you want within the custom-draw handler.
See this link for details.
Try this:
oMyCListView.SetExtendedStyle(LVS_EX_ONECLICKACTIVATE)