本文整理汇总了C++中GetSelectedItem函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSelectedItem函数的具体用法?C++ GetSelectedItem怎么用?C++ GetSelectedItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetSelectedItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCursorPos
void CSiteGroupsTree::OnRightClick(NMHDR *, LRESULT *result)
{
CPoint pt;
GetCursorPos(&pt);
CPoint ptClient = pt;
ScreenToClient(&ptClient);
HTREEITEM item = HitTest(ptClient);
if (item == 0)
item = GetSelectedItem();
UpdateMenu(m_menu, item);
m_menu.TrackPopupMenu(TPM_LEFTALIGN, pt.x, pt.y, this);
*result = 1;
}
示例2: Dlg
void ValueListCtrl::OnDelete(wxCommandEvent& event)
{
wxMessageDialog Dlg(this, "Are you sure you want to delete this value?", "Confirm Value Delete", wxYES_NO | wxICON_EXCLAMATION );
if(Dlg.ShowModal() != wxID_YES)
{
return;
}
long Item = GetSelectedItem();
if(Item == -1)
{
return ;
}
wxString Text = GetItemText(Item);
m_pConfig->remove_value(m_Key, Text);
DeleteItem(Item);
}
示例3: GetSelectedItem
void MenuEditor::AddItem(const wxString& label, const wxString& shortcut,
const wxString& id, const wxString& name, const wxString &help, const wxString &kind)
{
int sel = GetSelectedItem();
int identation = 0;
if (sel >= 0) identation = GetItemIdentation(sel);
wxString labelAux = label;
labelAux.Trim(true);
labelAux.Trim(false);
if (sel < 0) sel = m_menuList->GetItemCount() - 1;
labelAux = wxString(wxChar(' '), identation * IDENTATION) + labelAux;
long index = InsertItem(sel + 1, labelAux, shortcut, id, name, help, kind);
m_menuList->SetItemState(index, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
示例4: GetSelectedItem
void CPageSound::OnSelectButton()
{
int iSel = GetSelectedItem();
if(iSel!=-1)
{
CString strFileName = m_SoundPathList.GetItemText(iSel,1);
CFileDialog OpenDlg(TRUE,NULL,strFileName,OFN_CREATEPROMPT|OFN_EXPLORER,GetString(IDS_SOUND_FORMAT),this);
if(OpenDlg.DoModal()==IDOK)
{
m_SoundPathList.SetItemText(iSel,1,OpenDlg.GetPathName());
SetModified();
}
}
BlockOrUnBlock();
}
示例5: GetSelectedItem
void CMyTreeListControl::OnContextMenu(CWnd* /*pWnd*/, CPoint pt)
{
int i= GetSelectedItem();
if (i == -1)
return;
CTreeListItem *item= GetItem(i);
CRect rc= GetWholeSubitemRect(i, 0);
CRect rcTitle= item->GetTitleRect() + rc.TopLeft();
CMenu menu;
menu.LoadMenu(IDR_POPUPLIST);
CMenu *sub= menu.GetSubMenu(0);
PrepareDefaultMenu(sub, (CItem *)item);
GetMainFrame()->AppendUserDefinedCleanups(sub);
// Show popup menu and act accordingly.
//
// The menu shall not overlap the label but appear
// horizontally at the cursor position,
// vertically under (or above) the label.
// TrackPopupMenuEx() behaves in the desired way, if
// we exclude the label rectangle extended to full screen width.
//
// Thanks to Sven for this compromise between the old Windirstat
// behavior (show the menu to the right of the label) and the
// Explorer behavior (show the menu at the cursor position).
TPMPARAMS tp;
tp.cbSize = sizeof(tp);
tp.rcExclude = rcTitle;
ClientToScreen(&tp.rcExclude);
CRect desktop;
GetDesktopWindow()->GetWindowRect(desktop);
tp.rcExclude.left = desktop.left;
tp.rcExclude.right = desktop.right;
const int overlap = 2; // a little vertical overlapping
tp.rcExclude.top += overlap;
tp.rcExclude.bottom -= overlap;
sub->TrackPopupMenuEx(TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, AfxGetMainWnd(), &tp);
}
示例6: GetSelectedItem
void CTreeFileCtrl::OnRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
//Remember the old selected item
HTREEITEM hOldSelItem = GetSelectedItem();
//Work out the position of where the context menu should be
CPoint p(GetCurrentMessage()->pt);
CPoint pt(p);
ScreenToClient(&pt);
Select(HitTest(pt), TVGN_CARET);
OnContextMenu(NULL, p);
//Reselect the old selected item
Select(hOldSelItem, TVGN_CARET);
*pResult = 0;
}
示例7: notify
void CFileListManager::OnUnloadFiles( KeyValues *pParams )
{
CNotifyScopeGuard notify( "CFileListManager::OnUnloadFiles", NOTIFY_SOURCE_FILE_LIST_MANAGER, NOTIFY_SETDIRTYFLAG );
int nSelected = GetSelectedItemsCount();
for ( int i = 0; i < nSelected; ++i )
{
int itemId = GetSelectedItem( i );
DmFileId_t fileid = ( DmFileId_t )GetItemUserData( itemId );
if ( g_pDataModel->IsFileLoaded( fileid ) )
{
SetLoaded( fileid, false );
}
}
Refresh();
}
示例8: GetSelectedItem
//---------------------------- PRIVATE -----------------------------//
void wxContextListCtrl::LeftDown(wxMouseEvent &)
{
wxInt32 index = GetSelectedItem();
if(-1 != index)
{
wxInt32 id = GetItemData(index);
// Since we're a menu, we just want clicks, not selections.
SetSelectedItem(-1);
Controller::get().Transmit(shEventContextMenuClick, id);
wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, id);
ProcessEvent(command);
}
}
示例9: GetSelectedItem
void CTabMemSpellsDlg::OnMaxdec()
{
int nIndex = GetSelectedItem();
if (nIndex == -1)
return;
CString strNum;
int nNum;
strNum = m_lcList.GetItemText(nIndex,2);
nNum = atoi(strNum);
if (nNum > 0)
{
strNum.Format("%d",nNum-1);
m_lcList.SetItemText(nIndex,2,strNum);
}
}
示例10: GetSelectedItem
void CDirectoryTreeCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_SPACE)
{
HTREEITEM hItem = GetSelectedItem();
if (hItem)
{
ShareSubDirTree(hItem, GetKeyState(VK_CONTROL) & 0x8000);
// if Ctrl+Space is passed to the tree control, it just beeps and does not check/uncheck the item!
SetCheck(hItem, !GetCheck(hItem));
return;
}
}
CTreeCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
示例11: SendMessage
/**
* Call when adapter selection changed. This will reset device
* combobox, list devices for new adapter, and call ChangedDevice().
*/
void ZFXD3DEnum::ChangedAdapter(void) {
ZFXADAPTERINFO *pA=NULL;
// delete content of device combobox
SendMessage(m_hDEVICE, CB_RESETCONTENT, 0, 0);
pA = (ZFXADAPTERINFO *)GetSelectedItem(m_hADAPTER);
for (UINT d=0; d<pA->nNumDevs; d++) {
AddItem(m_hDEVICE, D3DDevTypeToString(pA->d3dDevs[d].
d3dDevType), &pA->d3dDevs[d]);
}
SendMessage(m_hDEVICE, CB_SETCURSEL, (WPARAM)0, 0);
// treat as if device slectio changed
ChangedDevice();
} // ChangedAdapter
示例12: KillTimer
void CTreeCtrlEx::OnTimer(UINT nIDEvent)
{
if (nIDEvent == TCEX_EDITLABEL)
{
// Stop the timer.
KillTimer(m_idTimer);
// Invoke label editing.
if (m_bEditLabelPending)
EditLabel(GetSelectedItem());
m_bEditLabelPending = FALSE;
return;
}
CTreeCtrl::OnTimer(nIDEvent);
}
示例13: switch
void CDirectoryTreeCtrl::OnTvnKeydown(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTVKEYDOWN pTVKeyDown = reinterpret_cast<LPNMTVKEYDOWN>(pNMHDR);
switch(pTVKeyDown->wVKey)
{
case VK_SPACE:
case VK_RETURN:
{
HTREEITEM hItem = GetSelectedItem();
if(hItem)
{
HTREEITEM tItem = GetFirstVisibleItem();
CheckChanged(hItem, !GetCheck(hItem));
if(m_bCtrlPressed)
{
Expand(hItem, TVE_TOGGLE);
HTREEITEM hChild;
hChild = GetChildItem(hItem);
while(hChild != NULL)
{
MarkChilds(hChild,!GetCheck(hItem));
hChild = GetNextSiblingItem( hChild );
}
SetCheck(hItem, !GetCheck(hItem));
Expand(hItem, TVE_TOGGLE);
}
SelectSetFirstVisible(tItem);
}
break;
}
default:
break;
}
*pResult = 0;
}
示例14: GetSelectedItem
/**
*\fn HRESULT GetCurProject(Project **ppProject)
*\brief 得到当前项目
*\param[in] Project * * ppProject 项目指针
*\return HRESULT 0成功,其它失败
*/
HRESULT CAddinProcess::GetCurProject(Project **ppProject)
{
CComPtr<SelectedItem> selectItem;
HRESULT hr = GetSelectedItem(1, &selectItem);
if (SUCCEEDED(hr) && selectItem != NULL)
{
CComPtr<ProjectItem> item;
hr = selectItem->get_ProjectItem(&item);
if (SUCCEEDED(hr) && item != NULL)
{
hr = item->get_ContainingProject(ppProject);
}
}
return hr;
}
示例15: GetSelectedItem
BOOL CShellTreeCtrl::GetCurFilePath(CString & str)
{
LPTVITEMDATA lptvid;
char szBuff[MAX_PATH];
HTREEITEM hItem=NULL;
hItem = GetSelectedItem();
lptvid=(LPTVITEMDATA)GetItemData(hItem);
if(SHGetPathFromIDList(lptvid->lpifq,szBuff))
{
str = szBuff;
return TRUE;
}
else
return FALSE;
}