Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 14-12-2009
LiAnTe- LiAnTe- is offline
Miembro
 
Registrado: oct 2007
Posts: 47
Poder: 0
LiAnTe- Va por buen camino
Privileged instruction

Hola a Tod@s,

estoy creando botones en tiempo de ejecucion y le quiero asignar un OnClick a cada boton pero despues de crear este codigo....

Código Delphi [-]
procedure TGesVentasBar.FormCreate(Sender: TObject);
var vPersonalNombre : String;
    vTop            : Integer;
    vInicio         : Integer;
    vPestanya       : TWinControl;
    vBotonOnClick   : TNotifyEvent;

begin
  ListaImagenes := TStringlist.Create;

  Boton := TButton.create(self);
  boton.Caption := 'Hola';
  boton.Height := 120;
  boton.Left := 20;
  boton.Width := 130;
  boton.Enabled := True;
  Boton.visible := True;
  boton.Show;

  vTop := 1;
  vPestanya := Personal;
  vInicio := 1;

  BDades.TPersonal.Active := False;
  BDades.TPersonal.SelectSQL.Text := 'Select * from Personal where tienda = ' + '''' + BDades.TConfigTIENDA.Text + '''';
  BDades.TPersonal.Open;
  BDades.TPersonal.Active := True;
  BDades.TPersonal.First;

    While BDades.TPersonal.Eof = False do
     Begin
      vPersonalNombre := BDades.TPersonal.FieldByName('NOMBRE').AsString;
      vPersonalCodigo := BDades.TPersonal.FieldByName('CODIGO').AsInteger;

      Boton := TButton.create(self);
      boton.Parent  := vPestanya;
      boton.Caption := vPersonalNombre;
      boton.Height  := 69;
      boton.Width   := 120;
      boton.Left    := vInicio;     // Inicio
      boton.Top     := vTop;     // Altura
      boton.Enabled := True;
      Boton.visible := True;
      Boton.Tag     := vPersonalCodigo;
      Boton.OnClick := vBotonOnClick;
//      ShowMessage('Se ha pulsado el botón :' + TButton(Sender).Name);


      boton.Show;
      BDades.TPersonal.Next;
      vTop := vTop + 70;

      if vTop > 420 Then
      Begin
        vInicio := 1;
        vTop := 1;
        vPestanya := Personal2;
      end;
    end;

end;

      procedure TGesVentasBar.vBotonOnClick(Sender: TObject);
      Begin
        ShowMessage(inttostr(vPersonalCodigo));
//        Vendedor.text := vPersonalCodigo;
        Case TButton(Sender).Tag of
          1 : Showmessage(TButton(Sender).Name);
          2 : Showmessage(TButton(Sender).Name);
        end;
      end;

cuando pulso en el boton me pone Privileged instruction alguien me puede ayudar?

saludos.

Última edición por Neftali [Germán.Estévez] fecha: 14-12-2009 a las 12:50:42. Razón: Añadidas etiquetas TAG's
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
Privileged Instruction ajgomezlopez Lazarus, FreePascal, Kylix, etc. 4 22-03-2009 14:30:27
Privileged instruction luis1980 C++ Builder 3 29-08-2008 08:02:13
QReport. Error "Privileged instruction" adebonis Impresión 0 11-12-2004 07:34:42
Rave -- Privileged Instruction altp Impresión 0 19-07-2004 18:33:12
privileged instruction Juan C Robles Varios 1 31-10-2003 03:14:45


La franja horaria es GMT +2. Ahora son las 10:53:41.


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