Example #1
0
bool CInPlaceCombo::Create (int iItem, int iSubItem, CStringList &rlstItems, int nSel)
{
	if (NULL == GetControl()) 
		return false;

	m_iItem = iItem;
	m_iSubItem = iSubItem;

bool fVisible = (m_dwStyle & WS_VISIBLE) ? true : false;

	SetStyle (m_dwStyle & ~WS_VISIBLE);
	if (!FInit())
		return false;

// Set the proper font
HFONT hF = (HFONT)GetParent()->ForwardEvent(WM_GETFONT);

	ForwardEvent (WM_SETFONT, (WPARAM)hF);

// alle Elemente zur Box hinzufügen
	for (CStringList::iterator it = rlstItems.begin(); 
		 it != rlstItems.end(); 
		 ++it)
	{
		GetComboBox() -> AddString ((*it).c_str());
	}

	if (-1 != nSel) 
		GetComboBox() -> ChangeCurrentIndex (nSel);
	if (fVisible) {
		Show();
		SetFocus();
	}
	return true;
}
Example #2
0
void CInPlaceCombo::FocusChange (FocusChangeEvt e) 
{
	ControlWindow::FocusChange (e);
	
	if (!e.gotFocus()) {
	char cbBuffer[_MAX_PATH];

		cbBuffer[0] = '\0';
		GetComboBox() -> GetString (cbBuffer, -1, sizeof(cbBuffer));

	// Send Notification to parent of ListView ctrl
	LV_DISPINFO dispinfo;
	HWND hParent = GetParent()->Handle(API_WINDOW_HWND);

		dispinfo.hdr.hwndFrom = hParent;
		dispinfo.hdr.idFrom = ::GetDlgCtrlID (Handle(API_WINDOW_HWND));
		dispinfo.hdr.code = LVN_ENDLABELEDIT;

		dispinfo.item.mask = LVIF_TEXT;
		dispinfo.item.iItem = m_iItem;
		dispinfo.item.iSubItem = m_iSubItem;
		dispinfo.item.pszText = m_bESC ? NULL : cbBuffer;
		dispinfo.item.cchTextMax = m_bESC ? 0 : strlen(cbBuffer);

		GetParent()->GetParent()->ForwardEvent(WM_NOTIFY, GetDlgCtrlID(hParent), (LPARAM)&dispinfo);

		Hide();					// sofort ausblenden 
		PostEvent(WM_CLOSE);	// jetzt zerlegen
	}
}
Example #3
0
static void SaveCanSetup(HWND hdlg, struct TMhsCanCfg *cfg)
{
GetDlgItemTextCpy(cfg->CanSnrStr, hdlg, IDC_SNR_EDIT, MHS_STR_SIZE);
cfg->CanBtrValue = GetDlgItemHex(hdlg, IDC_BTR_EDIT);
cfg->CanSpeed = GetComboBox(hdlg, IDC_CAN_SPEED);
}
Example #4
0
        //Check if the BTR0 and BTR1 value entered is valid. if Not valid
        // Restore the previos value else calculate the new list.
        if( unNbt0>defMAX_NBT || unNbt0<defMIN_NBT || fNbt != unNbt0  ||
                unBrp1>defMAX_BRP || unBrp1<defMIN_BRP || unBrp1 != fBrp  ||
                unNbt1>defMAX_NBT || unNbt1<defMIN_NBT )
        {
            MessageBox(hdlg, "Invalid BTRs Configuration!", "Warning", MB_OK|MB_ICONSTOP);
            return FALSE;
        }

    }
    else
    {
        cfg->CanBtrValue = 0;
        cfg->CanSpeed = GetComboBox(hdlg, IDC_CAN_SPEED);

        /* Validate baud rate selection */
        if ( cfg->CanSpeed > 1000 )
        {
            MessageBox(hdlg, "Please select baud rate!", "Warning", MB_OK|MB_ICONSTOP);
            return FALSE;
        }
    }

    return TRUE;
}
static BOOL CALLBACK CanSetupDlgProc(HWND hdlg, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
    switch(uMessage)
    {