Jump to content

Mauri

uniGUI Subscriber
  • Posts

    49
  • Joined

  • Last visited

Posts posted by Mauri

  1. The problem of using maxvalue is that it does not limit the amount of characters entered, only validates the range of values! I need to limit how many characters the user is typing! Would not have something through Javascript or something similar?

  2. I made a new component inherited from TUniEdit and would like to implement their own validation on the server side. Then on the server side when the onExit event is fired I want to validate some information and when some data is different from what I'm hoping I want the component stay with the red border showing that it is invalid. When invalid component should show the same color as the TUniNumberEdit component displays when the entered value is less than the MinValue property. 

     

     

    post-4551-0-24682800-1476565160_thumb.png

     

     

     

     



    unit ISComponetField;

    interface

    uses Classes, Vcl.Graphics, DesignIntf, Controls, DBCtrls, DB,
    UniGUIClasses, UniGUIInterfaces, uniGUICoreInterfaces,
    UniGUITypes, UniEdit;

    type

    TISField = class(TUniEdit)
    private
    ...
    procedure getExitEdit(Sender: TObject);
    ...
    protected
    procedure LoadCompleted; override;
    public
    ...
    published
    ...
    end;

    procedure Register;

    implementation

    procedure TISField.getExitEdit(Sender: TObject);
    var
    bValidate: boolean;
    begin
    bValidate:= true;
    // Here I will do all my validations
    ...
    if not bValidate then
    begin
    // Here I would like to call a method or change a property to display the field with a red border
    end;
    end;


    procedure TISField.LoadCompleted;
    begin
    inherited;
    OnExit:= getExitEdit;
    end;

    ...




    Best Regards,

     

     

    Mauri

     

    Member ID: 00404


     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  3. I am creating a custom component and looked UniGUI other components to see the methods used to manipulate data for example TUniCustomDBComboBox, TUniCustomDBMemo! In all they have an assignment for InternalReadOnly variable (InternalReadOnly: = not AllowEdit) and also compared the variable 'SelfUpdating', but realized that this variable is in UniGUIClasses class. I have put this class in the uses clause and when compiling is showing the following messages:
     
    Undeclared identifier: 'InternalReadOnly'
    Undeclared identifier: 'SelfUpdating'
     
    What could be wrong?
     
    Examples where it is being using:
     
     
    unit ISComponet;
    
    interface
    
    uses Classes, Vcl.Graphics, DesignIntf, Controls, DBCtrls, DB,
         UniPanel, UniGUIClasses, UniGUIInterfaces, uniGUICoreInterfaces,
         UniGUITypes, UniDBUtils;
    
    type
    
      TISComb = class(TISBase, IUniDBControl)
      private
        ...
        procedure ActiveChange(Sender: TObject);
        ...
      protected
        procedure DataChange(Sender: TObject); virtual;
        ...   
      public
        ...
      published
        ...
      end;
    
    procedure Register;
    
    implementation
    
    procedure TISComb.ActiveChange(Sender: TObject);
    begin
      if (not IsDesigning) and (not IsDestroying) then
        InternalReadOnly:= not AllowEdit;  // Here give problem compiling
    end; 
    
    procedure TISComb.DataChange(Sender: TObject);
    begin
      if SelfUpdating then // Here give problem compiling
        Exit;
      ...
    end;
    
    ...
    

    Best Regards,

     

     

    Mauri
     
    Member ID: 00404
     
     
     
     
     
     
     
     

     

  4. In my Delphi application I have a Memo component custom inherited from TCustomMemo class that has an implementation in onKeyPress method so that when the user clicks twice in a row the ENTER key the focus goes to the next component.

      TIDMemo = class(TCustomMemo)
      private
        ...
        fTabEnter: Boolean;
        fKeyAnt: Char;
      protected
        ...
        procedure KeyPress(var Key: Char); override;
      public
        ...
      published
        ... 
      end;
    
    
    procedure TIDMemo.KeyPress(var Key: Char);
    begin
      if ((key = #13) and (fKeyAnt = #13) and fTabEnter) or
        ((key = #13) and (MaxLength > 0) and (length(Lines.Text) > MaxLength - 2) and fTabEnter) then
        if (Lines.Count > 0) then
          if (trim(Lines.Strings[Lines.Count - 1]) = '') or (length(Lines.Text) > MaxLength - 2) then
            begin
              key:= #0;
              inherited;
              if (trim(Lines.Strings[Lines.Count - 1]) = '') then
                key:= #8;
              keybd_event(9,0,0,0); // Triggers TAB Key
              exit;
            end;
      fKeyAnt:= Key;
      inherited;
    end;
    
    
  5. I am using the version of 0.99.96.1328 UniGUI / Delphi XE6 and i using the component TUniDBLookupComboBox. 

     

    The RemoteQuery property is set to true and when I type one component character triggers the OnRemoteQuery event properly. If I enter for example the word health component triggers the OnRemoteQuery event and shows the popup with the data returned from the query (OK!). The problem occurs when I return to the backspace key or I click on ClearButton button and it clears the search field ... if I type another word it triggers the event OnRemoteQuery correctly, but if I return to typing the same word have research ( as in the example the word health) OnRemoteQuery the event is not triggered. It seems that the component means that when the same word is typed it does not fire the event again! How can I initialize the component to always triggers OnRemoteQuery event ?

     

     

     

     

     

     

     

  6. I am using the version of 0.99.96.1328 UniGUI / Delphi XE6 and created a new inherited component TUniDBLookupComboBox. I'm using the property clearbutton true and would like to execute a statement when the user clicks the X button (ClearButton). Is there any event that triggers the component when it is clicked the X (ClearButton)? How can I handle this event?

     

    Best Regards,

     

    Mauri

     

  7. I am starting to use the UniGUI framework and I'm creating a new child component inherited from TUniDBLookupComboBox. In this component I need some different behaviors and one of them is an additional research. I have this same component running on the VCL and it creates a query component in the component creation event, making it easier for the programmer does not need to add a TQuery component for each Lookup! I wonder if I can do this using UniGUI as reading the forum I realized that the data connection components need to be in specific places (MainDataModulo or Form)! I'm asking this because my component is giving a memory error and do not know if this is related to ownership of the built in component TQuery

     

    Best Regards

     

    Mauri

     

    Sample:

    ======

      TDBLookup = class(TUniDBLookupComboBox)
      private
        fQuery: TSQLQuery;
    	function SearchRecord: boolean;
    	...
      protected
    	...
      public
        constructor Create(AOwner: TComponent); override;
        destructor Destroy; override;
      published
    	...
      end;
    
    procedure Register;
    
    implementation
    
    constructor TDBLookup.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      fQuery:= TSQLQuery.Create(Self);
      ...
    end;
    
    destructor TDBLookup.Destroy;
    begin
      try
        if Assigned(fQuery) then
          FreeAndNil(fQuery);
      finally
    	...
      end;
      inherited Destroy;
    end;
    
    function TDBLookup.SearchRecord: boolean;
    begin
      try	
    	fQuery.sql.text:= 'Select field from table where ...';
    	fQuery.open;
    	...
      finally
      end;  
    end;
    
    procedure Register;
    begin
      RegisterComponents ('COMPS',[TDBLookup]);
    end;
    
    initialization
    finalization
    
    end.
    

     

×
×
  • Create New...