Jump to content

picyka

uniGUI Subscriber
  • Posts

    1082
  • Joined

  • Last visited

  • Days Won

    34

Posts posted by picyka

  1. Hello people, would be very interesting to be able to put a label on a TUniEdit as native delphi component TLabeledEdit, one that I think would be very useful TUniEdit with a button, and a TUnieditNumber, would be perfect is suggestive.

     

    Regards to all.

  2. it worked, the veses it loses focus, I'm doing another component that could help it follows:

     

     

    unit UniEditFind;

     

    interface

     

    uses

    System.SysUtils,

    System.Classes,

    Vcl.Controls,

    uniGUIBaseClasses,

    uniGUIClasses,

    uniEditText,

    Winapi.Windows,

    uniSpeedButton,

    Vcl.Graphics,

    Messages;

     

    type

    TUniEditFind = class(TUniEditText)

    private

    { Private declarations }

    FOnBtnClick : TNotifyEvent;

    FButton: TUniSpeedButton;

    function GetGlyph : TBitmap;

    procedure SetGlyph(Pic: TBitmap);

    procedure CMVisiblechanged(var Message: TMessage); message CM_VISIBLECHANGED;

    procedure CMEnabledchanged(var Message: TMessage); message CM_ENABLEDCHANGED;

    procedure WMSize(var Message: TWMSize); message WM_SIZE;

    procedure SetEditRect;

    protected

    { Protected declarations }

    procedure aClick (Sender: TObject); virtual;

    public

    { Public declarations }

    constructor Create(AOwner: TComponent); override;

    destructor Destroy; override;

     

    property Button: TUniSpeedButton read FButton;

    property Glyph : TBitmap read GetGlyph write SetGlyph;

    property OnBtnClick : TNotifyEvent read FOnBtnClick write FOnBtnClick;

    published

    { Published declarations }

    end;

     

    procedure Register;

     

    implementation

     

    procedure Register;

    begin

    RegisterComponents('LS Unigui Componentes', [TUniEditFind]);

    end;

     

    { TUniEditFind }

     

    procedure TUniEditFind.aClick(Sender: TObject);

    begin

    if not ReadOnly then

    begin

    iF Assigned(FOnBtnClick) then

    begin

    SetFocus;

    FOnBtnClick(Self);

    end;

    end;

    end;

     

    procedure TUniEditFind.CMEnabledchanged(var Message: TMessage);

    begin

    if Assigned(Self.FButton) then

    Self.FButton.Enabled := Enabled;

    end;

     

    procedure TUniEditFind.CMVisiblechanged(var Message: TMessage);

    begin

    if Assigned(Self.FButton) then

    Self.FButton.Visible := Visible;

    end;

     

    constructor TUniEditFind.Create(AOwner: TComponent);

    begin

    inherited Create(AOwner);

    FButton := TUniSpeedButton.Create(Self);

    FButton.Width := 15;

    FButton.Height := 17;

    FButton.Parent := Self;

    FButton.Cursor:=crHandPoint;

    FButton.ShowHint := True;

    FButton.Hint := 'Consultar <F4>';

    Self.Alignment := taCenter;

    end;

     

    destructor TUniEditFind.Destroy;

    begin

    FButton := nil;

    inherited;

    end;

     

    function TUniEditFind.GetGlyph: TBitmap;

    begin

    Result := FButton.Glyph;

    end;

     

    procedure TUniEditFind.SetEditRect;

    var

    Loc: TRect;

    begin

    SendMessage(Handle, EM_GETRECT, 0, LongInt(@Loc));

    Loc.Bottom := ClientHeight + 1;

    Loc.Right := ClientWidth - FButton.Width - 2;

    Loc.Top := 0;

    Loc.Left := 0;

    SendMessage(Handle, EM_SETRECTNP, 0, LongInt(@Loc));

    SendMessage(Handle, EM_GETRECT, 0, LongInt(@Loc));

    end;

     

    procedure TUniEditFind.SetGlyph(Pic: TBitmap);

    begin

    FButton.Glyph.Assign(Pic);

    end;

     

     

    procedure TUniEditFind.WMSize(var Message: TWMSize);

    var

    MinHeight: Integer;

    begin

    inherited;

    MinHeight := 5;

     

    if Height < MinHeight then

    Height := MinHeight

    else

    if FButton <> nil then

    begin

    FButton.Width := Height;

    if NewStyleControls and Ctl3D then

    FButton.SetBounds(Width - FButton.Width - 4, 0, FButton.Width, Height - 4)

    else

    FButton.SetBounds (Width - FButton.Width, 1, FButton.Width, Height - 1);

    SetEditRect;

    end;

    end;

    end.

     

     

    grateful

    • Upvote 1
  3. yes, but my schedule did not work on the web, what do this wrong, is attached.

     

     

    unit UniEditText;
    
    interface
    
    uses
     System.SysUtils,
     System.Classes,
     Vcl.Controls,
     uniGUIBaseClasses,
     uniGUIClasses,
     uniEdit,
     uniLabel,
     Vcl.Graphics,
     Data.Bind.Components,
     Dialogs;
    
    type
     TUniEditText = class(TUniEdit)
     private
       FNewValue: String;
       FOldValue: String;
       FBindObject: TBindingsList;
       procedure SetBindObject(const Value: TBindingsList);
       { Private declarations }
     protected
       { Protected declarations }
       procedure DoEnter; override;
       procedure DoExit; override;
     public
       { Public declarations }
       constructor Create(AOwner: TComponent); override;
       destructor Destroy; override;
     published
       { Published declarations }
       property OldValue : String read FOldValue write FOldValue;
       property NewValue : String read FNewValue write FNewValue;
       property BindObject : TBindingsList read FBindObject write SetBindObject;
     end;
    
    procedure Register;
    
    implementation
    
    procedure Register;
    begin
     RegisterComponents('LS Unigui Componentes', [TUniEditText]);
    end;
    
    { TUniEditText }
    
    constructor TUniEditText.Create(AOwner: TComponent);
    begin
     inherited Create(AOwner);
    end;
    
    destructor TUniEditText.Destroy;
    begin
     inherited Destroy;
    end;
    
    procedure TUniEditText.DoEnter;
    begin
     Self.FOldValue := Self.Text;
     Self.Color := $00C4FFFF;
     inherited DoEnter;
    end;
    
    procedure TUniEditText.DoExit;
    begin
     if Trim(Self.FNewValue) <> Trim(Self.Text) then
     begin
       if Self.FBindObject <> nil then
         Self.FBindObject.Notify(Self,'Text');
    
       Self.FNewValue := Self.Text;
     end;
    
     Self.Color := clWindow;
     inherited DoExit;
    end;
    
    procedure TUniEditText.SetBindObject(const Value: TBindingsList);
    begin
     FBindObject := Value;
    end;
    
    end. 

  4. How do I override methods

     

    type

    TUniEditText = class(TUniEdit)

    private

    { Private declarations }

    protected

    { Protected declarations }

    procedure DoEnter; override;

    procedure DoExit; override;

    public

  5. Hello, I am delighted with the components, I'm from Brazil, Disclosed in a forum components. The commercial version has some prediction to be released? Turn to the sources? I usually create some components and not the source becomes a little complicated .. Could create the component TLabeledEdit.

     

    grateful

     

    Leandro

×
×
  • Create New...