Results 1 to 10 of 10

Thread: Disable RichTextBox own paste code... help!

  1. #1

    Thread Starter
    Hyperactive Member Trojan's Avatar
    Join Date
    Dec 2003
    Location
    Area 51
    Posts
    280

    Unhappy Disable RichTextBox own paste code... help!

    I am making my own notepad, and when i paste text to my RitchTextBox, the text comes with it's own format...
    how can I prevet the font change ??

    Thanks in advanced.
    MD5How To Detect Disk In Drive X?Time Tickerchanging the owner of a controlSystray HardCore

    • "Programming is like sex: one mistake and you have to support it for the rest of your life."
    • "A program is a spell cast over a computer, turning input into error messages."
    • "WARNING: Keyboard Not Attached. Press F10 to Continue."
    • "Why doesn't DOS ever say 'EXCELLENT command or filename!'"

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Disable RichTextBox own paste code... help!

    In the Change event of the RTB, set the Font type (and/or Font Size) to whatever you want.

    Any text pasted into will be in the font type/size format.

  3. #3

    Thread Starter
    Hyperactive Member Trojan's Avatar
    Join Date
    Dec 2003
    Location
    Area 51
    Posts
    280

    Re: Disable RichTextBox own paste code... help!

    when I change the font will it change the font of the text that I have pasted, or to the entire RTB ??

    can you give me an example?
    MD5How To Detect Disk In Drive X?Time Tickerchanging the owner of a controlSystray HardCore

    • "Programming is like sex: one mistake and you have to support it for the rest of your life."
    • "A program is a spell cast over a computer, turning input into error messages."
    • "WARNING: Keyboard Not Attached. Press F10 to Continue."
    • "Why doesn't DOS ever say 'EXCELLENT command or filename!'"

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Disable RichTextBox own paste code... help!

    Quote Originally Posted by Trojan
    when I change the font will it change the font of the text that I have pasted, or to the entire RTB ??

    can you give me an example?
    It will change the font for the entire RTB, but that it what it sounds like you want to do.

    Example: Your RTB standard font is MS Sans Serif. You paste something into the box that is Arial. Now, you have two different fonts types (as suggested by your original question). If, in the change event your set your font to MS Sans Serif, it will change the Arial that was pasted to that, but all the rest of the text will remain unchanged because it is already MS Sans Serif.

  5. #5

    Thread Starter
    Hyperactive Member Trojan's Avatar
    Join Date
    Dec 2003
    Location
    Area 51
    Posts
    280

    Re: Disable RichTextBox own paste code... help!

    mmm...
    but you see when I do that, the entire rtb goes bad... it loses the format...

    What I was thinking is to disable the built-in paste the RTB has, then all I have to do is to make my code put the text in the text box, without the any format set to it...
    MD5How To Detect Disk In Drive X?Time Tickerchanging the owner of a controlSystray HardCore

    • "Programming is like sex: one mistake and you have to support it for the rest of your life."
    • "A program is a spell cast over a computer, turning input into error messages."
    • "WARNING: Keyboard Not Attached. Press F10 to Continue."
    • "Why doesn't DOS ever say 'EXCELLENT command or filename!'"

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Disable RichTextBox own paste code... help!

    Quote Originally Posted by Trojan
    mmm...
    but you see when I do that, the entire rtb goes bad... it loses the format...

    What I was thinking is to disable the built-in paste the RTB has, then all I have to do is to make my code put the text in the text box, without the any format set to it...
    Ok. So you have your own "paste" routine that you want to use instead Windows "paste"?

    I'm not getting what you mean by "make my code put the text in..."

  7. #7

    Thread Starter
    Hyperactive Member Trojan's Avatar
    Join Date
    Dec 2003
    Location
    Area 51
    Posts
    280

    Re: Disable RichTextBox own paste code... help!

    Quote Originally Posted by Hack
    Ok. So you have your own "paste" routine that you want to use instead Windows "paste"?
    That is what I ment. that way I can control what format I Paste the text and control other stuff...
    MD5How To Detect Disk In Drive X?Time Tickerchanging the owner of a controlSystray HardCore

    • "Programming is like sex: one mistake and you have to support it for the rest of your life."
    • "A program is a spell cast over a computer, turning input into error messages."
    • "WARNING: Keyboard Not Attached. Press F10 to Continue."
    • "Why doesn't DOS ever say 'EXCELLENT command or filename!'"

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Disable RichTextBox own paste code... help!

    Quote Originally Posted by Trojan
    That is what I ment. that way I can control what format I Paste the text and control other stuff...
    Well, the richtextbox, like the standard textbox, has its own right mouse click popup menu which you can replace with your own.

    You could also clear the clipboard if they pressed Ctrl-V in your textbox so they couldn't use Windows to do the paste.

  9. #9

    Thread Starter
    Hyperactive Member Trojan's Avatar
    Join Date
    Dec 2003
    Location
    Area 51
    Posts
    280

    Re: Disable RichTextBox own paste code... help!

    well...
    If I make a menu Item with shortcut "Ctrl+V" set it does not bypass the paste code of the windows...

    I guess I need to find a solution in API...
    MD5How To Detect Disk In Drive X?Time Tickerchanging the owner of a controlSystray HardCore

    • "Programming is like sex: one mistake and you have to support it for the rest of your life."
    • "A program is a spell cast over a computer, turning input into error messages."
    • "WARNING: Keyboard Not Attached. Press F10 to Continue."
    • "Why doesn't DOS ever say 'EXCELLENT command or filename!'"

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Disable RichTextBox own paste code... help!

    Quote Originally Posted by Trojan
    well...
    If I make a menu Item with shortcut "Ctrl+V" set it does not bypass the paste code of the windows...

    I guess I need to find a solution in API...
    You can capture Ctrl_V in the keydown event of your RTB
    VB Code:
    1. Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
    2.  If (Shift And vbCtrlMask) = vbCtrlMask And KeyCode = vbKeyV Then
    3.     'do something else - clear the clipboard maybe
    4.  End If
    5. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width