Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 04-03-2013
teecweb teecweb is offline
Miembro
NULL
 
Registrado: feb 2013
Posts: 64
Poder: 14
teecweb Va por buen camino
Talking

Asi creo mi control de checkbolist..el codigo es para un instalador inno setup y innosetup utiliza el pascal que es parecido al delphi bueno es lo que segun investigue
Código Delphi [-]
[code]
//CODIGO PARA ONCLICK

 var 
  Page: TWizardPage;
  Buttona TNewButton;
   CheckListBox1: TNewCheckListBox;

procedure uninstaller(Sender: TObject);
begin        
        MsgBox('Indice item actual: '+IntToStr(Integer(CheckListBox1.ItemIndex)),mbInformation, MB_OK);

end;

procedure CreateTheWizardPages;
  var 

  Edit: TNewEdit;
  PasswordEdit: TPasswordEdit;
  listado: TStrings;
  inicio: Integer;
  scale : Integer;
  scale1:Integer;
  j:Integer;
  n: integer;

begin
  { TButton and others }
  Page := CreateCustomPage(wpSelectDir, 'Custom wizard page controls', 'TButton and others');

  Buttona := TNewButton.Create(Page);
  Buttona.Width := ScaleX(75);
  Buttona.Height := ScaleY(23);
  Buttona.Caption := 'TNewButton';
  Buttona.Parent := Page.Surface;
  Buttona.Visible := true;
   Buttona.OnClick := @ButtonOnClick;

                scale :=8;
             for inicio:= 1 to 10 do
             begin
             CheckListBox1 := TNewCheckListBox.Create(Page);
               j :=5; 
                scale :=scale+ (j+15);
                CheckListBox1 := TNewCheckListBox.Create(Page);//TNewCheckListBox.Create(WizardForm.ScriptDlgPanel);
                CheckListBox1.Top := Buttona.Top + Buttona.Height + ScaleY(scale);
                CheckListBox1.Width := 410;
                CheckListBox1.Height :=40;
                CheckListBox1.Parent := Page.Surface;
                CheckListBox1.OnClick:=@uninstaller;
                CheckListBox1.AddCheckBox('Item'+IntToStr(inicio), 'qwqw', 0, False, True, True, True, nil);
             end;
end;

ya eh probado el codigo que usted me mando..y lo eh hecho asi como esta arriba..aun asi me bota el index -1..gracias por su pronta respuesta...En el codigo que me envio hay eventos asi 'TForm1.FormCreate' en inno setup no se genera estos eventos .
Responder Con Cita
  #2  
Antiguo 04-03-2013
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
teecweb,

Cita:
Empezado por teecweb
...cada vez que hago click a mi funcion uninstaller me deberia devolver la posicion de los checkboxlist por MsgBox...

Revisa este código:
Código Delphi [-]
procedure TForm1.BitBtn1Click(Sender: TObject);
var
   i : Integer;
   Index : Integer;
begin
   ListBox1.Clear;
   for i := 0 to CheckListBox1.Count - 1 do
   begin
      Index := CheckListBox1.Items.IndexOf(CheckListBox1.Items.Strings[i]);
      ListBox1.Items.Add(IntToStr(Index));
   end;
end;
El código anterior devuelve el índice de cada elemento de un control TCheckListBox en un control TListBox.


Revisa este código:
Código Delphi [-]
procedure TForm1.CheckListBoxClick(Sender: TObject);
var
   i : Integer;
begin
   for i := 0 to CheckListBox1.Count - 1 do
      if CheckListBox1.Selected[i] then
         ShowMessage(IntToStr(i));
end;
El código anterior devuelve el índice de un elemento seleccionado del control TCheckListBox por medio del evento OnClick.


Revisa este código:
Código Delphi [-]
procedure TForm1.CheckListBoxClick(Sender: TObject);
begin
   ShowMessage(IntToStr(CheckListBox1.ItemIndex));
end;
Este código es una variante más simple del anterior por medio del evento OnClick.


Los códigos anteriores funcionan en Delphi, quizás funcionen de forma similar en Inno Setup y se puedan adaptar a tu Instalador.

Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 04-03-2013 a las 05:27:39.
Responder Con Cita
  #3  
