visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Delphi :: About TDBRichEdit and SelAttributes?


By: WhelkMaster Great Britain  Date: 06/12/2006 09:25:39  English  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 English  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 English  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 English  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 English  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 English  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 English  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 English  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 English  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 English  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 English  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 English  Type : Comment
Erm, how do I do that please?
By: VGR Date: 26/04/2007 00:19:05 English  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

EContact
browser fav
page generated in 366.552830 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page