HTREEITEM KUIMulStatusTree::InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter, int nCheck) { HTREEITEM hResult = CTreeViewCtrl::InsertItem(lpszItem, hParent, hInsertAfter); SetCheck(hResult, nCheck); return hResult; }
int CPPageInternalFiltersListBox::AddFilter(filter_t* filter, bool checked) { int index = InsertItem(GetItemCount(), filter->label); // SetItemDataPtr must be called before SetCheck SetItemData(index, reinterpret_cast<DWORD_PTR>(filter)); SetCheck(index, checked); return index; }
int CPPageInternalFiltersListBox::AddFilter(filter_t* filter, bool checked) { int index = AddString(filter->label); // SetItemDataPtr must be called before SetCheck SetItemDataPtr(index, filter); SetCheck(index, checked); return index; }
// 键盘事件处理 BOOL CCheckButton::OnControlKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { // 处理快捷键 if((m_nShortcutKey != 0) && (nChar == m_nShortcutKey) && (nFlags == m_nShortcutFlag)) { SetCheck(!GetCheck()); return true; } // 如果当前处于焦点状态,用空格键可以切换check if(m_bIsFocus && (nChar == VK_SPACE) && (nFlags == 0)) { SetCheck(!GetCheck()); return true; } return false; }
BOOL CPageVqf::OnInitDialog() { CPropertyPage::OnInitDialog(); SetCheck(); return TRUE; // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります // 例外: OCX プロパティ ページの戻り値は FALSE となります }
// 从XML设置check属性 HRESULT CCheckButton::OnAttributeCheck(const CString& strValue, BOOL bLoading) { if (strValue.IsEmpty()) return E_FAIL; BOOL bCheck = (strValue == "true"); SetCheck(bCheck); return bLoading?S_FALSE:S_OK; }
bool Checkbox::OnMouseButtonEvent(bool bPressed, int /*iMouseButton*/, unsigned int /*x*/, unsigned int /*y*/) { if (bPressed) return false; SetCheck(!IsChecked()); return true; }
int CIconListBox::AddString(LPCTSTR lpszItem, int iImg) { int iRet = CListBox::AddString(lpszItem); if (iRet >= 0){ SetItemData(iRet, iImg); SetCheck(iImg,1); SetCurSel(iImg); } return iRet; }
void ShipCheckListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar == VK_SPACE) { int i, list_size; list_size = GetCount(); for (i=0; i<list_size; i++) if (GetSel(i) > 0) { if (GetCheck(i)) SetCheck(i, 0); else SetCheck(i, 1); } } else CCheckListBox::OnKeyDown(nChar, nRepCnt, nFlags); }
int CIconListBox::InsertString(int iIndex, LPCTSTR lpszItem) { int iRet = CListBox::InsertString(iIndex,lpszItem); if (iRet >= 0){ SetItemData(iRet, iIndex); SetCheck(iIndex,1); SetCurSel(iIndex); } return iRet; }
bool Checkbox::OnKeyboardEvent(bool bKeyDown, unsigned int sym, unsigned int /*mod*/) { if (!bKeyDown && sym == SDLK_SPACE) { SetCheck(!IsChecked()); return true; } return false; }
void CheckButton::OnMouseLeftButtonUp(suic::MouseEventArg& e) { if (IsMouseOver()) { // 触发选中事件 SetCheck(!_bChecked); } __super::OnMouseLeftButtonUp(e); }
// /// transfers state information for the TCheckBox // /// Overrides TWindow::Transfer. Transfers the check state of the check box to or /// from buffer, using the values specified in the table in GetCheck(). If direction /// is tdGetDate, the check box state is transferred into the buffer. If direction /// is tdSetData, the check box state is changed to the settings in the transfer /// buffer. /// Transfer() returns the size of the transfer data in bytes. To get the size without /// actually transferring the check box, use tdSizeData as the direction argument. // uint TCheckBox::Transfer(void* buffer, TTransferDirection direction) { if (direction == tdGetData) *(uint16*)buffer = (uint16)GetCheck(); else if (direction == tdSetData) SetCheck(*(uint16*)buffer); return sizeof(uint16); }
// 键盘事件处理 BOOL CDuiRadioButton::OnControlKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { // 处理快捷键 if((m_nShortcutKey != 0) && (nChar == m_nShortcutKey) && (nFlags == m_nShortcutFlag)) { SetCheck(TRUE); SendMessage(MSG_BUTTON_CHECK, 0, GetCheck()); return true; } // 如果当前处于焦点状态,用空格键可以切换check if(m_bIsFocus && (nChar == VK_SPACE) && (nFlags == 0)) { SetCheck(TRUE); SendMessage(MSG_BUTTON_CHECK, 0, GetCheck()); return true; } return false; }
///////////////////////////////////////////////////////////////////////////// // //Method......: OnLButtonUp //Class.......: CxSkinButton // //Author......: Milan Gardian //Created.....: MAR-2001 // //Return value: NONE //Parameters..: As follows // > [in] nFlags: not used // > [in] point: coordinates of the mouse pointer when this event was spawned //Exceptions..: NONE //------------ //Description : // // > Handle event when left button is released (goes up) // //--------------------------------------------------------- void CxSkinButton::OnLButtonUp(UINT nFlags, CPoint point) { //TRACE("* %08X: up\n", ::GetTickCount()); if (m_Style){ //track mouse for radio & check buttons POINT p2 = point; ::ClientToScreen(m_hWnd, &p2); HWND mouse_wnd = ::WindowFromPoint(p2); if (mouse_wnd == m_hWnd){ // mouse is in button if (m_Style==BS_CHECKBOX) SetCheck(m_Checked ? 0 : 1); if (m_Style==BS_RADIOBUTTON) SetCheck(1); } } //Pass this message to the ToolTip control RelayEvent(WM_LBUTTONUP,(WPARAM)nFlags,MAKELPARAM(LOWORD(point.x),LOWORD(point.y))); //Default-process the message m_button_down = false; CButton::OnLButtonUp(nFlags, point); }
void CheckButton::OnKeyDown(suic::KeyboardEventArg& e) { if (e.IsSpacePress()) { if (IsFocused()) { SetCheck(!_bChecked); e.SetHandled(true); } } }
bool COptionsPageEditAssociations::LoadPage() { bool failure = false; COptions* pOptions = COptions::Get(); SetTextFromOption(XRCID("ID_ASSOCIATIONS"), OPTION_EDIT_CUSTOMASSOCIATIONS, failure); SetCheck(XRCID("ID_INHERIT"), pOptions->GetOptionVal(OPTION_EDIT_INHERITASSOCIATIONS) != 0, failure); return !failure; }
void CMyCheckBox::OnLButtonDown(UINT nFlags, CPoint point) { BOOL bChecked=0; if (m_nMyCBoxID==MyCBox_LiveView) { m_bCheckedLiveview ^= 1; SetCheck(m_bCheckedLiveview ? BST_CHECKED : BST_UNCHECKED); bChecked=m_bCheckedLiveview; } else if (m_nMyCBoxID==MyCBox_IPWall) { m_bCheckedIPwall ^= 1; SetCheck(m_bCheckedIPwall ? BST_CHECKED : BST_UNCHECKED); bChecked=m_bCheckedIPwall; } ((CMainFrame*)AfxGetMainWnd())->m_bAutoScan = bChecked; ((CMainFrame*)AfxGetMainWnd())->vSetAutoScan(bChecked,m_nMyCBoxID); CButton::OnLButtonDown(nFlags, point); }
void OptionsColumns::OnResetCanon() { Reset(item_canon_); SetCheck(COL_EXP_PROG, false); // exp. program SetCheck(COL_LIGHT_SRC, false); // light src. SetCheck(COL_CAN_LENS, true); // lens attached SetCheck(COL_CAN_TIMER, true); // self timer SetCheck(COL_CAN_DRIVE, true); // drive mode SetCheck(COL_CAN_FOCUS, true); // focus mode SetCheck(COL_CAN_PROGRAM, true); // program SetCheck(COL_CAN_MET_MODE, true); // metering }
void CDirectoryTreeCtrl::MarkChilds(HTREEITEM hChild,bool mark) { CheckChanged(hChild, mark); SetCheck(hChild,mark); Expand(hChild, TVE_TOGGLE); // VQB - make sure tree has entries HTREEITEM hChild2; hChild2 = GetChildItem(hChild); while( hChild2 != NULL) { MarkChilds(hChild2,mark); hChild2 = GetNextSiblingItem( hChild2 ); } Expand(hChild, TVE_TOGGLE); // VQB - restore tree to initial disposition }
//------------------------------------------------------------------------ //! Update the checkbox of the label column (first column) //! //! @param nGroupId ID of the group //! @param bChecked The new check box state //------------------------------------------------------------------------ void CGridListCtrlGroups::CheckEntireGroup(int nGroupId, bool bChecked) { if (!(GetExtendedStyle() & LVS_EX_CHECKBOXES)) return; for (int nRow=0; nRow<GetItemCount(); ++nRow) { if (GetRowGroupId(nRow) == nGroupId) { SetCheck(nRow, bChecked ? TRUE : FALSE); } } }
bool cgUICheck::OnMessage( cgUIMsg msg, unsigned wparam, unsigned lparam ) { switch (msg) { case WM_LBUTTONUP: { if (IsClickDown()) SetCheck(!m_bIsChecked); }break; } return cgUIWidget::OnMessage(msg, wparam, lparam); }
void CxRadioButton::SetRadioState( bool inValue ) { #ifdef CRY_USEMFC int value; if ( inValue == true ) value = 1; else value = 0; SetCheck( value ); #endif #ifdef CRY_USEWX SetValue ( inValue ); #endif }
/* Transfers state information for the TCheckBox. The TransferFlag passed specifies whether data is to be read from or written to the passed buffer, or whether the data element size is simply to be returned. The return value is the size (in bytes) of the transfer data. */ WORD TCheckBox::Transfer(Pvoid DataPtr, WORD TransferFlag) { WORD CheckFlag; if ( TransferFlag == TF_GETDATA ) { CheckFlag = GetCheck(); _fmemcpy(DataPtr, &CheckFlag, sizeof(CheckFlag)); } else if ( TransferFlag == TF_SETDATA ) SetCheck( *(WORD *)DataPtr ); return sizeof(CheckFlag); }
void CTreeCtrlEx::OnLButtonDown(UINT nFlags, CPoint point) { UINT uFlags; HTREEITEM hItem = HitTest (point, &uFlags); if (hItem && uFlags == TVHT_ONITEMSTATEICON) { BOOL bChecked = IsChecked (hItem); SetCheck (hItem, !bChecked); return; } CTreeCtrl::OnLButtonDown(nFlags, point); }
HTREEITEM CDirectoryTreeCtrl::AddChildItem(HTREEITEM hRoot, CString strText) { CString strDir = GetFullPath(hRoot); strDir += strText; if (hRoot == NULL) strDir += _T('\\'); TV_INSERTSTRUCT itInsert; SHFILEINFO shFinfo; memzero(&itInsert, sizeof(itInsert)); if ( SHGetFileInfo( strDir, FILE_ATTRIBUTE_DIRECTORY, &shFinfo, sizeof(shFinfo), SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES ) != NULL ) { itInsert.item.mask |= TVIF_IMAGE; itInsert.item.iImage = shFinfo.iIcon; } if ( SHGetFileInfo( strDir, FILE_ATTRIBUTE_DIRECTORY, &shFinfo, sizeof(shFinfo), SHGFI_SYSICONINDEX | SHGFI_OPENICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES ) != NULL ) { itInsert.item.mask |= TVIF_SELECTEDIMAGE; itInsert.item.iSelectedImage = shFinfo.iIcon; } if (hRoot != NULL) strDir += _T('\\'); if (HasSharedSubdirectory(strDir)) itInsert.item.state = TVIS_BOLD; if (HasSubdirectories(strDir)) itInsert.item.cChildren = 1; // used to display the + symbol next to each item itInsert.item.mask |= TVIF_CHILDREN | TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; itInsert.item.stateMask = TVIS_BOLD; itInsert.item.pszText = const_cast<LPTSTR>(strText.GetString()); itInsert.hInsertAfter = (hRoot == NULL) ? TVI_LAST : TVI_SORT; // root items are already sorted itInsert.hParent = hRoot; HTREEITEM hItem = InsertItem(&itInsert); if (IsShared(strDir)) SetCheck(hItem); return hItem; }
/* * Event Handler Functions _________________________________________________________________ * */ static void OnInitDialog(HWND hwndDlg) { hDlg = hwndDlg; bAdvanced = TRUE; TCHAR szNumProcesses[32]; _itot(DEFAULT_NUM_PROCESSES, szNumProcesses, 10); SetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses); SetCheck(hDlg, IDC_NUM_PROCESSES_CHECKBOX); SetWndText(hDlg, IDC_LOG_FILE, A2S(DEFAULT_LOG_FILE)); // If a partition name isn't selected, then only allow the salvage server option if (szPartitionName[0] == 0) { SetEnable(hDlg, IDC_PARTITION, ES_DISABLE); SetEnable(hDlg, IDC_VOLUME, ES_DISABLE); SetCheck(hDlg, IDC_SERVER); } else SetCheck(hDlg, IDC_PARTITION); // Close the Advanced portion of the dialog OnAdvanced(); }
void CWSFCHomeListCtrl::OnLvnItemchanging (NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); if ((!IsChecked (pNMLV->uOldState)) && (IsChecked (pNMLV->uNewState))) // Item Checked { for (int iItemIndex = 0; iItemIndex < GetItemCount (); ++iItemIndex) { if (iItemIndex != pNMLV->iItem) SetCheck (iItemIndex, FALSE); } } *pResult = 0; }
bool ModeCheckBox::HandleKeyEvent(Keys KeyID) { if (IsReadOnly() || mChecked) { return CheckBox::HandleKeyEvent(KeyID); } switch(KeyID) { case MPC_OK_KEY: SetCheck(!IsChecked()); return true; } return CheckBox::HandleKeyEvent(KeyID); }
// Get the data from the OI and use it to set the check for the check button // appropriately. zSHORT ZCheckBox::MapFromOI( WPARAM wFlag ) { // if ( zstrcmp( *m_pzsTag, "CheckAutoCreateActOnCatChg" ) == 0 ) // TraceLineS( "ZCheckBox::MapFromOI ", *m_pzsTag ); // If the control is not Visible, do not do mapping. if ( IsVisibleForMapFromOI( ) == FALSE ) return( 0 ); m_ulMapActFlag2 |= zMAPACT_MAPPED_FROM_OI1; if ( m_pzsVName && m_pzsEName && m_pzsAName ) { zPCHAR pch; zBOOL bCheck = FALSE; zULONG ulLth; zCHAR szMap[ 256 ]; zVIEW vApp; zUSHORT uMapState = GetMappingAutoGray( &vApp, *m_pzsVName, *m_pzsEName, *m_pzsAName ); if ( vApp && (uMapState & zMAPACT_ENTITY_EXISTS) ) { GetAttributeLength( &ulLth, vApp, *m_pzsEName, *m_pzsAName ); if ( ulLth >= sizeof( szMap ) ) { GetAddrForAttribute( (zPCHAR *) &pch, vApp, *m_pzsEName, *m_pzsAName ); } else { GetVariableFromAttribute( szMap, 0, zTYPE_STRING, 256, vApp, *m_pzsEName, *m_pzsAName, *m_pzsContext, 0 ); pch = szMap; } // determine check or uncheck bCheck = (zstrcmp( pch, *m_pzsValueOn ) ? 0 : 1); } SetCheck( bCheck ); return( 0 ); } return( -1 ); }