Ver Mensaje Individual
  #3  
Antiguo 31-12-2007
[egostar] egostar is offline
Registrado
 
Registrado: feb 2006
Posts: 6.557
Reputación: 25
egostar Va camino a la fama
Hola Dec

Este es el código

Código Delphi [-]
 
unit RegEditor_D10;
 
interface
 
uses Windows, Forms, Controls, Classes, DesignIntf, DesignEditors, Dialogs,
     RegEditor, USubKey;
 
Type
  TKeyProperty = class (TStringProperty)
    function GetAttributes : TPropertyAttributes; override;
    procedure GetValues(Proc : TGetStrProc); override;
    function GetValue : string; override;
    procedure SetValue(const Value: string); override;
  end;
 
  TSubKeyProperty = class(TPropertyEditor)
    function GetAttributes : TPropertyAttributes; override;
    function GetValue : string; override;
    procedure Edit; override;
  end;
 
procedure Register;
 
implementation
 
procedure Register;
begin
  RegisterPropertyEditor(TypeInfo(String),TRegEditor,'Key',TKeyProperty);
  RegisterPropertyEditor(TypeInfo(String),TRegEditor,'SubKey',TSubKeyProperty);
  RegisterComponents('Samples', [TRegEditor]);
end;
 
function TKeyProperty.GetAttributes : TPropertyAttributes;
begin
  Result:=[paValueList];
end;
 
Procedure TKeyProperty.GetValues(Proc : TGetStrProc);
begin
  Proc('HKEY_CLASSES_ROOT');
  Proc('HKEY_CURRENT_USER');
  Proc('KEY_LOCAL_MACHINE');
  Proc('HKEY_USERS');
  Proc('HKEY_CURRENT_CONFIG');
end;
 
function TKeyProperty.GetValue : string;
begin
  Result:= GetStrValue;
end;
 
procedure TKeyProperty.SetValue(const Value: string);
begin
  SetStrValue(Value);
  designer.Modified;
end;
 
function TSubKeyProperty.GetAttributes : TPropertyAttributes;
begin
  Result:=[paDialog];
end;
 
function TSubKeyProperty.GetValue : string;
begin
  Result:= GetStrValue;
end;
 
procedure TSubKeyProperty.Edit;
begin
  frmSubKey := TfrmSubKey.Create(Application);
  try
    frmSubKey.Caption := 'Selecciona SubKey';
    // Aqui quiero pasar el valor de la Key a la forma frmSubKey
    frmSubKey.ShowModal;
    if frmSubKey.ModalResult = mrOK then begin
       SetStrValue(frmSubKey.stSubKey.Caption);
       designer.Modified;
    end;
  finally
    frmSubKey.Free;
  end;
end;
 
end.

Gracias

Salud OS
__________________
"La forma de empezar es dejar de hablar y empezar a hacerlo." - Walt Disney
Responder Con Cita