Mauri Posted October 18, 2016 Posted October 18, 2016 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 ? 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; ... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.