Antiguo 04-03-2013
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola teecweb.

Mi respuesta fué por el título de tu primer mensaje "Agregar ID a checkboxlist en delphi", pero tratándose de Inno setup cambia un poco la cosa.

Nunca había realizado un script para Inno setup, pero basándome en parte en tu código y revisando un poco aquí: Pascal Scripting: Support Classes Reference, hice unas pruebas y en este ejemplo se muestran el texto y los índices de los items seleccionados en el TNewChekListBox como respuesta del evento OnClick de Buttona:
Código Delphi [-]
[Setup]
AppName='Test'
AppVerName='Test'
DefaultDirName={pf}\test

[code]
var 
  Page: TWizardPage;
  Buttona: TNewButton;
  CheckListBox1: TNewCheckListBox;

procedure ButtonOnClick(Sender: TObject);
var
  i: Integer;
begin
  for i:= 0 to CheckListBox1.Items.Count -1 do
    if CheckListBox1.Checked[i] then  // ¿ El item está seleccionado ? 
      MsgBox('Caption: ' + CheckListBox1.Items[i]+ #10#13 +   // Caption del item
             'Indice : ' + IntToStr(i), mbInformation, MB_OK); // Indice del item
end;

procedure CreateTheWizardPages;
var 
  inicio: Integer;
  scale : Integer;
begin
  Page := CreateCustomPage(wpSelectDir, 'Custom wizard page controls', 'TButton and others');

  Buttona := TNewButton.Create(Page);
  Buttona.Width   := ScaleX(75);
  Buttona.Height  := ScaleY(23);
  Buttona.Caption := 'TNewButton';
  Buttona.Parent  := Page.Surface;
  Buttona.Visible := true;
  Buttona.OnClick := @ButtonOnClick;
 
  CheckListBox1 := TNewCheckListBox.Create(Page);  
  CheckListBox1.Width   := 410;
  CheckListBox1.Height  := 180; 
  CheckListBox1.Parent  := Page.Surface;
  CheckListBox1.ItemIndex:= 0; 
  CheckListBox1.Top := Buttona.Top + Buttona.Height + ScaleY(scale); 

  for inicio:= 1 to 5 do
     CheckListBox1.AddCheckBox('Item' + IntToStr(inicio), IntToStr(inicio), 0, False, True, True, True, nil);
end;

procedure InitializeWizard();
begin
  CreateTheWizardPages
end;
Espero te oriente para lograr lo que estás buscando.

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
  #4  
Antiguo 04-03-2013
teecweb teecweb is offline
Miembro
NULL
 
Registrado: feb 2013
Posts: 64
Poder: 14
teecweb Va por buen camino
Gracias por sus respuestas estare probando el codigo
Responder Con Cita
  #5  
Antiguo 04-03-2013
teecweb teecweb is offline
Miembro
NULL
 
Registrado: feb 2013
Posts: 64
Poder: 14
teecweb Va por buen camino
Talking

Holas si ya funciono.gracias...pero quisiera hacer una consulta mas:

Una vez que ya recorrio bien los indices y recuperar los nombres de los check se procede a desistalar :
por ejemplo la lista que se recorre:
c:\Program Files\rcv1.1\
c:\Program Files\rcv1.2\



Código Delphi [-]
procedure ButtonOnClick(Sender: TObject);
var
  i: Integer;
  var path,FileName: String;
begin
  path := CheckListBox1.Items[i];
if MsgBox('Do you really want to delete ' + ExtractFileDir(path) + '?', mbConfirmation, MB_YESNO) = idYes then
  begin
  for i:= 0 to CheckListBox1.Items.Count -1 do
             //unistaler
             begin
              if DirExists(ExtractFileDir(path)) then 
              begin
               CheckListBox1.Checked[i]:=true; 
//Aqui me llega un path por ejemplo : c:\Program Files\rcv1.2\ ..y dentro hay un directorio llamado
//Desinstalar dentro de este directorio hay un 'unins000.exe' y shellexec lo ejecuta mediante el procedimeinto 'desistalarItem'
                  FileName:=ExtractFileDir(path)+'\Desinstalar\'+'unins000.exe';
                     desistalarItem(FileName); 
               end    
               else
                          MsgBox('no existe',mbInformation, MB_OK);             
