MFC ComboBox dropdown list too short - visual-c++

I have dropped ComboBox on dialog form. Also I have added some text to it:
BOOL CMyAppDlg::OnInitDialog()
{
CComboBox *combo= (CComboBox *)GetDlgItem(IDC_COMBO_TT);
combo->AddString("s1");
combo->AddString("s2");
//...
return TRUE;
}
When I drop down ComboBox it shows only one selection line and adds arrows to select other items. How to increase dropdown size?

Click the combo button in dialog editor. You can now drag down to set the open size.

Related

How to click one of the options listed in the drop down menu in hand coded UI testing?

UITestControl uiLinkAboutus = new UITestControl(_bw);
uiLinkAboutus.TechnologyName = "Web";
uiLinkAboutus.SearchProperties.Add("ControlType", "Image");
uiLinkAboutus.SearchProperties.Add("TagName", "IMG");
uiLinkAboutus.SearchProperties.Add("Alt", "Open Menu");
Mouse.Click(uiLinkAboutus);
/* Upon execution, the drop down button is clicked but the option listed below is not clicked. How to solve this problem?
In stead of searching for an image, search for the list or dropdown control using a wpfCombobox, winCombobox or HtmlComboBox control. There you set the selectedItem property to the value you want. that is the most robust way of selecting an item in the UI. so e.g. :
ApplicationUnderTest aut = ApplicationUnderTest.Launch(#"yourapp.exe");  
WpfComboBox cbBox = new WpfComboBox(aut);
cbBox.SearchProperties.Add(WpfComboBox.PropertyNames.AutomationId,"cmbCountries");//AutomationId == xName roperty
cbBox.SelectedItem = "your value";

Prevent row click event in YUI Datatable

I have a YUI data table. When we click on any row of this data table, there is an alert box.
vtgtTbl.on('rowClickEvent',function(oArgs){
alert("a");
}
I have a checkbox. what i want is that when that checkbox is true then row click will work, and not when it is false. so is there is any method in YUI to attach and detach these events
Within the rowClick event handler callback you can add a check for the checkbox in the following way
vtgtTbl.on('rowClickEvent',function(oArgs){
var checkBoxNode = Y.one('#checkboxId');
if (checkBoxNode.checked) {
alert("a");
}
}
Hope it solves the problem.

How to add shadow to menu drop-down list?

In a menu bar, when we click a menu, there is a menu drop-down list containing some menu items. My question is how to add shadow to the menu drop-down list? Just like I see there is shadow in the combo box drop-down list in the default javafx implementation. Thanks ~
yourDropDownMenu.setEffect(addLabelEffect());
Define the drop shadow in the controller class and check if its working. Here is a simple sample
private DropShadow addLabelEffect() {
DropShadow ds = new DropShadow();
ds.setSpread(0);
ds.setOffsetY(1.0);
ds.setOffsetX(1.0);
ds.setColor(Color.BLACK);
return ds;
}

Click OK in Dialog box display output text in SDI

I have a dialog box displayed when I press a menu item in the SDI window. In the Dialog box When i press OK button it should display "SUCESS" in the SDI window... In ONVIEW() i have to use pDC->TEXTOUT() but how to execute that statement on pressing OK button.. I am using visual C++ 6
you should define a user defined message and use PostMessage to call your method in SDI Window.
I am working on assumption that your dialog is modal.
You do not have to define or send any messages.
Retrieve data from the dialog.
Presumably you store 2D vector data in some kind of an array declared as a member variable of the dialog.
When OK button is pushed and copy data to a view’s member variable of the same type. Use it to draw whatever you desire.
void CSDIPopupSampleView::OnViewDialog()
{
CSimpleDlg dlg;
int iResponse = dlg.DoModal();
if(IDOK == iResponse)
{
//Copy data from a dialog here.
}
Invalidate(); // this will cause redraw
}

C# TableLayoutPanel replace control?

I was wondering if it was possible to replace one control in a TableLayoutPanel with another at runtime. I have a combo box and a button which are dynamically added to the TableLayoutPanel at runtime, and when the user selects an item in the combo box and hits the button, I'd like to replace the combobox with a label containing the text of the selected combo box item.
Basically, if I could simply remove the control and insert another at it's index, that would work for me. However I don't see an option like "splice" or "insert" on the Controls collection of the TableLayoutPanel, and I was wondering if there was a simple way to insert a control at a specific index. Thanks in advance.
Fixed this by populating a panel with the two controls I wanted to swap and putting that into the TableLayoutPanel. Then I set their visibility according to which I wanted to see at what time.
This is what I've been able to come up with for what I needed. It gets the position of the ComboBox and makes a new label using the selected value.
// Replaces a drop down menu with a label of the same value
private void lockDropMenu(ComboBox dropControl)
{
TableLayoutPanelCellPosition pos = myTable.GetCellPosition(dropControl);
Label lblValue = new Label();
myTable.Controls.Remove(dropControl);
if (dropControl.SelectedItem != null)
{
lblValue.Text = dropControl.SelectedItem.ToString();
lblValue.Font = lblValue.Font = dropControl.Font;
// Just my preferred formatting
lblValue.AutoSize = true;
lblValue.Dock = System.Windows.Forms.DockStyle.Fill;
lblValue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
myTable.Controls.Add(lblValue, pos.Column, pos.Row);
}
}

Resources