Missing Combo Box in Custom draw application - mfc

I used custom draw control list with combo box in my application. I used following code to make the combo box in my list control.
SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT );
But when run my program combo box will disapper. How to resolve this problem ?
Also I want to select entire row using that combo box. How can I do that ?
Thanks.

I would be able to solve the above problem by following the content of the below site [1].
[1] http://www.codeproject.com/Articles/21085/CheckBox-ComboBox-Extending-the-ComboBox-Class-and
Thanks !

Related

Setting Style Sheet for a Check Box Qt removes Check Box from GUI QT

For my Qt Dialog Window, I am trying to create a checkbox that is centered, but is always checked and uncheckable.
I did this by combining
ui->baseBox->setStyleSheet("margin-left:50%; margin-right:50%;");
and
ui->baseBox->setAttribute(Qt::WA_TransparentForMouseEvents);
ui->baseBox->setFocusPolicy(Qt::NoFocus);
However, I can only do the first bit of code or the second. When I run the both of them together, my checkBox baseBox completely disappears from the GUI.
So I tried doing :
ui->baseBox->setAttribute(Qt::WA_TransparentForMouseEvents);
ui->baseBox->setFocusPolicy(Qt::NoFocus);
ui->baseBox->setStyleSheet(ui->baseBox->styleSheet().append(QString("margin-left:50%; margin-right:50%;")));
based on How to add style via setStyleSheet() without losing orignal style in Qt?
However, I am running into the same problem.
How can I do both of these things ? Why is my check box disappearing ?

How to customize MFC MDI CMFCTabCtrl

I've created MDI application based on MFC framework but the style of CMFCTabCtrl's doesn't satisfy our requirements. I want to change the tab height, colors and add some pictures and buttons.
But I don't know how. Are there any examples or articles that will help me out?
You can easily customize your MFC Tab control. There are plenty of options.
To enable Close buttons you just need to call m_TabControl.EnableActiveTabCloseButton();
Make sure to add a WM_CLOSE message handler in your child window:
void CMyTabWindow::OnClose()
{
CMFCTabCtrl *pTab = static_cast<CMFCTabCtrl*>(GetParent());
pTab->RemoveTab(pTab->GetActiveTab());
}
You can customize colors using SetTabBkColor() or SetAutoColors().
You can also set images using SetImageList().
The height can also be customized using SetTabsHeight().

how to resize popup of wxcombobox

I have created a combobox on a dialog using wxwidgets C++ library (with MSVC and GCC). The list of items in the combobox are too many and when I click on the combobox whole list is shown on the screen and it looks bad and choosing an item from this list is not that user frendly.
Is there anyway we can see this list in a small popup window with a scrollbar? I could not find any relevant methods to set the size for popup window.
Any help is appreciated.
Thanks,
Harik
Have you tried setting the desired size in the constructor?
Something like this, which will restrict the height of the popup to 50 pixels
int ComboboxHeightPixels = 50;
new wxComboBox( this, ComboID, L"",wxPoint(-1,-1),
wxSize(-1,ComboboxHeightPixels));
You need to use wxComboCtrl with some popup window (see wxPopupWindow) that provides a wxListView and a resizing method (you probably have to implement that yourself).

How to set colour in child Clistbox with owner CMFCTabCtrl Class

I using MFC AppWizard and created the SDI application
I need to set colour for the outputwnd debug tab in some sequence
for example
if any wrong value entered in the some control
i need to display text in RED stating that invalid value entered
if login done welcome message in GREEN and so on
I tried to use DrawItem
I am not able to set the listBox stye as LBS_OWNERDRAWFIXED|LBS_HASSTRING
on AddString i am getting error
How to set colour in child Clistbox with owner CMFCTabCtrl Class
I think you need to override CListBox::DrawItem. There's an example in this MSDN page.
few years ago i use this advanced mvc listbox from Ultimate Toolbox
http://www.codeproject.com/KB/MFC/UltimateToolbox_ListBoxEx.aspx
You can easy change items color, font etc with this
Thanks to all for quick and helpfull reply
The help resolved my problem and I am able to change the colour and font of the list box
One more thing i want to add
We need to override measureItem as well. No need to add any code but need to have defination and declaration
otherwise the application will throw execption for using LBS_OWNERDRAWFIXED|LBS_HASSTRING

how to show both icon and text on button on mfc?

Code Used:
m_pButton->Create(L"ABC", WS_CHILD | WS_VISIBLE| BM_SETIMAGE,CRect(0,0,100,100),this,ID_BUTTON1);
m_pButton->SetIcon(::LoadIcon(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_ICON1)));
//above Code show neither showing image nor showing text.
You might use CMFCButton if you are using VS 2008 SP1 or higher.
BM_SETIMAGE is not a button style, but a message which is sent to the window in order to set a bitmap.
What you probably want is the BS_BITMAP style. Unfortunately as far as I know, it is not possible to have both text and a bitmap on a standard button. But you should find plenty of working implementations of a custom button class on sites like codeguru or codeproject.
BS_ICON and BS_BITMAP must be both unset to enable icon and text on the same button.
See https://msdn.microsoft.com/en-us/library/bb761822(VS.85).aspx
WPF might be able to do this. But, changing GUI topkits might not be an option anyway.
You could override the DrawItem method in CButton. For details check out the following links:
CButton::DrawItem
Owner drawn button - step by step