Jump to content

Lahrach Hakim

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Lahrach Hakim

  1. Hi,

     

    I try to learn fast how create unigui web component , so I have get from samples -control1- and I try to add property like changing color button.

    The component that I have modified can not change color, I don't know why

    I have try to attach the modified code but there is error when uploading file (Error You aren't permitted to upload this kind of file)

    Can you help me please.

    This is the code below :

    //-------------------------------------------------------------------------------------------------------------------
    unit UniCustomControl1;
    interface
    uses
      SysUtils, Classes, Controls, uniGUIBaseClasses, uniGUIClasses,
      extctrls,Graphics;
    type
      // TUniControl is base for all visual controls
      // TuniControl is not a container and can not be a parent for other TUniControls
      TUniMyButton = class(TUniControl)
      private
        { Private declarations }
        FHrefTarget : string;
        FHref : string;
        FPressed : Boolean;
        fLedColor : TColor;
        fIsLedOn : boolean;
      protected
        function GetLedColor : TColor;
        procedure SetLedColor (LedColor : TColor);
        procedure ConfigJSClasses(ALoading: Boolean); override;
        function VCLControlClassName: string; override;
        function GetHref: string;
        procedure SetHref(const Value: string);
        procedure InternalSetCaption(Value: string); override;
        function GetHrefTarget: string;
        procedure SetHrefTarget(const Value: string);
        procedure WebCreate; override;
        procedure LoadCompleted; override;
      public
        constructor Create(AOwner: TComponent); override;
      published
        property Href: string read GetHref write SetHref;
        property HrefTarget: string read GetHrefTarget write SetHrefTarget;
        property Pressed: Boolean read FPressed write FPressed default False;
        property LedColor : TColor read GetLedColor write SetLedColor;
        property Caption;
        property RTL;
      end;
    procedure Register;
    implementation
    procedure TUniMyButton.SetLedColor (LedColor : TColor);
    begin
      if FLedColor<>LedColor then
      begin
        FLedColor:=LedColor;
        JSProperty('LedColor', [fLedColor], 'SetLedColor');
      end;
    end;
    function TUniMyButton.GetLedColor : TColor;
    begin
         Result := fLedColor;
    end;
    procedure TUniMyButton.ConfigJSClasses(ALoading: Boolean);
    begin
      JSObjects.DefaultJSClassName:='Ext.button.Button';
    end;
    function TUniMyButton.VCLControlClassName: string;
    begin
      Result:='';
    end;
    constructor TUniMyButton.Create(AOwner: TComponent);
    begin
      inherited;
      Width:=85;
      Height:=25;
      FHrefTarget := '_blank';
    end;
    procedure TUniMyButton.WebCreate;
    begin
      inherited;
      JSConfig('border', [5]);
      JSConfig('LedColor',  [GetLedColor]);
    end;
    procedure TUniMyButton.LoadCompleted;
    begin
      inherited;
      JSConfig('pressed', [FPressed]);
    end;
    function TUniMyButton.GetHref: string;
    begin
      Result:=FHref;
    end;
    procedure TUniMyButton.SetHref(const Value: string);
    begin
      if FHref<>Value then
      begin
        FHref:=Value;
        JSProperty('href', [FHref], 'setHref');
      end;
    end;
    function TUniMyButton.GetHrefTarget: string;
    begin
      Result:=FHrefTarget;
    end;
    procedure TUniMyButton.SetHrefTarget(const Value: string);
    begin
      if FHrefTarget<>Value then
      begin
        FHrefTarget:=Value;
        JSProperty('hrefTarget', [FHrefTarget]);
      end;
    end;
    procedure TUniMyButton.InternalSetCaption(Value: string);
    begin
      inherited;
      JSProperty('text', [Value], 'setText');
    end;
    procedure Register;
    begin
      RegisterComponents('uniSamples', [TUniMyButton]);
    end;
    end.
    //-------------------------------------------------------------------------------------------------------------------

    Thank you

  2. Hi,

     

    I have build web page with menu application, I want to capture each choice from menu and execute module reagarding each sub menu.

     

    Thank"s

  3. Hi,

     

    Thank's for ypur express reply.

     

    UniUrlframe

         ClientEvts

             ExtEvts

                 Click  (java script).

     

    If not, is there is way to communicate with uniUrlFrame

     

    Thank's

  4. Hi,

     

    I have try using the UniURLFrame, the click event does not work, I have only put alert('XXXX'); but nothing it comes.

     

    Thank's for helping.

     

    Hakim

     

  5. Hi,

     

    I have build form with Unidac connection in web uni application.

    But when loading the form i get the follow error :

     

     

    OLE DB error occured. Code 800401F0h.
    CoInitialize has not been called.

     

    Thank you.

     

  6. Salam Farshad,

     

    What do you mean about Four sample projects.

    I have search in demo folder.

    My question is about what is the similair of  TCustomControl (VCL application) in UNIGUI WEB APPLICATION.

     

     

    ND :If you want I can send you the source of the component.

     

     

    Thank you so much for your help.

×
×
  • Create New...