コード例 #1
0
ファイル: GridDocs.cpp プロジェクト: BeL1kOFF/SHATE
void CGridDocs::SelectItem(int iRow, BOOL bSetFocus)
{
	if(iSelRow != iRow)
	{
		CCellID cell;
		cell.col = 0;
		cell.row = iRow;
		if (!IsCellVisible(cell))
        {
			CCellID idTopLeft = GetTopleftNonFixedCell();
			int iPos;
			iPos = 0;
			for(int i = 1;i<iRow;i++)
			{
				iPos = iPos + GetRowHeight(i); 
			}
			SetScrollPos(SB_VERT, iPos, TRUE);
			GetTopleftNonFixedCell(TRUE);
			Invalidate();
		}
	
		iSelRow = iRow;
		SetSelectedRange(iRow,GetFixedColumnCount(),iRow,GetColumnCount()-1,TRUE,TRUE);
		SendMessageToParent(iRow,GetFixedColumnCount(), GVN_SELCHANGED);
		if(bSetFocus)
			SetFocus();
		
	}
}
コード例 #2
0
ファイル: GridCtrlEx.cpp プロジェクト: radtek/e-load
/**
	@brief	FindName을 찾는다.

	@author KHS	

	@date 2009-05-26 오후 3:18:13	

	@param	

	@return		
**/
bool CGridCtrlEx::FindWhatYouNeed(CString FindName, bool bMatchCase, bool bMatchWholeWord, bool bSearchDown)
{
	if(bMatchCase == false)
		FindName.MakeUpper();

	bool bContinueSearch = true;
	
	CCellID startCell = GetFocusCell();
	CCellID actCell = startCell;

	if(IsValid(actCell))
	{
		goto L_SEARCH;
	}

	do
	{
		actCell.col = 1;
		actCell.row = 1;
		for(actCell = bSearchDown ? actCell
			: GetPrevCell(actCell);
			bContinueSearch && IsValid(actCell);)
		{
			if(actCell == startCell)
			{
				bContinueSearch = false;
				break;
			}
			{
				CString rName = CGridCtrlEx::GetItemText(actCell.row, actCell.col);
				if(bMatchCase == false) rName.MakeUpper();

				if((bMatchWholeWord && rName == FindName) || (!bMatchWholeWord && (rName.Find(FindName) >= 0)))
				{
					SetSelectedRange(actCell.row, actCell.col,actCell.row, actCell.col);
					SetFocusCell(actCell);
					//!SCROL BAR MOVE
					ScrollMove(startCell, actCell);

					return true;
				}
			}

L_SEARCH:
			actCell = bSearchDown ? GetNextCell(actCell) : GetPrevCell(actCell);
		}
		if(!IsValid(actCell))
		{
			bContinueSearch = false;
		}
	}while(bContinueSearch);

	return false;	// not found
}