G
gzntzxj
Unregistered / Unconfirmed
GUEST, unregistred user!
我想用一个表来建立一个菜单,相应执行的表单名存入一个字段中
怎样才能让点击菜单时执行相应的表单呢;
我愿出50分
procedure TForm1.Button1Click(Sender: TObject);
var
str,str1,fm_name:string;
i,j:integer;
itm,itm2:tmenuitem;
begin
adoquery1.SQL.Clear;
str:='select * from menutb2 where userid=''A01'+''''+' AND MOBJID=1';
adoquery1.SQL.add(str);
adoquery1.ExecSQL ;
adoquery1.Active := true;
adoquery1.First;
for i := 0 to adoquery1.RecordCount-1 do
begin
itm:=tmenuitem.Create(self);
str:= trim(adoquery1.fieldbyname('mname').Value) ;
str1:=trim(adoquery1.fieldbyname('mprompt').Value);
itm.Name:=str ;
itm.Caption:=str1;
mainmenu1.Items.Add(itm);
adoquery2.SQL.Clear ;
adoquery2.SQL.Add('select * from menutb2 where userid=''A01'+''''+' AND mobjid=3 and leavelname='''+str1+'''');
adoquery2.ExecSQL;
adoquery2.Active:=true;
adoquery2.First;
itm2:=mainmenu1.Items.Items;
for j:=0 to adoquery2.RecordCount-1 do
begin
itm:=tmenuitem.Create(self);
str:= itm2.Name+'_'+inttostr(j) ;
str1:=trim(adoquery2.fieldbyname('mprompt').Value);
fm_name:=trim(adoquery2.fieldbyname('fmname').value); //这是我要执行表单
itm.Name:=str ;
if str1<>'-' then
itm.Caption:=str1
else
itm.caption:='-';
//
请问我要怎样才能点击菜单项后执行fm_name表单呢
//
itm2.Add(itm);
adoquery2.Next;
end;
adoquery1.Next;
end;
end;
怎样才能让点击菜单时执行相应的表单呢;
我愿出50分
procedure TForm1.Button1Click(Sender: TObject);
var
str,str1,fm_name:string;
i,j:integer;
itm,itm2:tmenuitem;
begin
adoquery1.SQL.Clear;
str:='select * from menutb2 where userid=''A01'+''''+' AND MOBJID=1';
adoquery1.SQL.add(str);
adoquery1.ExecSQL ;
adoquery1.Active := true;
adoquery1.First;
for i := 0 to adoquery1.RecordCount-1 do
begin
itm:=tmenuitem.Create(self);
str:= trim(adoquery1.fieldbyname('mname').Value) ;
str1:=trim(adoquery1.fieldbyname('mprompt').Value);
itm.Name:=str ;
itm.Caption:=str1;
mainmenu1.Items.Add(itm);
adoquery2.SQL.Clear ;
adoquery2.SQL.Add('select * from menutb2 where userid=''A01'+''''+' AND mobjid=3 and leavelname='''+str1+'''');
adoquery2.ExecSQL;
adoquery2.Active:=true;
adoquery2.First;
itm2:=mainmenu1.Items.Items;
for j:=0 to adoquery2.RecordCount-1 do
begin
itm:=tmenuitem.Create(self);
str:= itm2.Name+'_'+inttostr(j) ;
str1:=trim(adoquery2.fieldbyname('mprompt').Value);
fm_name:=trim(adoquery2.fieldbyname('fmname').value); //这是我要执行表单
itm.Name:=str ;
if str1<>'-' then
itm.Caption:=str1
else
itm.caption:='-';
//
请问我要怎样才能点击菜单项后执行fm_name表单呢
//
itm2.Add(itm);
adoquery2.Next;
end;
adoquery1.Next;
end;
end;