Ario.Paxaz Posted July 10, 2018 Share Posted July 10, 2018 Hi How to I can check Control Key (Ctrl , Alt , Shift ) in OnColumnSort Event? I want do job 1 in OnColumnSort Event and when user press Ctrl and click on column do another job. Best Regards. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 10, 2018 Share Posted July 10, 2018 Hi, Are you already using multi sorting? Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted July 10, 2018 Author Share Posted July 10, 2018 Are you already using multi sorting? No Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 11, 2018 Share Posted July 11, 2018 Hi, Maybe through with "global" listeners: 1. procedure TMainForm.UniFormCreate(Sender: TObject); begin with UniDBGrid1 do begin UniSession.AddJS('document.addEventListener("keydown", function(e){if (e.ctrlKey){ajaxRequest('+JSName+', "_keydownup", ["ctrlKey="+e.ctrlKey])}})'); UniSession.AddJS('document.addEventListener("keyup", function(e){if (!e.ctrlKey){ajaxRequest('+JSName+', "_keydownup", ["ctrlKey="+e.ctrlKey])}})'); end; end; 2. public { Public declarations } ctrlKey: Boolean; end; 3. procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_keydownup' then ctrlKey := StrToBool(Params.Values['ctrlKey']) end; 4. procedure TMainForm.UniDBGrid1ColumnSort(Column: TUniDBGridColumn; Direction: Boolean); begin if ctrlKey then ... end; Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted July 11, 2018 Administrators Share Posted July 11, 2018 Let me remind that using JS code proposed by our moderator above should be done at your own risk. We can't guarantee that above code will work, fit your purpose and will be compatible with future versions of Ext JS. Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 11, 2018 Share Posted July 11, 2018 Let me remind that using JS code proposed by our moderator above should be done at your own risk. We can't guarantee that above code will work, fit your purpose and will be compatible with future versions of Ext JS. Thanks Yes, he's right! And forgive me, that I give you such decisions it is better to open a request in our support portal, we will try to realise this feature Best regards, Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 11, 2018 Share Posted July 11, 2018 Better use like this: 1. UniForm -> KeyPreview = True 2. public { Public declarations } ctrlKey: Boolean; end; 3. procedure TMainForm.UniFormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin ctrlKey := ssCtrl in Shift; end; procedure TMainForm.UniFormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin ctrlKey := ssCtrl in Shift; end; 4. procedure TMainForm.UniDBGrid1ColumnSort(Column: TUniDBGridColumn; Direction: Boolean); begin if ctrlKey then ... end; Quote Link to comment Share on other sites More sharing options...
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.