R
ruoxi_shuai
Unregistered / Unconfirmed
GUEST, unregistred user!
通过点击主窗体的菜单按钮,生成窗体1(ConfigerManagement),在窗体1中再点击弹出菜单生成窗体2(AddSunItem),此时窗体不能显示出现Acceess violation 异常,主窗体、窗体1中的按钮事件代码如下:<br>//主窗体<br>procedure TMain.N24Click(Sender: TObject);<br>begin<br> with TConfigerManagement.Create(nil) do<br> try<br> showmodal;<br> finally<br> free;<br> end;<br>end;<br><br>//窗体1<br>procedure TConfigerManagement.N1Click(Sender: TObject);<br>begin<br> level:=treeview1.Selected.Level;<br> with TAddSunItem.Create(nil) do<br> try<br> ShowModal;<br> finally<br> Free;<br> end;<br>end;<br>//窗体2的Onshow()<br>procedure TAddSunItem.FormShow(Sender: TObject);<br>begin<br> edit1.Text:=ConfigerManagement.TreeView1.Selected.Text;<br> //根据不同的层次节点生成不同的添加界面<br> case ConfigerManagement.TreeView1.Selected.level of<br> 0: begin<br> combobox1.Visible:=false;<br> label4.Visible:=true;<br> label5.Visible:=true;<br> edit2.Visible:=true;<br> edit3.Visible:=true;<br> end;<br> 2: ;<br> 1,3: begin<br> combobox1.Visible:=true;<br> label4.Visible:=false;<br> label5.Visible:=false;<br> edit2.Visible:=false;<br> edit3.Visible:=false;<br> end;<br> 4: begin<br> combobox1.Visible:=true;<br> label4.Visible:=false;<br> label5.Visible:=false;<br> edit2.Visible:=false;<br> edit3.Visible:=false;<br> memo1.Enabled:=true;<br> end;<br> else ;<br> end;<br>end;