escorpionrojo43
10-03-2012, 18:53:05
Hola Amigo Estoy trabajando en las opciones de permiso pra mis programas el asunto es siguiente.
de la manera larga me funciona pero hace mas grande mi codigo.
// Qry_Permisos.Active := true;
// if Qry_Permisos.FieldByName('OP1').AsBoolean = false then
// fmenuprincipal.Action1.Enabled := false;
// if Qry_Permisos.FieldByName('OP2').AsBoolean = false then
// fmenuprincipal.Action2.Enabled := false;
// if Qry_Permisos.FieldByName('OP3').AsBoolean = false then
// fmenuprincipal.Action3.Enabled := false;
// if Qry_Permisos.FieldByName('OP4').AsBoolean = false then
// fmenuprincipal.Action4.Enabled := false;
// if Qry_Permisos.FieldByName('OP5').AsBoolean = false then
// fmenuprincipal.Action5.Enabled := false;
// if Qry_Permisos.FieldByName('OP6').AsBoolean = false then
// fmenuprincipal.Action6.Enabled := false;
// if Qry_Permisos.FieldByName('OP7').AsBoolean = false then
// fmenuprincipal.Action7.Enabled := false;
// if Qry_Permisos.FieldByName('OP8').AsBoolean = false then
// fmenuprincipal.Action8.Enabled := false;
// if Qry_Permisos.FieldByName('OP9').AsBoolean = false then
// fmenuprincipal.Action9.Enabled := false;
// if Qry_Permisos.FieldByName('OP10').AsBoolean = false then
// fmenuprincipal.Action10.Enabled := false;
// if Qry_Permisos.FieldByName('OP11').AsBoolean = false then
// fmenuprincipal.Action11.Enabled := false;
// if Qry_Permisos.FieldByName('OP12').AsBoolean = false then
// fmenuprincipal.Action12.Enabled := false;
// if Qry_Permisos.FieldByName('OP13').AsBoolean = false then
// fmenuprincipal.Action13.Enabled := false;
// if Qry_Permisos.FieldByName('OP14').AsBoolean = false then
// fmenuprincipal.Action14.Enabled := false;
// if Qry_Permisos.FieldByName('OP15').AsBoolean = false then
// fmenuprincipal.Action15.Enabled := false;
// if Qry_Permisos.FieldByName('OP16').AsBoolean = false then
// fmenuprincipal.Action16.Enabled := false;
// if Qry_Permisos.FieldByName('OP17').AsBoolean = false then
// fmenuprincipal.Action17.Enabled := false;
// if Qry_Permisos.FieldByName('OP18').AsBoolean = false then
// fmenuprincipal.Action18.Enabled := false;
// if Qry_Permisos.FieldByName('OP19').AsBoolean = false then
// fmenuprincipal.Action19.Enabled := false;
// if Qry_Permisos.FieldByName('OP20').AsBoolean = false then
// fmenuprincipal.Action20.Enabled := false;
end
El asunto es que necesito hacer esto un poco mejor y opte por utilizar las sentencia for
with qry_permisos do
begin
Active := true;
first; // x = 3 porque los primeros cuatro campo no son de las opciones mas bien son la llave
for x:= 3 to FieldCount - 1 do begin //muestra el nombre del campo
campo := Fields.Fields[x].DisplayName;
for y := 0 to fmenuprincipal.ActionManager1.ActionCount - 1 do
begin //muestra el nombre del actions
with fmenuprincipal.ActionManager1.Actions[y] do
if index = x-3 then
if FieldByName(campo).AsBoolean = false then
enabled := false;
end;
end;
end;
la cosa es que con el for no me esta desabilitando los actions
por favor ayudenme con esto. gracias de antemano
de la manera larga me funciona pero hace mas grande mi codigo.
// Qry_Permisos.Active := true;
// if Qry_Permisos.FieldByName('OP1').AsBoolean = false then
// fmenuprincipal.Action1.Enabled := false;
// if Qry_Permisos.FieldByName('OP2').AsBoolean = false then
// fmenuprincipal.Action2.Enabled := false;
// if Qry_Permisos.FieldByName('OP3').AsBoolean = false then
// fmenuprincipal.Action3.Enabled := false;
// if Qry_Permisos.FieldByName('OP4').AsBoolean = false then
// fmenuprincipal.Action4.Enabled := false;
// if Qry_Permisos.FieldByName('OP5').AsBoolean = false then
// fmenuprincipal.Action5.Enabled := false;
// if Qry_Permisos.FieldByName('OP6').AsBoolean = false then
// fmenuprincipal.Action6.Enabled := false;
// if Qry_Permisos.FieldByName('OP7').AsBoolean = false then
// fmenuprincipal.Action7.Enabled := false;
// if Qry_Permisos.FieldByName('OP8').AsBoolean = false then
// fmenuprincipal.Action8.Enabled := false;
// if Qry_Permisos.FieldByName('OP9').AsBoolean = false then
// fmenuprincipal.Action9.Enabled := false;
// if Qry_Permisos.FieldByName('OP10').AsBoolean = false then
// fmenuprincipal.Action10.Enabled := false;
// if Qry_Permisos.FieldByName('OP11').AsBoolean = false then
// fmenuprincipal.Action11.Enabled := false;
// if Qry_Permisos.FieldByName('OP12').AsBoolean = false then
// fmenuprincipal.Action12.Enabled := false;
// if Qry_Permisos.FieldByName('OP13').AsBoolean = false then
// fmenuprincipal.Action13.Enabled := false;
// if Qry_Permisos.FieldByName('OP14').AsBoolean = false then
// fmenuprincipal.Action14.Enabled := false;
// if Qry_Permisos.FieldByName('OP15').AsBoolean = false then
// fmenuprincipal.Action15.Enabled := false;
// if Qry_Permisos.FieldByName('OP16').AsBoolean = false then
// fmenuprincipal.Action16.Enabled := false;
// if Qry_Permisos.FieldByName('OP17').AsBoolean = false then
// fmenuprincipal.Action17.Enabled := false;
// if Qry_Permisos.FieldByName('OP18').AsBoolean = false then
// fmenuprincipal.Action18.Enabled := false;
// if Qry_Permisos.FieldByName('OP19').AsBoolean = false then
// fmenuprincipal.Action19.Enabled := false;
// if Qry_Permisos.FieldByName('OP20').AsBoolean = false then
// fmenuprincipal.Action20.Enabled := false;
end
El asunto es que necesito hacer esto un poco mejor y opte por utilizar las sentencia for
with qry_permisos do
begin
Active := true;
first; // x = 3 porque los primeros cuatro campo no son de las opciones mas bien son la llave
for x:= 3 to FieldCount - 1 do begin //muestra el nombre del campo
campo := Fields.Fields[x].DisplayName;
for y := 0 to fmenuprincipal.ActionManager1.ActionCount - 1 do
begin //muestra el nombre del actions
with fmenuprincipal.ActionManager1.Actions[y] do
if index = x-3 then
if FieldByName(campo).AsBoolean = false then
enabled := false;
end;
end;
end;
la cosa es que con el for no me esta desabilitando los actions
por favor ayudenme con esto. gracias de antemano