void kGUIDBRecord::LoadGroup(const char *tablename,kGUIDbQuery *q) { unsigned int i; unsigned int n; unsigned int j; const char **row; kGUIDBRecordEntry *re; m_tablename.SetString(tablename); m_unique=false; n=q->GetNumFields(); GetFieldNames(q); #if 0 if(m_numfields!=n) { if(m_fieldnames) delete []m_fieldnames; m_fieldnames=new kGUIString[n]; m_numfields=n; for(i=0; i<n; ++i) m_fieldnames[i].SetString(q->GetFieldName(i)); } #endif if(m_numentries) PurgeEntries(); m_numentries=q->GetNumRows(); m_entries.Alloc(m_numentries); m_entries.SetGrow(true); m_entries.SetGrowSize(32); j=0; while((row = q->GetRow()) != NULL) { re=new kGUIDBRecordEntry(n); m_entries.SetEntry(j++,re); re->m_new=false; for(i=0; i<n; ++i) { re->m_fieldvalues[i].SetString(row[i]); re->m_newfieldvalues[i].SetString(row[i]); } } if(m_numentries) SelectEntry(0); /* default to first entry is selected */ else m_ce=0; /* no current entry! */ }
void DboxMain::OnTraySelect(UINT nID) { ASSERT((nID >= ID_MENUITEM_TRAYSELECT1) && (nID <= ID_MENUITEM_TRAYSELECTMAX)); CItemData ci; if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYSELECT1, ci)) return; DisplayInfo *pdi = (DisplayInfo *)ci.GetDisplayInfo(); if (pdi != NULL) { // Could be null if RefreshViews not called, // In which case we've no display to select to. // An alternate solution would be to force the main window // to display, along with a call to RefreshViews(), before // calling GetDisplayInfo(). SelectEntry(pdi->list_index,TRUE); } }