本文整理汇总了C++中ListBox_GetCurSel函数的典型用法代码示例。如果您正苦于以下问题:C++ ListBox_GetCurSel函数的具体用法?C++ ListBox_GetCurSel怎么用?C++ ListBox_GetCurSel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListBox_GetCurSel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MaybeEnableAddButton
/*
* MaybeEnableAddButton: Enable/disable the "add spell" button
* depending on whether the currently selected spell in the available
* list box can be chosen.
*/
void MaybeEnableAddButton(HWND hDlg)
{
int i;
int school = 0;
Spell *s;
BOOL enable = TRUE;
int index = ListBox_GetCurSel(hList1);
if (index != LB_ERR)
{
// First find any chosen Qor/Shallile spells
for (i = 0; i < ListBox_GetCount(hList2); ++i)
{
s = (Spell *) ListBox_GetItemData(hList2, i);
if (s->school == SS_QOR || s->school == SS_SHALILLE)
school = s->school;
}
// If school of selected spell conflicts, disable button
s = (Spell *) ListBox_GetItemData(hList1, index);
if (school == SS_QOR && s->school == SS_SHALILLE ||
school == SS_SHALILLE && s->school == SS_QOR)
enable = FALSE;
}
EnableWindow(GetDlgItem(hDlg, IDC_ADDSPELL), enable);
}
示例2: GetDlgItem
void plResponderProc::ICreateCmdRollups()
{
// Get the index of the current command
HWND hCmds = GetDlgItem(fhDlg, IDC_CMD_LIST);
int cmdIdx = ListBox_GetCurSel(hCmds);
if (cmdIdx != LB_ERR && cmdIdx != fCmdIdx)
{
fCmdIdx = cmdIdx;
fIgnoreNextDrop = true;
// Save the current scroll position and reset it at the end, so the panels
// won't always jerk back up to the top
IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup();
int scrollPos = rollup->GetScrollPos();
// Destroy the last command's rollups
IRemoveCmdRollups();
// Create the rollup for the current command
IParamBlock2 *pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, fCmdIdx);
fCmdMap = ICreateMap(pb);
ResponderWait::InitDlg(fStatePB, fCmdIdx, GetDlgItem(fhDlg, IDC_CMD_LIST));
pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdWait, 0, fCmdIdx);
fWaitMap = ICreateMap(pb);
rollup->SetScrollPos(scrollPos);
}
}
示例3: PhGetListBoxString
PPH_STRING PhGetListBoxString(
_In_ HWND hwnd,
_In_ INT Index
)
{
PPH_STRING string;
ULONG length;
if (Index == -1)
{
Index = ListBox_GetCurSel(hwnd);
if (Index == -1)
return NULL;
}
length = ListBox_GetTextLen(hwnd, Index);
if (length == LB_ERR)
return NULL;
if (length == 0)
return PhReferenceEmptyString();
string = PhCreateStringEx(NULL, length * 2);
if (ListBox_GetText(hwnd, Index, string->Buffer) != LB_ERR)
{
return string;
}
else
{
PhDereferenceObject(string);
return NULL;
}
}
示例4: GetSelectedElement
CUserControlListElement* CUserControlList::GetSelectedElement()
{
//получить индекс выделенного элемента
UINT ElementIndex=ListBox_GetCurSel(mhWindow);
if(ElementIndex==LB_ERR) return NULL;
return (CUserControlListElement*)ListBox_GetItemData(mhWindow,ElementIndex);
}
示例5: Cls_OnAdvCommand
void Cls_OnAdvCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
//WM_COMMAND handler
{
int index;
DWORD dwItem;
switch(codeNotify)
{
case LBN_SELCHANGE:
index = ListBox_GetCurSel(hSettingsListbox);
dwItem = ListBox_GetItemData(hSettingsListbox, index);
if ( hCurrentDlg )
ShowWindow(hCurrentDlg, SW_HIDE);
if ( dwItem IS IDI_ERROR_LOG )
hCurrentDlg = hErrLogDlg;
else if ( dwItem IS IDI_ERROR_HANDLING )
hCurrentDlg = hErrorsDlg;
else if ( dwItem IS IDI_MEMORY )
hCurrentDlg = hMemoryDlg;
else if ( dwItem IS IDI_SECURITY )
hCurrentDlg = hSecurityDlg;
else if ( dwItem IS IDI_SETUP )
hCurrentDlg = hSetupDlg;
else if ( dwItem IS IDI_OUTPUT )
hCurrentDlg = hOutputDlg;
ShowWindow(hCurrentDlg, SW_SHOW);
break;
default:
;
}
}
示例6: GetDlgItem
bool plMtlEventProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resID)
{
if (cmd == LBN_SELCHANGE && resID == IDC_EVENT_LIST)
{
HWND hList = GetDlgItem(hWnd, IDC_EVENT_LIST);
int idx = ListBox_GetCurSel(hList);
BOOL selected = ListBox_GetSel(hList, idx);
int eventType = ListBox_GetItemData(hList, idx);
if (eventType == kAnimEventBegin)
pb->SetValue(kMtlBegin, 0, selected);
else if (eventType == kAnimEventEnd)
pb->SetValue(kMtlEnd, 0, selected);
else if (eventType == kAnimEventMarker)
{
char buf[256];
ListBox_GetText(hList, idx, buf);
ST::string text = ST::string::from_utf8(buf);
if (selected)
{
if (!IsMarkerSelected(pb, kMtlMarkers, text))
{
TCHAR* name = buf;
pb->Append(kMtlMarkers, 1, &name);
}
}
else
IsMarkerSelected(pb, kMtlMarkers, text, true);
}
return true;
}
return false;
}
示例7: ViewNoises_NoiseChanged
VOID ViewNoises_NoiseChanged( HWND hwnd )
{
INT i;
CHAR szBuf[128];
LRESULT lResult;
lResult = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_NOISE_LIST));
if (lResult >= 0 && lResult < po->nNoises)
{
i = (INT)lResult;
DoubleToString(szBuf, po->pNoiseData[i].radius, 0);
Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_RADIUS), szBuf);
DoubleToString(szBuf, po->pNoiseData[i].height, 0);
Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_HEIGHT), szBuf);
wsprintf(szBuf, "%d", po->pNoiseData[i].delay);
Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_DELAY), szBuf);
}
return;
} // ViewNoises_NoiseChanged
示例8: GetDlgItem
void CSetDlgNetwork::OnBnClickedButtonDelUdp()
{
// TODO: ここにコントロール通知ハンドラー コードを追加します。
HWND hItem = GetDlgItem(IDC_LIST_IP_UDP);
int sel = ListBox_GetCurSel(hItem);
if( sel != LB_ERR ){
int index = (int)ListBox_GetItemData(hItem, sel);
vector<NW_SEND_INFO>::iterator itr;
itr = udpSendList.begin();
advance(itr, index);
udpSendList.erase(itr);
ListBox_ResetContent(hItem);
for( int i=0; i<(int)udpSendList.size(); i++ ){
wstring add = L"";
Format(add, L"%s:%d",udpSendList[i].ipString.c_str(), udpSendList[i].port);
if( udpSendList[i].broadcastFlag == TRUE ){
add+= L" ブロードキャスト";
}
index = ListBox_AddString(hItem, add.c_str());
ListBox_SetItemData(hItem, index, i);
}
}
}
示例9: wxCHECK_MSG
// Get single selection, for single choice list items
int wxListBox::GetSelection() const
{
wxCHECK_MSG( !HasMultipleSelection(),
-1,
wxT("GetSelection() can't be used with multiple-selection listboxes, use GetSelections() instead.") );
return ListBox_GetCurSel(GetHwnd());
}
示例10: ListBox_GetCurSel
void ProjectConfigDialog::onButtonRemoveSearchPathClicked(void)
{
int index = ListBox_GetCurSel(GetDlgItem(m_hwndDialog, IDC_LIST_PACKAGE_SEARCH_PATHS));
if (index != LB_ERR)
{
ListBox_DeleteString(GetDlgItem(m_hwndDialog, IDC_LIST_PACKAGE_SEARCH_PATHS), index);
m_project.setPackagePath(makeSearchPath().c_str());
}
}
示例11: TPack_ExtractSelected
void TPack_ExtractSelected(TPack_WindowData * pData)
{
HWND hLB = GetDlgItem(pData->hwnd, IDC_TEXTURELIST);
int nSel;
BitmapEntry * pEntry;
char szName[MAX_TEXTURE_NAME_LENGTH];
char szFile[MAX_PATH];
char szPath[MAX_PATH];
int nErrorCode;
//----------------------------------------------
// Get current selected list box entry.
// Get the geBitmap.
// Write 8-bit BMP file.
//----------------------------------------------
// Ouput to the current directory
GetCurrentDirectory(MAX_PATH, szPath);
nSel = ListBox_GetCurSel(hLB);
if (nSel != LB_ERR)
if (ListBox_GetText(hLB, nSel, szName) != LB_ERR)
{
pEntry = FindBitmap(pData, szName);
if (pEntry)
{
// Create an output file name
strcpy(szFile, szPath);
strcat(szFile, "\\");
strcat(szFile, pEntry->Name);
strcat(szFile, ".bmp");
nErrorCode = WriteBMP8(szFile, pEntry->Bitmap);
if (nErrorCode != TPACKERROR_OK)
{
// Error writing this bitmap
switch (nErrorCode)
{
case TPACKERROR_CREATEFILE:
NonFatalError("Unable to create output file %s", szFile);
break;
case TPACKERROR_WRITE:
NonFatalError("I/O error writing %s", szFile);
break;
case TPACKERROR_MEMORYALLOCATION:
NonFatalError("Memory allocation error writing %s", szFile);
break;
case TPACKERROR_UNKNOWN:
default:
NonFatalError("UInknown error writing %s", szFile);
}
}
}
}
}
示例12: w32g_rotate_playlist
void w32g_rotate_playlist(int dest)
{
int i, i1, i2;
HWND hListBox;
PlayListEntry save;
char temp[1024];
if(playlist.nfiles == 0)
return;
if(!(hListBox = playlist_box()))
return;
i1 = ListBox_GetCurSel(hListBox);
i2 = playlist.nfiles - 1;
if(i1 >= i2)
return;
#ifdef W32G_RANDOM_IS_SHUFFLE
w32g_shuffle_playlist_rotate(dest,i1,i2);
#endif
if(dest > 0)
{
save = playlist.list[i2];
for(i = i2; i > i1; i--) /* i: i2 -> i1 */
playlist.list[i] = playlist.list[i - 1];
playlist.list[i] = save;
ListBox_GetText(hListBox,i2,temp);
ListBox_DeleteString(hListBox,i2);
ListBox_InsertString(hListBox,i1,temp);
ListBox_SetCurSel(hListBox,i1);
if(playlist.selected == i2){
playlist.selected = i1;
w32g_update_playlist_pos(playlist.selected);
} else if(i1 <= playlist.selected && playlist.selected < i2){
playlist.selected++;
w32g_update_playlist_pos(playlist.selected);
}
}
else
{
save = playlist.list[i1];
for(i = i1; i < i2; i++) /* i: i1 -> i2 */
playlist.list[i] = playlist.list[i + 1];
playlist.list[i] = save;
ListBox_GetText(hListBox,i1,temp);
ListBox_DeleteString(hListBox,i1);
ListBox_InsertString(hListBox,-1,temp);
ListBox_SetCurSel(hListBox,i1);
if(playlist.selected == i1){
playlist.selected = i2;
w32g_update_playlist_pos(playlist.selected);
} else if(i1 < playlist.selected && playlist.selected <= i2){
playlist.selected--;
w32g_update_playlist_pos(playlist.selected);
}
}
}
示例13: sd_OnCommand
/*
* OnCommand()
*/
void sd_OnCommand(HWND storeDlg, UINT cmdID, HWND ctrl, UINT notify)
{
int lbxIndex;
int itemGroupIndex;
int lbxCount;
switch (cmdID) {
case IDOK:
if (sd_itemToStore == SI_VCED) {
itemGroupIndex = SI_VMEM;
lbxCount = 16;
} else { /* (sd_itemToStore == SI_PCED) */
itemGroupIndex = SI_PMEM;
lbxCount = 12;
}
*sd_destIndex = ListBox_GetCurSel(sd_lbx[0]);
if (*sd_destIndex == -1) {
*sd_destIndex = lbxCount + ListBox_GetCurSel(sd_lbx[1]);
}
*sd_destIndex += itemGroupIndex;
case IDCANCEL:
EndDialog(storeDlg, cmdID);
break;
case IDC_STORE1_LBX:
lbxIndex = 0;
goto LBX_INDEX_SET;
case IDC_STORE2_LBX:
lbxIndex = 1;
LBX_INDEX_SET:
if (notify == LBN_SETFOCUS) {
/*
* Allow only one selection among both list boxes.
*/
ListBox_SetCurSel(sd_lbx[1 - lbxIndex], -1);
} else if (notify == LBN_DBLCLK) {
/*
* Double clicking an item is equivalent to clicking OK.
*/
PostMessage(storeDlg, WM_COMMAND, IDOK, 0);
}
break;
}
}
示例14: ListBox_GetCurSel
void CCreateBoundingWindow::OnClickDeleteButton()
{
int selectedIndex = ListBox_GetCurSel(mBoundingsList);
if (selectedIndex == -1)
return;
CEditorScene* scene = CEditorScene::getInstance();
scene->DeleteBounding(selectedIndex);
ListBox_DeleteString(mBoundingsList, selectedIndex);
}
示例15: ListBox_GetCurSel
int CCreateLightNodeWindow::GetSelectedItemId()
{
int itemIndex = ListBox_GetCurSel(mLightNodesList);
if (itemIndex != LB_ERR)
{
u32 id = ListBox_GetItemData(mLightNodesList, itemIndex);
return id;
}
return -1;
}