Jump to content

BantuKumar

Recommended Posts

Hi,

 

I have my custom controls that I have derived from different classes like TComponent, TControls, TWinControl, TCustomPanel etc. Now I want to use them into UniGUI application. I do not want to rewrite the code of my control for UniGUI, what I want is to change/modify the implementation (wherever required) so that I can use the same control over UniGUI application.

 

As of now I tried to change the hierarchy of my controls to corresponding UniGUI classes such as TUniControl, TUniComponent etc. and overridden few methods such as ConfigJSClasses, VCLControlClassName, WebCreate etc. but it is not working as I am expecting.

 

Please suggest is this the right way to go?

If Yes then what else is required to make is work?

If NO then please suggest a solution for this?

 

Thanks in Advance.

Link to comment
Share on other sites

Hi,

 

Creating a custom uni component is same as delphi.Create a bpl package, add references and write component unit. In delphi that Unit's parent is usually TControl therefore in unigui parent is usually TUniControl.

 

Your Unit uses some Unit like uniGUIBaseClasses, uniGUIClasses.

 

Every uniGUI component need thoose procedures in protected area

procedure LoadCompleted; override;
procedure ConfigJSClasses(ALoading: Boolean); override;
procedure WebCreate; override;

this procedures inherited parented class.  LoadCompleted usally uses to add JSConfig properties to Component.

For example

procedure TUniColorPalette.LoadCompleted;
begin
  inherited;
  JSConfig('someConfig', [FConfigValue]); // FConfigValue defined in unit's private area
end;

this someConfig came from ExtJS class you use.

 

ConfigJSClasses uses to define which ExtJS class you use. This class is here http://docs.sencha.com/extjs/4.2.3/#!/api

If you create new component this procedure is something like that

procedure TUniColorPalette.ConfigJSClasses(ALoading: Boolean);
begin
  inherited;
  JSObjects.DefaultJSClassName:='Ext.somepackage.SomeExtJSClass';
end;

If you create a component that parent some other uniComponent inherited is enough.

 

WebCreate procedure uses to value assignment in your component.

For Example

procedure TUniCustomCheckBox.WebCreate;
begin
  inherited;
  Width := 97;
  Height := 17;
end;

Also you need a Constructure. It also uses to value assignment.

It's like

constructor TUniBaseButton.Create(AOwner: TComponent);
begin
  inherited;
  Width:=75;
  Height:=25;
  ParentColor := False;
end;

After all is done, build and install your package. It's add your component wherever you choose.

 

For more information you can examine an uniComponent units.

Link to comment
Share on other sites

Hi,

 

Creating a custom uni component is same as delphi.Create a bpl package, add references and write component unit. In delphi that Unit's parent is usually TControl therefore in unigui parent is usually TUniControl.

 

Your Unit uses some Unit like uniGUIBaseClasses, uniGUIClasses.

 

Every uniGUI component need thoose procedures in protected area

procedure LoadCompleted; override;
procedure ConfigJSClasses(ALoading: Boolean); override;
procedure WebCreate; override;

this procedures inherited parented class.  LoadCompleted usally uses to add JSConfig properties to Component.

For example

procedure TUniColorPalette.LoadCompleted;
begin
  inherited;
  JSConfig('someConfig', [FConfigValue]); // FConfigValue defined in unit's private area
end;

this someConfig came from ExtJS class you use.

 

ConfigJSClasses uses to define which ExtJS class you use. This class is here http://docs.sencha.com/extjs/4.2.3/#!/api

If you create new component this procedure is something like that

procedure TUniColorPalette.ConfigJSClasses(ALoading: Boolean);
begin
  inherited;
  JSObjects.DefaultJSClassName:='Ext.somepackage.SomeExtJSClass';
end;

If you create a component that parent some other uniComponent inherited is enough.

 

WebCreate procedure uses to value assignment in your component.

For Example

procedure TUniCustomCheckBox.WebCreate;
begin
  inherited;
  Width := 97;
  Height := 17;
end;

Also you need a Constructure. It also uses to value assignment.

It's like

constructor TUniBaseButton.Create(AOwner: TComponent);
begin
  inherited;
  Width:=75;
  Height:=25;
  ParentColor := False;
end;

After all is done, build and install your package. It's add your component wherever you choose.

 

For more information you can examine an uniComponent units.

 

Thank you form sharing this information. It will be helpful.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...