Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 4 of 4 total |
Grid functionality |
Sun, Apr 22 2012 3:51 PM | Permanent Link |
thomh | Hi Tim,
Have spent a couple of days with EWB, I'm loving what I'm seeing so far. Been toying with the idea of slowly porting a large accountant application written in D2007 over to the web and this product would be ideal for this. In that regard I was wondering if you could comment on a couple of things: 1) Are you planning on introducing a Tab control component? 2) Since all my customers are accountants, they are used to having their right hand on the numeric pad, punching numbers and pressing Enter. I therefore need the following grid functionality: a) Make the Enter key behave like the Tab key b) Being able to enter edit mode immediately when user starts typing in the cell c) After user enters a value in a cell, pressing Enter would leave edit mode and automatically move to the next column. Is there a way to do this with the existing grid? If not, could some properties be introduced which would accomplish this behavior. Thanks. // Thom |
Mon, Apr 23 2012 12:50 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Thom,
<< Have spent a couple of days with EWB, I'm loving what I'm seeing so far. >> Great, that's good to hear. << 1) Are you planning on introducing a Tab control component? >> Yes, as soon as v1 is out the door. My next task after the v1 release is to use EWB to create a web interface for our other DB product ElevateDB, and it needs a tab interface for its web UI. << 2) Since all my customers are accountants, they are used to having their right hand on the numeric pad, punching numbers and pressing Enter. I therefore need the following grid functionality: a) Make the Enter key behave like the Tab key b) Being able to enter edit mode immediately when user starts typing in the cell c) After user enters a value in a cell, pressing Enter would leave edit mode and automatically move to the next column. Is there a way to do this with the existing grid? If not, could some properties be introduced which would accomplish this behavior. >> Yes, and yes. b) is not entirely possible, due to the way that the browser events work, but to force the editor to be shown in the grid after the form is created/shown, just use the ShowEditor method. There's also HideEditor and ToggleEditor methods. To intercept Enter keystrokes and make them move to the next column, etc., you can do something like this: function TForm2.Grid1KeyDown(Sender: TObject; Key: Integer; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin if (not (ShiftKey or CtrlKey or AltKey)) and (Key=VK_RETURN) then begin Grid1.NextColumn; Result:=False; // Be sure to return False so that the default key down processing doesn't execute end; end; There is a NextColumn, PriorColumn, etc. method for the grid. The complete list is here (no docs on them yet, though): http://www.elevatesoft.com/manual?action=viewcomp&id=ewb1&comp=TGrid The NextColumn and PriorColumn methods return a Boolean that indicate if they were able to navigate or not, so you can use this to determine when to go to the next/prior row. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Apr 26 2012 2:54 PM | Permanent Link |
thomh | Hi Tim,
I have done testing around the grid component. Can you trap VK_F2 to show the editor? When you press the ENTER key or double-click to enter edit mode, you do a SelectAll on the text. However, if you position the cursor at the end of the current text and start to write it still overwrites the content. Note that this only seems to happen the the first time you do an edit. I also notice that occasionally that pressing ESC to exit edit mode does not work. Concerning this example code in your reply: function TForm2.Grid1KeyDown(Sender: TObject; Key: Integer; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin if (not (ShiftKey or CtrlKey or AltKey)) and (Key=VK_RETURN) then begin Grid1.NextColumn; Result:=False; // Be sure to return False so that the default key down processing doesn't execute end; end; First of all, when you override this event, except for the ENTER key, all the other movement keys stops working. I tried your suggested code above to trap the Enter key. It works as long as you are not in edit mode. When you are in edit mode and hit ENTER I would like to close the editor and then move to the next column. Is that possible? And concerning being able to enter edit mode immediately when user starts typing in the cell. Are you sure there is nothing you can do here? It is a feature my clients are so used to that it would be a major show stopper not to have it. This is the code I use for the Developer Express grid's OnKeyPress event in the Win App. Is there nothing similar that can be done in JavaSCript? procedure TfrmPLAcLn.gridKeyPress(Sender: TObject; var Key: Char); begin // Used in conjunction with automatically showing editor if (Sender as TdxDBTreeList).FocusedField.ReadOnly = FALSE then if Key in [^H, ^V, ^X, #32..#255] then PostMessage(Handle, CM_SHOWEDITOR, Integer(Sender), Integer(PChar(Key))); end; procedure TfrmPLAcLn.CMShowEditor(var Msg: TMessage); begin // Used for automatically showing editor when user starts typing if not ((TdxDBTreeList(Msg.WParam).InplaceEditor <> nil) and TdxDBTreeList(Msg.WParam).InplaceEditor.IsVisible) then TdxDBTreeList(Msg.WParam).ShowEditorChar(Char(Msg.LParam)); end; Thanks again for your time. // Thom |
Fri, Apr 27 2012 10:40 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Thom,
<< Can you trap VK_F2 to show the editor? >> Yes. << When you press the ENTER key or double-click to enter edit mode, you do a SelectAll on the text. However, if you position the cursor at the end of the current text and start to write it still overwrites the content. Note that this only seems to happen the the first time you do an edit. I also notice that occasionally that pressing ESC to exit edit mode does not work. >> If you're using IE, then you're going to see some funky things happen with the key handling in terms of selection, overwriting, etc. IE is not very good at acting like a normal Windows application, in this respect. << First of all, when you override this event, except for the ENTER key, all the other movement keys stops working. >> Sorry, forgot the "else" portion: function TForm2.Grid1KeyDown(Sender: TObject; Key: Integer; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin if (not (ShiftKey or CtrlKey or AltKey)) and (Key=VK_RETURN) then begin Grid1.NextColumn; Result:=False; // Be sure to return False so that the default key down processing doesn't execute end else Result:=True; end; << I tried your suggested code above to trap the Enter key. It works as long as you are not in edit mode. When you are in edit mode and hit ENTER I would like to close the editor and then move to the next column. Is that possible? >> I'll have to look into this further before I could comment on whether it would be possible. << And concerning being able to enter edit mode immediately when user starts typing in the cell. Are you sure there is nothing you can do here? It is a feature my clients are so used to that it would be a major show stopper not to have it. >> I doubt very much if this will be possible. I'll look into it, but can't make any promises. << This is the code I use for the Developer Express grid's OnKeyPress event in the Win App. Is there nothing similar that can be done in JavaScript? >> In general, trying to compare Windows code with code that runs in the browser will be a disappointment - the two are using completely different event models, and the browser event model has a lot of restrictions that Windows does not have. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, April 17, 2024 at 10:35 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |