Traver REALbasic for Windows: The Blog

REALbasic discussion and programs specifically for Windows (and some discussion of differences between REALbasic and Visual Basic).

Sunday, April 23, 2006

More on CollectClips: A Windows Clipboard Utility

Somehow - while "moderating comments" on this blog - I managed to mess up and delete a recent comment from Steve Garman, so I'm making it the main contents of this entry, where it should be read by more people anyway.
Here's what Steve had to say:
 __________________________________________
/
Nice utility, but there are a couple of small points I'd make about the Timer1.Action event handler.

I'd hesitate to keep the clipboard open while you mess about with strings. That's very time consuming. Remember the clipboard's locked while it's open and your OS has preemptive threads.

I also can't see any need for all the duplicated code based on whether mainbuffer starts empty or not.

I'd have thought all the code you need is:

Sub Action()
   Dim c As Clipboard
   Dim newText As String
   Dim Count1 As Integer
   Dim EOL As String
   EOL = Left(EndOfLine,1)
   c = New Clipboard
   If c.TextAvailable Then
      newText = c.Text
      c.Close
      If newText <> FormerText Then
         MainBuffer = MainBuffer + EOL + newText + EOL _
            + "________________" + EOL
         EditField1.Text = MainBuffer
         Count1 = CountFields(EditField1.Text, EOL) - 4
         EditField1.Scrollposition = Count1
         FormerText = newText
         Self.Title = FormerText + " " + newText + " " _
            + "B " + Str(Count1)
      End If
   End If
End Sub
\__________________________________________

I appreciate the comments from Steve, because I'm primarily an "idea" person and often need all the help I can get from friends who have more professional expertise than I have. That is, I have lots of ideas for interesting programs and can sometimes (not always) come up with enough code to prove that the idea can become a practical reality, but I often rely on others to make the code more professional and polished.

Barry Traver

0 Comments:

Post a Comment

<< Home