Pragmatically start in-place editing
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=3652
Printed Date: 10 November 2024 at 4:38pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Pragmatically start in-place editing
Posted By: JamesH
Subject: Pragmatically start in-place editing
Date Posted: 14 February 2006 at 5:46pm
I would like to have a button from my toolbar activate in-place editing of a specific column in the selected row. I can get in-place editing working based on a user selecting the cell but I don't want editing to be activated accidentally so would like to force them to activate it from a toolbar (or maybe a right click menu).
How can I pragmatically switch a cell to in-place editing mode?
|
Replies:
Posted By: sserge
Date Posted: 15 February 2006 at 8:46am
Try following:
wndReportControl.EditItem wndReportControl.Rows(1), wndReportControl.Columns(5)
|
-- WBR, Serge
|
Posted By: JamesH
Date Posted: 17 February 2006 at 11:37am
Hey Serge,
Thanks! That's exactly want I needed the only issue is that even though I have SelectTextOnEdit set to TRUE it select the text when using the EditItem call, it only works when the user manually starts in-place editing.
Any suggestions?
Cheers,
- James
|
Posted By: sserge
Date Posted: 17 February 2006 at 2:34pm
James,
It works only on manual edit because of a small bug
That will be fixed in the next version.
-- WBR, Serge
|
Posted By: JamesH
Date Posted: 17 February 2006 at 2:40pm
No worries Serge, thanks for letting me know.
My latest issue, (I haven't investigated it fully but thought I'd check with you now incase it's a known issue) is when I am editing something in-place any keys that are assigned to a command bars option don't work. Eg. if I assign 'a' to a command I can no longer type 'a' in the in-place editor. Is this something you have encountered before?
Thanks,
- James
|
Posted By: sserge
Date Posted: 20 February 2006 at 11:59am
No, haven't seen such effect before. Will take a look.
-- WBR, Serge
|
Posted By: JamesH
Date Posted: 20 February 2006 at 12:28pm
Thanks Serge,
I was able to reproduce it using the task list sample on a different machine but since our main enviroment is C++ and there are no report control C++ samples I need to wait until a machine with C# is available. All I did was assign the [Del] key to a menu item and it ment I was unable to use delete during in-place editing.
If you are unable to reproduce it yourself let me know and I will try to get access to a C# machine to send you a sample. (although some C++ (ATL) report control sample would always be nice )
Cheers,
- James
|
Posted By: sserge
Date Posted: 22 February 2006 at 9:47am
James,
It is recommended to have unique accellerator keys for menu items access. However, to resolve this issue you have to forward this key processing to the control. For more details see also http://support.microsoft.com/default.aspx?kbid=180402 - http://support.microsoft.com/default.aspx?kbid=180402
Regarding C++ samples -- as you probably already know we definitely have some, but only for C++/MFC version of the control If you use C++, why not to use corresponding version of the toolkit, what would additionally provide you with more flexibility...
-- WBR, Serge
|
Posted By: JamesH
Date Posted: 22 February 2006 at 10:44am
Hello Serge,
sserge wrote:
It is recommended to have unique accellerator keys for menu items access. |
Surely the delete key as an accellerator to allow deleting of selected objects is common in many applications.
sserge wrote:
However, to resolve this issue you have to forward this key processing to the control. For more details see also http://support.microsoft.com/default.aspx?kbid=180402 - http://support.microsoft.com/default.aspx?kbid=180402 |
Thank you for the link, however I'm not certain where this forwarding should happen, according to the link it is in the edit control (which is the in-place editing control) but this is in the active-x control. How would I go about adding a preTranslateMessage handler to that?
sserge wrote:
If you use C++, why not to use corresponding version of the toolkit, what would additionally provide you with more flexibility... |
I wish we could. It would make lots of things much simpler however we are constrained to ATL due to some of our other libraries.
Thanks for the help,
- James
|
Posted By: sserge
Date Posted: 23 February 2006 at 3:01pm
James,
As a possible solution you can try to find your in-place edit control from its screen position with WindowFromPoint API method. Then forward translating a message right there.
If it wouldn't help, try to cut a simple example from your solution and attach it for me for an additional review.
-- WBR, Serge
|
Posted By: JamesH
Date Posted: 23 February 2006 at 3:09pm
Is there a way to disable accelerator handling with-in command bars? Maybe when the in-place editing starts I could disable the key handing in command bars and then re-enable it when in-place editing stops?
|
Posted By: sserge
Date Posted: 24 February 2006 at 3:52pm
Yes, this could be a solution. However, I'm not sure whether it is possible for command bars in current version. However, I also think this solution is too "heavy" to for your case.
Also, actually for me using an accelerator for Del key is not a good idea. A lot of different controls could have an internal need to process Del key and all of them wouldn't be able to do that. Easiest way to resolve this problem would be to change an accelerator in the application to Shift+Del or Ctrl+Del...
Another idea, you can delegate processing of Del key from ReportControl.OnKeyDown to command bar handler.
-- WBR, Serge
|
Posted By: JamesH
Date Posted: 24 February 2006 at 4:10pm
sserge wrote:
Yes, this could be a solution. However, I'm not sure whether it is possible for command bars in current version. However, I also think this solution is too "heavy" to for your case. |
Is there any chance this could be added to command bars? While I agree it may not be the best solution it would resolve my problem.
sserge wrote:
Also, actually for me using an accelerator for Del key is not a good idea. |
Perhaps it depends on the type of application. PaintShop Pro uses Del as it's 'Clear' accelerator, and Visual Studio (6.0) has Del as it's Delete accelerator. In our application delete is a commonly used command and keyboard input is hardly used (similar to a drawing or CAD program) for this reason we like to have easy to use accelerators as one hand is always on the mouse.
sserge wrote:
Another idea, you can delegate processing of Del key from ReportControl.OnKeyDown to command bar handler. |
An interesting idea. This would be a possible solution except the report control is in a docking pane that is only visible sometimes. When the pane is not up (or does not have focus) we would need to pass off the delete key from other windows. Even worse is the keyboard shortcuts are user configurable so someone might choose to use the 'd' or space key instead of 'del'. We would need to have special handling for all different user accelerators and it would get quite messy.
It seems to me some type of communication with command bars to tell it not to trap the keys at certain times would be very useful.
Best regards,
- James
|
Posted By: sserge
Date Posted: 25 February 2006 at 4:36am
James,
Ok, 2 more last proposals on how it could be resolved without patching a toolkit
- Vice versa, when you catch Del key in your command bar handler, forward key down message (SendMessage) to a currently active window -- an inplace edit box when editing, etc;
- Process Del key not as an accelerator, but as a key down/up handlers in your application.
-- WBR, Serge
|
Posted By: JamesH
Date Posted: 27 February 2006 at 11:11am
sserge wrote:
Ok, 2 more last proposals on how it could be resolved without patching a toolkit |
.. I'm sure I can come up with some work-around. Although ideally some change to the toolkit would be nice. Should I submit it as a feature request?
sserge wrote:
-Vice versa, when you catch Del key in your command bar handler, forward key down message (SendMessage) to a currently active window -- an inplace edit box when editing, etc;
- Process Del key not as an accelerator, but as a key down/up handlers in your application. |
Both of those sound like good suggestions, however my issue isn't just with the delete key. Our keyboard short-cuts are fully customizable so if someone changes an accelerator to a different key I would need to search through all the command bars menu items to determine what short cut key is being used and handle it appropriately. Perhaps when the in-place edit has focus the command bars shouldn't respond to any thing?
For now I think I will drop the use of in-place editing, but if you could investigate the issue for the next patch release it would be appreciated.
Thanks,
- James
|
|