Dynamische Spalten



  • Ich habe ein Listenelement das dynamisch sein soll mal sind es mehr mal weniger Spalten. So wenn ich jetzt eine Zeile makiere sollen alle Werte der Zeile in ebenfalls dynamische Variablen gespeichert werden.

    hier einteil code

    void CViewerDlg::einlesen()
    {
    er = true;
    CString objekt30,uswidth,usheight,objekt31,objekt28,objekt29,usname,objekt27,objekt22,objekt23,objekt24,objekt25,objekt26,usarea,drawheight,drawtop,drawleft,namedraw,drawwidth,usleft;
    CString objekt,objekt2,objekt3,objekt4,objekt5,objekt6,objekt7,objekt8,objekt9,objekt10;
    CString pagead,layoutimage,layout,width,height,possitiontop1,possitiontop,possitionleft,possitionleft1,name;

    UpdateData(TRUE);
    CString strPgmName;
    int e =0;

    URL = pfad;

    //CString URL,buffer;
    CWebGrab grab;

    if (grab.GetFile(URL,buffer,"Mozilla/4.0 (compatible); MSIE 5.5; Windows 98; Win 9x 4.90)"))

    {
    CString html = buffer;
    CString objekt,objekt2,objekt3,objekt4,objekt5,objekt6,objekt7,objekt8,objekt9,objekt10;

    do
    {

    objekt = html.Mid(html.Find("<pages>")+7);
    pagead = objekt.Mid(objekt.Find("page address")+14);
    pagead = pagead.Left(pagead.Find("\""));
    pagead.TrimLeft();
    html = objekt;
    m_liste.InsertItem(0,pagead);

    objekt2 = html.Mid(html.Find("layout")+6);
    layout = objekt2.Mid(objekt2.Find("image=")+7);
    layout = layout.Left(layout.Find(".png"));
    html = objekt2;
    m_liste.SetItemText(item,1,layout);

    objekt3 = html.Mid(html.Find("width")+5);
    width = objekt3.Mid(objekt3.Find("=")+2);
    width = width.Left(width.Find("\""));
    html = objekt3;
    m_liste.SetItemText(item,2,width);

    objekt4 = html.Mid(html.Find("height")+6);
    height = objekt4.Mid(objekt4.Find("=")+2);
    height = height.Left(height.Find("\""));
    html = objekt4;
    m_liste.SetItemText(item,3,height);

    do
    {

    m_liste.InsertColumn(4," Top",LVCFMT_LEFT,40,0);
    m_liste.InsertColumn(5," Left",LVCFMT_LEFT,40,0);
    m_liste.InsertColumn(6," Name",LVCFMT_LEFT,40,0);

    m_nSpaltenzahl += 3;
    objekt5 = html.Mid(html.Find("position")+8);
    possitiontop = objekt5.Mid(objekt5.Find("top=\"")+5);
    possitiontop = possitiontop.Left(possitiontop.Find("\""));
    m_liste.SetItemText(item,4,possitiontop);
    html = objekt5;

    objekt6 = html.Mid(html.Find("left")+4);
    possitionleft = objekt6.Mid(objekt6.Find("=")+2);
    possitionleft = possitionleft.Left(possitionleft.Find("\""));
    m_liste.SetItemText(item,5,possitionleft);
    html = objekt6;

    objekt7 = html.Mid(html.Find("name")+4);
    name = objekt7.Mid(objekt7.Find("=")+2);
    name = name.Left(name.Find("\""));
    m_liste.SetItemText(item,6,name);

    html = objekt7;

    }while ( html.Find("position top=") < 1);
    //}

    CString pdgrouptop,heightpg1,widthpg1,namepg1,pgidleft,pgidtop,pgid,namepg,widthpg,heightpg,pdgroupleft,objekt11,objekt12,objekt13,objekt14,objekt15,objekt16,objekt17,objekt18,objekt19,objekt20,objekt21;

    objekt11 = html.Mid(html.Find("pidgetgroup top")+13);
    pdgrouptop = objekt11.Mid(objekt11.Find("=\"")+2);
    pdgrouptop = pdgrouptop.Left(pdgrouptop.Find("\""));

    // MessageBox(pdgrouptop);

    html = objekt11;

    objekt12 = html.Mid(html.Find("left")+4);

    pdgroupleft = objekt12.Mid(objekt12.Find("=")+2);

    pdgroupleft = pdgroupleft.Left(pdgroupleft.Find("\""));

    html = objekt12;

    // MessageBox(pdgroupleft);

    objekt13 = html.Mid(html.Find("name")+4);

    namepg = objekt13.Mid(objekt13.Find("=")+2);

    namepg = namepg.Left(namepg.Find("\""));

    html = objekt13;

    // MessageBox(namepg);

    objekt14 = html.Mid(html.Find("width")+4);

    widthpg = objekt14.Mid(objekt14.Find("=")+2);

    widthpg = widthpg.Left(widthpg.Find("\""));

    html = objekt14;

    // MessageBox(widthpg);

    objekt15 = html.Mid(html.Find("height")+6);

    heightpg = objekt15.Mid(objekt15.Find("=")+2);

    heightpg = heightpg.Left(heightpg.Find("\""));

    html = objekt15;

    // MessageBox(heightpg);

    objekt16 = html.Mid(html.Find("pidget id")+9);

    pgid = objekt16.Mid(objekt16.Find("=")+2);

    pgid = pgid.Left(pgid.Find("\""));

    pgid.TrimLeft();

    // MessageBox(pgid);

    objekt17 = html.Mid(html.Find("top")+3);

    pgidtop = objekt17.Mid(objekt17.Find("=")+2);

    pgidtop = pgidtop.Left(pgidtop.Find("\""));

    html = objekt17;

    // MessageBox(pgidtop);

    objekt18 = html.Mid(html.Find("left")+4);

    pgidleft = objekt18.Mid(objekt18.Find("=")+2);

    pgidleft = pgidleft.Left(pgidleft.Find("\""));

    html = objekt18;

    // MessageBox(pgidleft);

    objekt19 = html.Mid(html.Find("name")+4);

    namepg1 = objekt19.Mid(objekt19.Find("=")+2);

    namepg1 = namepg1.Left(namepg1.Find("\""));

    html = objekt19;

    // MessageBox(namepg1);

    objekt20 = html.Mid(html.Find("width")+4);

    widthpg1 = objekt20.Mid(objekt20.Find("=")+2);

    widthpg1 = widthpg1.Left(widthpg1.Find("\""));

    html = objekt20;

    // MessageBox(widthpg1);

    objekt21 = html.Mid(html.Find("height")+6);

    heightpg1 = objekt21.Mid(objekt21.Find("=")+2);

    heightpg1 = heightpg1.Left(heightpg1.Find("\""));

    html = objekt21;

    // MessageBox(heightpg1);

    objekt22 = html.Mid(html.Find("drawing_area top")+13);
    drawtop = objekt22.Mid(objekt22.Find("=")+2);
    drawtop = drawtop.Left(drawtop.Find("\""));

    html = objekt22;

    objekt23 = html.Mid(html.Find("left")+4);
    drawleft = objekt23.Mid(objekt23.Find("=")+2);
    drawleft = drawleft.Left(drawleft.Find("\""));

    html = objekt23;

    objekt24 = html.Mid(html.Find("name")+4);
    namedraw = objekt24.Mid(objekt24.Find("=")+2);
    namedraw = namedraw.Left(namedraw.Find("\""));

    html = objekt24;

    objekt25 = html.Mid(html.Find("width")+4);
    drawwidth = objekt25.Mid(objekt25.Find("=")+2);
    drawwidth = drawwidth.Left(drawwidth.Find("\""));

    html = objekt25;

    objekt26 = html.Mid(html.Find("height")+4);
    drawheight = objekt26.Mid(objekt26.Find("=")+2);
    drawheight = drawheight.Left(drawheight.Find("\""));

    html = objekt26;

    objekt27 = html.Mid(html.Find("user_area top")+12);
    usarea = objekt27.Mid(objekt27.Find("=")+2);
    usarea = usarea.Left(usarea.Find("\""));

    html = objekt27;

    objekt28 = html.Mid(html.Find("left")+4);
    usleft = objekt28.Mid(objekt28.Find("=")+2);
    usleft = usleft.Left(usleft.Find("\""));

    html = objekt28;

    objekt29 = html.Mid(html.Find("name")+4);
    usname = objekt29.Mid(objekt29.Find("=")+2);
    usname = usname.Left(usname.Find("\""));

    html = objekt29;

    objekt30 = html.Mid(html.Find("width")+4);
    uswidth = objekt30.Mid(objekt30.Find("=")+2);
    uswidth = uswidth.Left(uswidth.Find("\""));

    html = objekt30;

    objekt31 = html.Mid(html.Find("height")+4);
    usheight = objekt31.Mid(objekt31.Find("=")+2);
    usheight = usheight.Left(usheight.Find("\""));

    html = objekt31;

    /* m_liste.InsertItem(0,pagead);
    m_liste.SetItemText(item,1,layout);
    m_liste.SetItemText(item,2,width);
    m_liste.SetItemText(item,3,height);
    m_liste.SetItemText(item,4,possitiontop);
    m_liste.SetItemText(item,5,possitionleft);
    m_liste.SetItemText(item,6,name);
    m_liste.SetItemText(item,7,possitiontop1);
    m_liste.SetItemText(item,8,possitionleft1);
    */ m_liste.SetItemText(item,9,namedraw);
    m_liste.SetItemText(item,10,pdgrouptop);
    m_liste.SetItemText(item,11,pdgroupleft);
    m_liste.SetItemText(item,12,namepg);
    m_liste.SetItemText(item,13,widthpg);
    m_liste.SetItemText(item,14,height);
    m_liste.SetItemText(item,15,pgid);
    m_liste.SetItemText(item,16,pgidtop);
    m_liste.SetItemText(item,17,pgidleft);
    m_liste.SetItemText(item,18,namepg1);
    m_liste.SetItemText(item,19,widthpg1);
    m_liste.SetItemText(item,20,heightpg1);
    m_liste.SetItemText(item,21,drawtop);
    m_liste.SetItemText(item,22,drawleft);
    m_liste.SetItemText(item,23,namedraw);
    m_liste.SetItemText(item,24,drawwidth);
    m_liste.SetItemText(item,25,drawheight);
    m_liste.SetItemText(item,26,usarea);
    m_liste.SetItemText(item,27,usleft);
    m_liste.SetItemText(item,28,usname);
    m_liste.SetItemText(item,29,uswidth);
    m_liste.SetItemText(item,30,usheight);

    } while ( html.Find(".png") > 1);

    }

    hier wenn zeile makiert istvoid CViewerDlg::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
    {

    int CurSel=-1;

    //alle Items durchgehen
    for (int i=0;i<m_liste.GetItemCount();i++)
    {

    //Status des Akutellen Items holen und das LVIS_SELECTED Bit überprüfen
    if ((m_liste.GetItemState(i,LVIS_SELECTED) & LVIS_SELECTED) == LVIS_SELECTED)
    {
    //Akutelles Item ist Selektiert
    CurSel = i;

    //Schleife verlassen
    break;
    }

    }

    //text des Selektierten Item holen und anzeigen

    for (int r=0;r<m_nSpaltenzahl-(30);r++)
    {
    CString pageadress,layoutimage,breite,hoehe,positiontop,positionleft,ptop,pleft;
    pageadress = m_liste.GetItemText(CurSel,r);
    MessageBox(pageadress);

    layoutimage = m_liste.GetItemText(CurSel,r);
    MessageBox(pageadress);
    }
    /*Anzeigen dlg;

    dlg.breite = breite;
    dlg.hoehe = hoehe;
    dlg.DoModal();

    */
    }

    wie geht das



  • Bitte benutz absofort die C/C++ Codetags, damit der Quelltext besser zu lesen ist. Danke!


Anmelden zum Antworten