Pragmatically start in-place editing |
Post Reply |
Author | |||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
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?
|
|||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
||
Try following:
-- WBR, Serge |
|||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
||
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 |
|||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
||
James,
It works only on manual edit because of a small bug That will be fixed in the next version. -- WBR, Serge |
|||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
||
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 |
|||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
||
No, haven't seen such effect before. Will take a look.
-- WBR, Serge |
|||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
||
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 |
|||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
||
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 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 |
|||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
||
Hello Serge,
Surely the delete key as an accellerator to allow deleting of selected objects is common in many applications.
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?
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 |
|||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
||
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 |
|||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
||
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?
|
|||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
||
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 |
|||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
||
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.
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.
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 |
|||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
||
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 |
|||
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
||
.. 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?
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 |
|||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |