Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 10-03-2012
Avatar de duilioisola
[duilioisola] duilioisola is offline
Miembro Premium
 
Registrado: ago 2007
Ubicación: Barcelona, España
Posts: 1.806
Poder: 22
duilioisola Es un diamante en brutoduilioisola Es un diamante en brutoduilioisola Es un diamante en bruto
Código Delphi [-]
//      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;

Código Delphi [-]
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;

El Index de la propiedad Actions[y] solo te da la posición dentro de la lista de acciones.
Supongo que deberías utilizar un método que te asegure que estás habilitando o deshabilitado la accion que quieres.
Por ejemplo, podrías utilizar su nombre o utilizar la propiedad Tag.

Yo en tu caso utilizaría algo así:

Código Delphi [-]
...
         // muestra el nombre del actions             
        for i := 0 to ComponentCount - 1 do
        begin
           if Components[i] is TAction then
           begin
              // Si el componente que busco se llama Action"nnn"
              // En realidad debería llamarse igual que en numero despues del nombre del campo OP"nnn" 
              if (TAction(Components[i]).Name = 'Action' + IntToStr(x)) then
                 TAction(Components[i]).Enabled := FieldByName(campo).AsBoolean;
           end;
        end;
...
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Sentencias SQL con BLOBS Franinho Firebird e Interbase 6 08-11-2010 17:56:59
Completar sentencias SQL eldiegofg SQL 4 27-07-2007 18:01:17
Sentencias sql GustavoCruz Conexión con bases de datos 2 15-01-2007 08:52:07
Variables en sentencias sql ekimo MySQL 11 17-06-2005 21:37:55
Manipular Fechas con sentencias SQL Héctor Randolph SQL 5 06-02-2005 06:25:38


La franja horaria es GMT +2. Ahora son las 23:38:43.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi