怎样使动态创建的子窗体拥有焦点时,主窗体的菜单中子窗体的名字有check;
麻烦各位举个简单的例子.

解决方案 »

  1.   

    遍历找到该menu以后用SetMenuItemInfo函数或者简单点用CheckMenuItem函数
      

  2.   

    我有个简单的办法。例如主窗体菜单的其中某一列为
      子窗体
        --窗体1
        --窗体2
        --窗体3
    其中“子窗体”的menuitem为 2(这个根据实际情况)在“窗体1”onclick中:
    application.CreateForm(Tform2,form2);
    form2.Tag:=b1.MenuIndex;//b1为“窗体1”的name
    form2.Show;在form2的OnActivate中:
    for i:=0 to mainform.mainmenu1.items[2].count-1 do
    if i=tag then
    mainform.MainMenu1.items[2].Items[i].Checked:=true
    else
    mainform.MainMenu1.items[2].Items[i].Checked:=false;
      

  3.   

    其中“子窗体”的menuitem为 2(这个根据实际情况)这句写错了应该是:
    其中“子窗体”的menuindex为 2(这个根据实际情况)