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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...