|
-
Nov 13th, 2000, 09:08 AM
#1
Thread Starter
Lively Member
Hi guys!
I want to add an "Edit" menu in my menu bar of my application. I just want to add basic stuff like cut, copy, paste, and maybe undo too. All my controls are textboxes and combos, so i'll just be cutting and pasting strings and text. How do I go about implementing this?
Also, I want to add a "Help" menu, how do I make those standard help files in most windows applications?
Thanks in advance for all the help
-
Nov 13th, 2000, 09:15 AM
#2
Fanatic Member
I use the following for Select All, Cut, Copy and Paste.
Code:
Private Sub mnuSelectAll_Click()
rtfData.SelStart = 0
rtfData.SelLength = Len(rtfData.text)
rtfData.SetFocus
End Sub
Private Sub mnuFileCut_Click()
Clipboard.Clear
Clipboard.SetText rtfData.SelText
rtfData.SelText = ""
rtfData.SetFocus
End Sub
Private Sub mnuFileCopy_Click()
Clipboard.Clear
Clipboard.SetText rtfData.SelText
rtfData.SetFocus
End Sub
Private Sub mnuFilePaste_Click()
rtfData.SelText = Clipboard.GetText()
rtfData.SetFocus
End Sub
The Clipboard object is shared by all Windows applications, so you do not need to declare it in VB.
I found code for UNDO in this forum before. It involves setting up an array to store the keystroke changes.
-
Nov 13th, 2000, 09:20 AM
#3
Fanatic Member
-
Nov 13th, 2000, 10:38 AM
#4
Thread Starter
Lively Member
Thanks now i know about the clipboard stuff, but the code only works if i only have one text box. I have different controls and textboxes in my application. How do I apply it to all?
-
Nov 13th, 2000, 10:51 AM
#5
Thread Starter
Lively Member
Thanks jbart
Nevermind I figured it out already! Thanks jbart for pointing me to the right direction, you were a great help
-
Nov 13th, 2000, 05:40 PM
#6
Thread Starter
Lively Member
just wondering, is there a nifty way of keeping track if there is something in the clipboard? I want the paste to be enabled only if there is something in the clipboard. Anyone know a way to do this?
-
Nov 13th, 2000, 05:48 PM
#7
To keep track, paste the contents of the clipboard into a variable:
Code:
Dim ClipData As String
ClipData = Clipboard.GetText()
If ClipData <> "" Then
Msgbox "Data on clipboard!"
Else
Msgbox "No data on clipboard!"
End If
-
Nov 13th, 2000, 06:35 PM
#8
When working with a RichTextBox, you should use the flag vbCFRTF to store and paste the data in RichText Format.
Code:
Private Sub mnuSelectAll_Click()
rtfData.SelStart = 0
rtfData.SelLength = Len(rtfData.Text)
rtfData.SetFocus
End Sub
Private Sub mnuFileCut_Click()
Clipboard.Clear
Clipboard.SetText rtfData.SelText, vbCFRTF
rtfData.SelText = ""
rtfData.SetFocus
End Sub
Private Sub mnuFileCopy_Click()
Clipboard.Clear
Clipboard.SetText rtfData.SelText, vbCFRTF
rtfData.SetFocus
End Sub
Private Sub mnuFilePaste_Click()
rtfData.SelText = Clipboard.GetText(vbCFRTF)
rtfData.SetFocus
End Sub
-
Nov 14th, 2000, 03:29 AM
#9
Thread Starter
Lively Member
This is great I always learn something new! Thanks guys! Now all I need is to make a nifty help file, does anyone know where I can get started? Been looking for a tutorial but can't seem to find one, I must suck at this 
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
|