end;
end;         
end;
//procedimiento para desistalacion los .exe existentes
***********Mi dificultad es cuando shellexec se ejecuta ya sea para una desistalacion correcta o incorrecta sale del bucle y vuelve a recorrer el bucle..y yo en realidad no necesito que salga del bucle sino que siga con el siguiente indice..



si algo fallo en la desistalacion sale el error y sino ejecuta normalmente y el bucle empieza denuevo
y cuando el bucle empieza denuevo ahi es mi dificultad porque necesito que normalmente siga el bucle y no salga de el
Código Delphi [-]
 procedure desistalarItem(const FileName: string);
 var
  ErrorCode: Integer;
                     begin
                     if not ShellExec('',FileName,'', '', SW_SHOW, ewNoWait, ErrorCode) then
                           begin
                           // handle failure if necessary
                            MsgBox('DeinitializeSetup:' #13#13 'Execution of ''' + FileName + ''' failed. ' + SysErrorMessage(ErrorCode) + '.', mbError, MB_OK);
                           end
                     end;

por favor si hay alguna suegerencia estare muy pendiente..gracias por sus respuestas
Responder Con Cita
  #6  
Antiguo 05-03-2013
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
teecweb,

Cita:
Empezado por teecweb
...y cuando el bucle empieza denuevo ahi es mi dificultad porque necesito que normalmente siga el bucle y no salga de el...
El código que publicastes en el Msg #10 lo modifique según entiendo como debería funcionar tu Desinstalador en Inno Setup.

Revisa este código:
Código Delphi [-]
procedure ButtonOnClick(Sender: TObject);
var
   i : Integer;
   path,FileName : String;

begin
   if MsgBox('Do you really want to delete ' + ExtractFileDir(path) + '?', mbConfirmation, MB_YESNO) = idYes then
   begin
      for i := 0 to CheckListBox1.Items.Count - 1 do
      begin
         path := CheckListBox1.Items[i];
         if CheckListBox1.Checked[i] = true then
            if DirExists(ExtractFileDir(path)) then
            begin
               FileName := ExtractFileDir(path) + '\Desinstalar' + '\unins000.exe';
               DesistalarItem(FileName);
            end
            else
               MsgBox('No Existe un Desinstalador Asociado',mbInformation, MB_OK);             
      end;
   end;        
end;

procedure DesistalarItem(const FileName: string);
var
    ErrorCode : Integer;

begin
    if not Exec(FileName,'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
    begin
       MsgBox('DeinitializeSetup:' #13#13 'Execution of ''' + FileName + ''' failed. ' + SysErrorMessage(ErrorCode) + '.', mbError, MB_OK);
    end
end;
El código anterior recorre el arreglo de Items del control TCheckListbox y por cada item seleccionado llama al procedimiento DesistalarItem

El cambio de ShellExec por Exec esta basado en la información de este link: http://www.jrsoftware.org/ishelp/ind...=scriptclasses

Nota: Este código no esta probado en Inno Setup.

Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 05-03-2013 a las 05:08:23.
Responder Con Cita
  #7  
Antiguo 05-03-2013
teecweb teecweb is offline
Miembro
NULL
 
Registrado: feb 2013
Posts: 64
Poder: 14
teecweb Va por buen camino
gracias por su respuesta probare el codigo..
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Recorrer checkboxlist en pascal para un realizar en INNOSETUP teecweb Varios 1 02-03-2013 07:23:48
Agregar mas colores de fuente a Delphi candylolz OOP 5 07-08-2012 16:37:55
Agregar una linea en uses en delphi 10 piruchin Varios 3 11-04-2011 12:57:24
Agregar componente Delphi 8 elaprendizprog Impresión 4 20-03-2009 18:11:23
Agregar sonido en Delphi jescar .NET 2 17-09-2006 08:30:04


La franja horaria es GMT +2. Ahora son las 03:40:42.


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