Jump to content

UniButtonEdit


stas

Recommended Posts

  • 3 months later...
  • 3 months later...
  • 2 months later...
  • 2 weeks later...
Replace In 
procedure TUniButtonEdit.ConfigJSClasses(ALoading: Boolean);
from 
  JSObjects.DefaultJSClassName:='Ext.form.TriggerField';
 
to
 
  JSObjects.DefaultJSClassName:='Ext.form.field.Trigger';

 

 

 

  • Upvote 1
Link to comment
Share on other sites

 

Replace In 
procedure TUniButtonEdit.ConfigJSClasses(ALoading: Boolean);
from 
  JSObjects.DefaultJSClassName:='Ext.form.TriggerField';
 
to
 
  JSObjects.DefaultJSClassName:='Ext.form.field.Trigger';

 

 

 

 

 

Works fine!!

Thank you Stas!

Link to comment
Share on other sites

  • 6 months later...

Simple ext.form.triggerfield unigui wrapper

Hi Stas,
 
Thanks for sharing.
Grateful.
 

You might call this component to a form ? When you press the button , do a ShowModal a way , I tried but I failed to show how

 

I appreciate the support you can give me

 

 

code:

unit UniButtonEdit;
 
interface
uses SysUtils,Classes,uniGuiTypes, uniGUIClasses,UniEdit
, uniGUIForm , uniGUIAbstractClasses, uniGUIApplication ,
  uniGUIBaseClasses , controls
;
type
   TIconCls = (action, add, arrow_up, arrow_right, arrow_down, arrow_left, bookmarks, compose, delete, download, favorites, info, more, refresh, reply, search, settings, star, team, time, trash, user);
 
Type
  TUniButtonEdit = class(TUniEdit)
  private
    FOnButtonClick: TNotifyEvent;
    FIconCls: String;
    procedure SetIconCls(const Value: String);
    function GetTriggerCls: String;
    procedure ShowForma;
  protected
    procedure DOHandleEvent(EventName: string; Params: TUniStrings); override;
    procedure ConfigJSClasses(ALoading: Boolean); override;
    procedure LoadCompleted; override;
    procedure Click ; override;    // CRAMIREZ
  public
    constructor Create(AOwner:TComponent); override;
  published
 
     property OnButtonClick:TNotifyEvent read FOnButtonClick write FOnButtonClick;
      property IconCls:String read FIconCls write SetIconCls;
      property triggerCls:String read GetTriggerCls;
 
 
  End;
 
procedure Register;
 
implementation
   uses UniButtonForm ;    // CRAMIREZ
 
 
procedure Register;
begin
  RegisterComponents('uniGUI Custom', [TUniButtonEdit]);
end;
 
{ TUniButtonEdit }
 
function TUniButtonEdit.GetTriggerCls: String;
begin
 if FIconCls<>'' then
 Result:='x-form-'+FIconCls+'-trigger'
 else
 Result:='';
 
 
 
end;
 
 
procedure TUniButtonEdit.ConfigJSClasses(ALoading: Boolean);
begin
  inherited;
  JSObjects.DefaultJSClassName:='Ext.form.TriggerField';
 
 
end;
 
constructor TUniButtonEdit.Create(AOwner: TComponent);
begin
  inherited;
 FIconCls:='search';   //  <----- tipo de icono
 
end;
 
procedure TUniButtonEdit.Click;
begin
  inherited;
  ShowForma;     // CRAMIREZ
end;
 
 
procedure TUniButtonEdit.ShowForma;    // CRAMIREZ
VAR
  FUniButtonForm : TFUniButtonForm;
begin
   text:= 'YYYY';
   TFUniButtonForm.create(uniapplication);
  FUniButtonForm.SHOWMODAL(
   procedure(Sender: TComponent; Result: Integer)
   var
    i:Integer;
   begin
      // LOGIN OK
      if Result = mrOk then begin
      end ;
      if Result = mrcancel then begin
      end;
   end)
 
 
end;
 
procedure TUniButtonEdit.DOHandleEvent(EventName: string; Params: TUniStrings);
 
begin
 
if (EventName='buttonclick') then begin
 
 if Assigned(FOnButtonClick) then
   FOnButtonClick(Self);
 
end;
 
 inherited;
 
 
end;
 
procedure TUniButtonEdit.LoadCompleted;
begin
  inherited;
 
if WebMode then
begin
 if FIconCls<>'' then
 JSCode('triggerCls:"'+triggerCls+'"');
 JSCode('hideTrigger:false');
 JSAfterCreate(JSName+'.onTriggerClick=function(){ajaxRequest('+JSName+',"buttonclick",[]);};');
 
end;
end;
 
 
 
procedure TUniButtonEdit.SetIconCls(const Value: String);
begin
  FIconCls := Value;
end;
 
 
end.
 

 

Link to comment
Share on other sites

  • 1 year later...
  • 7 months later...
  • 4 weeks later...
  • 3 months later...
  • 5 months later...

Hi,

 

If I understand you correctly, you can use triggers config for this:

http://forums.unigui.com/index.php?/topic/7969-how-to-add-a-search-icon-in-tuniedit/&do=findComment&comment=54542

 

This dowonload link already contains the update for ExtJS6 using the JSConfigObject to create the triggers.

If any user already uses the TUniButtonEdit in their projects, they can upgrade to that version that will work on the UniGUI Beta 1.0.2+  and higher versions.

 

And it also contains the UniButtonEditv6 package for ExtJS6 and new versions of UniGUI.

 

https://mega.nz/#!LlV1XRSA!TVMUEYGOlV-7Dp7TxyNt68BtXfRW2Pt7SLTS-0JQAS0

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...