/* Transfers the items and selection of the combo box to or from a transfer buffer if TF_SETDATA or TF_GETDATA, repectively, is passed as the TransferFlag. DataPtr should point to a PTMyComboBoxData (i.e. it should be a pointer to a pointer to a TMyComboBoxData) which points to the data to be transferred. Transfer returns the size of PTMyComboBox (the pointer not the object). To retrieve the size without transferring data, pass TF_SIZEDATA as the TransferFlag. */ WORD TMyComboBox::Transfer(Pvoid DataPtr, WORD TransferFlag) { PTMyComboBoxData ComboBoxData = *(PTMyComboBoxData _FAR *)DataPtr; if ( TransferFlag == TF_GETDATA ) { int StringSize = GetWindowTextLength(HWindow) + 1; if (!StringSize) StringSize = 80; if ( ComboBoxData->Selection ) delete ComboBoxData->Selection; ComboBoxData->Selection= new char[StringSize]; GetWindowText(HWindow, ComboBoxData->Selection, StringSize); } else if ( TransferFlag == TF_SETDATA ) { ClearList(); ComboBoxData->Strings->forEach(DoAddForCB, this); int SelIndex = FindExactString(ComboBoxData->Selection, -1); if ( SelIndex > -1 ) SetSelIndex(SelIndex); SetWindowText(HWindow, ComboBoxData->Selection); } return sizeof(PTMyComboBoxData); }
// Right was pressed LTBOOL CLTGUICycleCtrl::OnRight ( ) { int oldSel = m_nSelIndex; if ( m_stringArray.size() <= 1 ) { return LTFALSE; } uint8 newSel = m_nSelIndex; newSel++; if ( newSel >= m_stringArray.size() ) { newSel = 0; } if (newSel != m_nSelIndex) { SetSelIndex(newSel); CalculateSize(); } if (m_pCommandHandler && m_nSelIndex != oldSel) { m_pCommandHandler->SendCommand(m_nCommandID, m_nParam1, m_nParam2); } return LTTRUE; }
void TDrawListView::LoadData() { ClearList(); const Tecg* ecg; if ((ecg = DrawDoc->GetECG()) != 0) FormatData(ecg, 0); SetSelIndex(0); }
bool ZMapListBox::OnCommand(MWidget* pWidget, const char* szMessage) { if(pWidget==m_pListBox && strcmp(szMessage, MLB_ITEM_SEL)==0){ SetSelIndex(-1); return true; } else if(pWidget==m_pListBox && strcmp(szMessage, MLB_ITEM_DBLCLK)==0){ if(GetListener()!=NULL)return GetListener()->OnCommand(pWidget, szMessage); } return false; }
// /// Refresh the window. // void TCheckList::Update() { int topIndex = GetTopIndex(); int selIndex = GetSelIndex(); SendMessage(WM_SETREDRAW, false); Invalidate(); SetTopIndex(topIndex); if (selIndex != LB_ERR) SetSelIndex(selIndex); SendMessage(WM_SETREDRAW, true); }
bool CCTabCtrl::OnCommand(CCWidget* pWidget, const char* szMessage){ int nIndex = 0; for(CCTabList::iterator i=m_TabList.begin();i!=m_TabList.end();i++){ CCTabItem *pItem = *i; if(pItem->pButton == pWidget) { if(strcmp(szMessage, CCBTN_CLK_MSG)==0) { SetSelIndex(nIndex); } return pItem->pButtonListener->OnCommand(pWidget,szMessage); } nIndex++; } return false; }
bool ZMapListBox::OnShow(void) { Refresh(ZApplication::GetFileSystem()); if(m_pThumbnail!=NULL){ delete m_pThumbnail; m_pThumbnail = NULL; } // 처음 아이템을 가리킨다. SetSelIndex(0); m_pListBox->SetFocus(); return true; }
// Update data void CLTGUICycleCtrl::UpdateData (LTBOOL bSaveAndValidate) { if (!m_pnValue) { return; } if (bSaveAndValidate) { *m_pnValue=GetSelIndex(); } else { SetSelIndex(*m_pnValue); } }
void TDrawListView::FormatData(const Tecg* ecg, int unsigned index) { // Large number for now :-) char buf1[80]; char buf2[80]; char buf3[80]; char buf4[80]; char buf5[80]; // TColor color(line->QueryColor()); wsprintf(buf1, "No. Of Points in ECG = (%d)", ecg->length()); wsprintf(buf2, "(x,y) Scales = (%d,%d)", ecg->get_x_scale(), ecg->get_y_scale()); wsprintf(buf3, "R Hight threshold = (%d)", ecg->get_r_thresh()); wsprintf(buf4, "R Change threshold = (%d)", ecg->get_r_change()); wsprintf(buf5, "Y (min,max) = (%d,%d)", ecg->get_y_min(), ecg->get_y_max()); wsprintf(buf5, "Y mean = (%d)", ecg->get_y_mean()); // DeleteString(index); ClearList(); AddString(ecg->ECG_Data_String1.c_str()); AddString(ecg->ECG_Data_String2.c_str()); AddString(ecg->ECG_Data_String3.c_str()); AddString(buf1); AddString(buf2); AddString(buf3); AddString(buf4); AddString(buf5); SetSelIndex(index); }
//----------------------------------------------------------------------------- uint TCheckList::Transfer(void* buffer, TTransferDirection direction) { long style = GetStyle(); TCheckListData* checkListData = (TCheckListData*)buffer; if (direction == tdGetData){ // First, clear out Strings array and fill with contents of list box // checkListData->Clear(false); int count = GetCount(); for(int i =0; i < count; i++) checkListData->AddItem(GetItem(i)); // Update transfer data with new selected item(s) // checkListData->ResetSelections(); if (!(style & MULTIPLESEL)) { // Single selection // checkListData->Select(GetSelIndex()); } else { // Multiple selection // int selCount = GetSelCount(); if (selCount > 0) { TAPointer<int> selections(new int[selCount]); GetSelIndexes(selections, selCount); // Select each item by index // for (int selIndex = 0; selIndex < selCount; selIndex++) checkListData->Select(selections[selIndex]); } } } else if (direction == tdSetData){ ClearList(); // Add each string, item data and selections in listBoxData to list box // const int noSelection = -1; uint selCount = checkListData->GetSelCount(); // for multi selection int selIndex = noSelection; // for single selection for (uint i = 0; i < checkListData->ItemCount(); i++){ // Index may be different from i when the listbox is sorted. // int index = AddString((LPCTSTR)checkListData->GetItem(i)); if (style & MULTIPLESEL) { for (uint j = 0; j < selCount; j++) if (checkListData->GetSelIndices()[j] == (int)i) { SetSel(index, true); break; } } else { if (selCount && (uint)checkListData->GetSelIndices()[0] == i) selIndex = index; else // Inserted something before item and the item to select has been // pushed further down in the list. // if (selIndex != noSelection && index <= selIndex) selIndex++; } } if (selIndex != noSelection && !(style & MULTIPLESEL)) SetSelIndex(selIndex); } return sizeof(TCheckListData); }