|
-
Sep 6th, 2000, 01:50 PM
#1
Thread Starter
Lively Member
how do u catch ctrl+v or ctrl+anything...? I'm trying to see if the user pasted text from another place to my textbox. is there a way that keyascii detects ctrl+...?
-
Sep 6th, 2000, 01:53 PM
#2
Thread Starter
Lively Member
ok nevermind... i figured it out.. post reply if you want to know
-
Sep 6th, 2000, 01:55 PM
#3
Thread Starter
Lively Member
is there a way I can access something in clipboard? that is... some string that is copied on to the clipboard..
-
Sep 6th, 2000, 02:08 PM
#4
Here is how to check if something is copied to the clipboard, put it in a Timer if you want to check repeatedly.
Code:
Private Sub Command1_Click()
x = ClipBoard.GetText()
If x <> "" Then
Msgbox "String copied to clipboard: " & x
Else
Msgbox "Nothing on the clipboard."
Exit Sub
End If
-
Sep 7th, 2000, 02:17 PM
#5
Addicted Member
xstopx81:
I would like to know what you found out.
Please share your wisdom...
Pentax
Wilhelm Tunemyr,
Swede in London
[email protected]
"Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
Heinrich Heine (1797-1856)
Pravda vítezi!
(Truth prevails!)
-
Sep 8th, 2000, 01:50 AM
#6
Thread Starter
Lively Member
ok pentax.. this is what i got so far... keyascii detects few keyboard combinations such as ctrl+v or ctrl+x ...etc..
ascii for those are:
ctrl+a = 1,
ctrl+b = 2,
ctrl+c = 3....
and so on with alphabetical orders.. which means that ctrl+v = 22... I'm trying to get the text that's copied and pasted to an invisible richtextbox that i have right now... However, when I get the actual text from the clipboard and try to make rtfInvis.textrtf = clipboard.gettext, it comes out as plain... What i mean is that it doesn't come out as bold, underlined, or whatever the original text was...
hope I could've help and help me on my problem as well.
xstopx81
-
Sep 8th, 2000, 09:08 PM
#7
xstopx81, when text is copied and then pasted into the RichTextBox, it is just plain text.
You'd have to make the font bold yourself.
Code:
RichTextBox1.SelLength = Len(RichTextBox1.Text)
RichTextBox1.SelBold = True
RichTextBox1.SelStart = 0
-
Sep 8th, 2000, 09:28 PM
#8
Frenzied Member
If you use the KeyDown event instead of KeyPress, then the Shift parameter will indicate the status of the shift, ctrl and alt keys. The first bit is a flag for the shift key, the second for ctrl, and the third for alt.
Basically if Shift = 2, 3 or 6 then the ctrl key is down. So you could have something like this:
Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = VbKeyV) And (Shift = 2 Or Shift = 3 Or Shift = 6) Then
'your code here
End If
End Sub
(Oops, just realised I'd written that code wrong and had to edit it)
[Edited by HarryW on 09-09-2000 at 01:26 PM]
Harry.
"From one thing, know ten thousand things."
-
Sep 11th, 2000, 12:35 PM
#9
Thread Starter
Lively Member
matthew... how will i know whether the copied text was originally bold, underlined, or italic? I must know that before setting it bold myself
-
Sep 11th, 2000, 02:59 PM
#10
The SelBold property is True when the font is bold, or setting the SelBold property to True while it is bold will not do anything to it. If you set it to False, it would make it so it's not bold. But, if it makes you more comfortable:
Code:
Private Sub Command1_Click()
RichTextBox1.SelLength = Len(RichTextBox1.Text)
If RichTextBox1.SelBold = True Then
MsgBox "Already bold"
Else
MsgBox "Not bold"
End If
-
Sep 11th, 2000, 03:23 PM
#11
Thread Starter
Lively Member
I dont think you're getting what I'm talking about.. I'm saying that after the user copies a selected text, and then trys to paste it on another rtf box, how will i know if the text in the clipboard had certain properties...
-
Sep 11th, 2000, 03:57 PM
#12
You don't...but you can let them paste it first, then check it with the SelBold property.
-
Sep 11th, 2000, 04:01 PM
#13
Thread Starter
Lively Member
the thing is that if i paste it manually, that is using clipboard.gettext, i get plain text even if the clipboard is holding a bold string
-
Sep 11th, 2000, 04:12 PM
#14
This should work...
Code:
RichTextBox1.SelRTF = Clipboard.GetText(vbCFRTF)
-
Sep 11th, 2000, 04:16 PM
#15
When you paste from the clipboard to the RichTextBox, it will paste as plain text (don't ask me how AOL Instant Messager does it). But, you'd just do something like this:
Code:
Private Sub Command1_Click()
RichTextBox1.text = ClipBoard.GetText()
If RichTextBox1.text <> "" Then
RichTextBox1.SelLength = Len(RichTextBox1.Text)
RichTextBox1.SelBold = True
RichTextBox1.SelStart = 0
Else
Msgbox "No text on the clipboard!", vbCritical
End If
End Sub
-
Sep 11th, 2000, 04:21 PM
#16
Matthew: Setting the Bold directly from the RTB's Font is about 30 times faster than highlighting the text and setting it to bold.
Code:
RichTextBox1.Font.Bold = True
-
Sep 11th, 2000, 04:34 PM
#17
I knew that. But the problem was, I couldn't find it.
I thought it was:
Code:
RichTextBox1.FontBold = True
Like a regular Textbox, but it didn't work, so I just used the SelLength property.
Thanks for showing me the way.
-
Sep 11th, 2000, 05:04 PM
#18
Thread Starter
Lively Member
i think the proper way to paste it and setting it to bold is
Code:
richtextbox1.SelBold = True
' paste
nevermind that... hey matthew or megatron... do u guys know how to make richtextbox have both horizontal and vertical at once? i just made the richtextbox have both but doesn't work..
[Edited by xstopx81 on 09-11-2000 at 06:07 PM]
-
Sep 11th, 2000, 05:30 PM
#19
You mean so it doesn't word wrap? Just set the RightMargin property to some high number.
Code:
RichTextBox1.RightMargin = 10000
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|