git-svn-id: https://192.168.0.254/svn/Proyectos.Varela_PuntosVenta/trunk@2 1c943782-d109-9647-9548-93b3ac332352
118 lines
3.2 KiB
ObjectPascal
118 lines
3.2 KiB
ObjectPascal
unit uFormPropiedadesControl;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, cxControls, cxContainer, cxEdit, cxTextEdit, cxMemo, StdCtrls,
|
|
JvExControls, JvComponent, JvgWizardHeader, ExtCtrls, ImgList,
|
|
PngImageList, JvExStdCtrls, JvButton, JvCtrls, Menus, JvMenus, ActnList;
|
|
|
|
type
|
|
TfrPropiedadesControl = class(TForm)
|
|
edtNombre: TcxTextEdit;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
bAceptar: TButton;
|
|
memDescripcion: TcxMemo;
|
|
JvgWizardHeader1: TJvgWizardHeader;
|
|
cbModificable: TCheckBox;
|
|
Label3: TLabel;
|
|
Bevel1: TBevel;
|
|
btnIcono: TJvImgBtn;
|
|
ReportImages: TPngImageList;
|
|
JvPopupMenu1: TJvPopupMenu;
|
|
N11: TMenuItem;
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
procedure JvPopupMenu1Popup(Sender: TObject);
|
|
private
|
|
procedure SetDescripcion(const Value: String);
|
|
procedure SetNombre(const Value: String);
|
|
function GetDescripcion: String;
|
|
function GetNombre: String;
|
|
function GetModificable: Boolean;
|
|
procedure SetModificable(const Value: Boolean);
|
|
function GetIcono: Integer;
|
|
procedure SetIcono(const Value: Integer);
|
|
procedure OnMenuItemClick(Sender: TObject);
|
|
public
|
|
property Nombre : String read GetNombre write SetNombre;
|
|
property Descripcion : String read GetDescripcion write SetDescripcion;
|
|
property Modificable : Boolean read GetModificable write SetModificable;
|
|
property Icono : Integer read GetIcono write SetIcono;
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TfrPropiedadesControl.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
begin
|
|
CanClose := Length(edtNombre.Text) > 0;
|
|
if not CanClose then
|
|
ShowMessage('Debe indicar al menos el nombre de este control.');
|
|
end;
|
|
|
|
function TfrPropiedadesControl.GetDescripcion: String;
|
|
begin
|
|
Result := memDescripcion.Lines.Text;
|
|
end;
|
|
|
|
function TfrPropiedadesControl.GetIcono: Integer;
|
|
begin
|
|
Result := btnIcono.ImageIndex;
|
|
end;
|
|
|
|
function TfrPropiedadesControl.GetModificable: Boolean;
|
|
begin
|
|
Result := not cbModificable.Checked;
|
|
end;
|
|
|
|
function TfrPropiedadesControl.GetNombre: String;
|
|
begin
|
|
Result := edtNombre.Text;
|
|
end;
|
|
|
|
procedure TfrPropiedadesControl.SetDescripcion(const Value: String);
|
|
begin
|
|
memDescripcion.Lines.Text := Value;
|
|
end;
|
|
|
|
procedure TfrPropiedadesControl.SetIcono(const Value: Integer);
|
|
begin
|
|
btnIcono.ImageIndex := Value;
|
|
end;
|
|
|
|
procedure TfrPropiedadesControl.SetModificable(const Value: Boolean);
|
|
begin
|
|
cbModificable.Checked := not Value;
|
|
end;
|
|
|
|
procedure TfrPropiedadesControl.SetNombre(const Value: String);
|
|
begin
|
|
edtNombre.Text := Value;
|
|
end;
|
|
|
|
procedure TfrPropiedadesControl.JvPopupMenu1Popup(Sender: TObject);
|
|
var
|
|
AItem : TMenuItem;
|
|
i : integer;
|
|
begin
|
|
JvPopupMenu1.Items.Clear;
|
|
for i := 0 to ReportImages.Count - 1 do
|
|
begin
|
|
AItem := TMenuItem.Create(JvPopupMenu1);
|
|
AItem.OnClick := OnMenuItemClick;
|
|
AItem.ImageIndex := i;
|
|
JvPopupMenu1.Items.Add(AItem);
|
|
end;
|
|
end;
|
|
|
|
procedure TfrPropiedadesControl.OnMenuItemClick(Sender: TObject);
|
|
begin
|
|
btnIcono.ImageIndex := (Sender as TMenuItem).ImageIndex;
|
|
end;
|
|
|
|
end.
|