各位好,遇到了一个cxgrid的问题跟大家请教
现在我从一个数据表A中查出了数据,先显示出来到cxgrid上,但是某些列不全需要手动添加上去再保存到数据表B中
我把这个手动修改的就放到了cxgrid上修改
现在问题是比如我cxgrid中第一列选择了国家(使用lookupcombobox从国家数据表里读取),第二列就要选择相应的国家的城市。
比如第一列选择了中国,第二列就出现北京上海等,第一列选择美国,第二列出现new york等。
该如何实现?数据表怎么设计才好?多谢!

解决方案 »

  1.   

    http://win.chinaunix.net/bbs/redirect.php?tid=26071&goto=lastpost
      

  2.   

    http://www.pudn.com/downloads125/ebook/detail529647.htmlhttp://topic.csdn.net/t/20060327/10/4642040.html      ---- 2楼是不是和楼主的要求差不多
      

  3.   

    呵呵,这个好像delphi用的比较多,lz可以去delphi问问,可能效果会好一点。
      

  4.   

    还是自己解决了,代码贴上,供大家参考触发函数为:cxGrid1DBTableView1ThemePropertiesCloseUp
    代码:
        cxGrid1DBTableView1->DataController->UpdateData();
        int RowIndex=cxGrid1DBTableView1->DataController->GetEditingRecordIndex();
        int hIndex=cxGrid1DBTableView1->DataController->GetItemByFieldName("theme")->Index;
        AnsiString ttemp = cxGrid1DBTableView1->DataController->GetDisplayText(RowIndex,hIndex);    qryThemeMore->Filtered = false;  //ADOQuery
        qryThemeMore->Filter = "theme = '" + ttemp + "'";
        qryThemeMore->Filtered = true;