Jump to content

formatting update problems


Mauri

Recommended Posts

I made a new inherited component TUniCustomEdit and connected to data (TFieldDataLink) and I am using the javascript function below to mask formatting:

 

Library:

js / jquery.maskedinput.min.js

 

When I open the dataset in formshow event (TMainForm.UniFormShow) it correctly shows the code formatted in the edit, but if you open the dataset through a click of a button on the form it does not show the formatting.

 

In this screen I have 10 edits one for each table field and then I give the click on button to open the table it just back to properly format all fields (10 fields) when I force formatting again (TCDBEdit.SetMask ...) and put the focus on only one of the fields he hits the formatting of all the others ...

 

It seems you need to call some method to give a refresh on the screen (invalidate type of VCL).

 

Does anyone have any ideas ?

 

 

post-4551-0-93490700-1476801206_thumb.png

 

 

 



unit uniComps;

interface

uses
...
type
TCDBEdit = class(TUniCustomEdit, IUniDBControl)
private
fMask: string;
procedure SetMask(const value: string);
...
protected
procedure LoadCompleted; override;
...
public
constructor Create(AOwner: TComponent); override;
property DataField: WideString read GetDataField write SetDataField;
property DataSource: TDataSource read GetDataSource write SetDataSource;
...
published
...
end;

procedure Register;

implementation

constructor TCDBEdit.Create(AOwner: TComponent);
begin
inherited;
end;

procedure TCDBEdit.LoadCompleted;
begin
inherited;
if WebMode then
begin
JSCode('Ext.onReady ( function () {$("#' + Self.JSName +
'_id-inputEl").mask("' + FMask + '");});');
end;

end;

procedure TCDBEdit.SetMask(const value: string);
begin
FMask := value;
JSCode('Ext.onReady ( function () {$("#' + Self.JSName +
'_id-inputEl").mask("' + FMask + '");});');
end;

...


 

 

 

 

 

 

 

 

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...