Languages :: Delphi :: About TDBRichEdit and SelAttributes? |
|||
| By: WhelkMaster |
Date: 06/12/2006 09:25:39 |
Points: 20 | Status: Answered Quality : Excellent |
|
Hi there! I'm using one of these TDBRichEdits for accessing a Paradox field. I've arranged so that the user can highlight text and then press Ctrl+B will give toggle the selected text with a bold appearance and Ctrl+U will do the same with underlining. These two features work fine. I've also tried to do this with Ctrl+I for an Italic effect but the control does wierd things! The selected text becomes invisible and sometimes it gets deleted all together! Has anyone else experienced this problem? Thanks for reading. |
|||
| By: VGR | Date: 06/12/2006 22:57:32 | Type : Comment |
|
| Hello, I haven't experienced exactly this problem, but you may very well have a conflict problem with other key hooks / shortcuts. I suppose you did the things right, but you should perhaps check again that you set the form's properties to not propagate those key codes and handle them internally. This said, Ctrl-I isn't a standard combination for anything special (unlike Alt-F4 or Ctrl-V for instance) so it's a weird problem. Sorry, I can't be more specific without having your DPR file and all the stuff ;-) |
|||
| By: WhelkMaster | Date: 07/12/2006 00:24:58 | Type : Comment |
|
| Thanks for your comments. Would you like to take a look at the code? | |||
| By: VGR | Date: 07/12/2006 07:14:03 | Type : Comment |
|
| why not ? beware of differences in Delphi versions for some components. I don't use later than D7 (ie, I don't have D2003 etc) | |||
| By: WhelkMaster | Date: 07/12/2006 09:44:36 | Type : Comment |
|
| I'm not sure how to post code here! Is it appropriate to do so using this message box? I don't want to upset anyone! |
|||
| By: VGR | Date: 07/12/2006 14:21:27 | Type : Comment |
|
| well, if it's too long or consists of multiple files, make an archive (ZIP...) and put it somewhere on the net where I can look at it. Or send via email at vgr[ /at/ ]europeanexperts[/dot/]org if it's short enough, place it here between CODE tags regards |
|||
| By: WhelkMaster | Date: 08/12/2006 18:57:21 | Type : Comment |
|
| OK, thanks for that. Here's the code which, I think, traps the Key presses on my TDBRichEdit :- procedure TfrmMain.dbrLogDetailsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if ssCtrl in Shift then begin case Key of Ord('B') : begin if fsBold in dbrLogDetails.SelAttributes.Style then dbrLogDetails.SelAttributes.Style := dbrLogDetails.SelAttributes.Style - [fsBold] else dbrLogDetails.SelAttributes.Style := dbrLogDetails.SelAttributes.Style + [fsBold]; end; Ord('I') : begin if fsItalic in dbrLogDetails.SelAttributes.Style then dbrLogDetails.SelAttributes.Style := dbrLogDetails.SelAttributes.Style - [fsItalic] else dbrLogDetails.SelAttributes.Style := dbrLogDetails.SelAttributes.Style + [fsItalic]; end; Ord('U') : begin if fsUnderline in dbrLogDetails.SelAttributes.Style then dbrLogDetails.SelAttributes.Style := dbrLogDetails.SelAttributes.Style - [fsUnderline] else dbrLogDetails.SelAttributes.Style := dbrLogDetails.SelAttributes.Style + [fsUnderline]; end; end; end; end; It seems to me that the Ctrl+I key combination puts a TAB into the controls edit area? I don't know if this is supposed to happen! What do you think? Thanks for your time. |
|||
| By: VGR | Date: 08/12/2006 20:30:02 | Type : Comment |
|
| what I would do if I were you, is to run step by step/with stoppoint to check no other handler interfepts the Ctrl-I, because the use you do is correct. alternatively, use a debugger or throw out debugging exceptions it seems you're NOT entering your Ord('I') case above |
|||
| By: OpConsole | Date: 03/01/2007 18:49:29 | Type : Comment |
|
| If the above comment was helpful, please close the Question appropriately ; if not, then provide some more feedback so that our Experts may help you. Thanks. |
|||
| By: WhelkMaster | Date: 25/04/2007 08:47:34 | Type : Comment |
|
| Thanks for all your input. I opted for an easy way out! I found a button component that links to any RichEdit control and does all the formatting stuff for you. It seems to work just fine. Thanks for your time. I found the component here : bepp.8m.com Thanks to Branko Dimitrijevic. |
|||
| By: VGR | Date: 25/04/2007 14:06:45 | Type : Comment |
|
| cool. I'm happy for you and I'm sure I will have a look at that component one of those days. Now close the Question please ;-) |
|||
| By: WhelkMaster | Date: 25/04/2007 15:50:30 | Type : Comment |
|
| Erm, how do I do that please? | |||
| By: VGR | Date: 26/04/2007 00:19:05 | Type : Answer |
|
| probably with the +/++/+++ answer quality selector, and then with the A like "accept' or if splitting between people, checking various "P" checkboxes before pressing one "P" (sPlit or Part?) those are top-right of each comment |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








