Jump to content
  • Advertisement
  • entries
  • comments
  • views

Clipboard woes

Sign in to follow this  


Just been implementing copy and paste in the level editor. It is all working but it is a bit annoying.

With C++ Builder, you access the system clipboard via a TClipboard object. I decided I wanted to be able to copy-paste between my editor and Excel or Notepad and so on, so I'm copying the cell IDs as a text buffer of numbers seperated by tabs and "\r\n" sequences.

First problem is that while TClipboard provides GetTextBuf and SetTextBuf methods, there doesn't appear to be a way of finding out how big the text data in the clipboard is. I've just had to allocate a massive buffer on the heap to copy into but there is no way of detecting that the data was too big for the buffer. Perhaps there is a way of doing this by abandoning TClipboard and using the Win32 API directly, but I can't be bothered.

The other problem is that I can't seem to think of a way of differentiating between text data on the clipboard that is compatible with my editor, and any other text. Means if you copy some normal text then do paste in my level editor, you get some quite strange results.

Never mind. I can't imagine that any one else would ever use my level editor anyway so I don't know why I've just spend three hours making the copy-paste compatible with Excel. I just thought it would be cool.
Sign in to follow this  


Recommended Comments

Cheers for the encouragment [smile].

Game is on hold while I write the level editor but once that's done, the game is nearly ready to go up on the showcase. Hope it is soon since I'm getting a bit bored with it and want to start a new one but I'm trying to make myself finish something for a change.

Share this comment

Link to comment
I hear ya.

I have yet to complete a project, but you seem quite close, keep it up :)

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!