Hello,
How would you go about copying data to and from the clipboard in BBCSDL?
I checked the manual and found information relating to BB4W ( http://www.bbcbasic.co.uk/bbcwin/manual ... gclipboard ) but it seems like it doesn't work in BBCSDL - I get a 'no such system call' error.
BBCSDL: Using the clipboard
-
- Posts: 177
- Joined: Mon 02 Apr 2018, 21:51
BBCSDL: Using the clipboard
Last edited by p_m21987 on Wed 26 Dec 2018, 16:54, edited 1 time in total.
Re: BBCSDL: Using the clipboard
You have two options in a case such as this: either copy the relevant code from a program that you know already has the functionality you need (the obvious example being SDLIDE.bbc itself, from which you can borrow code from the FNhascliptext, PROCcopytext() and PROCpaste() routines) or code it yourself using information from the SDL 2.0 API documentation (i.e. SDL_HasClipboardText, SDL_SetClipboardText and SDL_GetClipboardText).
When the SDL API functions are straightforward to use, as they are in this case, you probably might as well go straight to the horse's mouth, but if they are a bit more tricky finding the relevant code in one of the supplied examples - assuming there is one - will give you more 'context'. It's not my intention to try to write something equivalent to the 'Accessing the Windows API' segment of the BB4W documentation, but for BBCSDL. It would be a lot of work, and I think (or at least hope) BBC BASIC programmers are now more au fait with calling APIs than they were back in 2001.

Richard.
-
- Posts: 177
- Joined: Mon 02 Apr 2018, 21:51
Re: BBCSDL: Using the clipboard
Thanks Richard, this worked perfectly. I've now got some BASIC functions that call the SDL functions.
Last edited by p_m21987 on Wed 26 Dec 2018, 16:54, edited 1 time in total.
-
- Posts: 177
- Joined: Mon 02 Apr 2018, 21:51
Re: BBCSDL: Using the clipboard
Sorry to ask another question so soon, but I would like to know, what's the best method to test whether your program is running on BB4W or BBCSDL?
Last edited by p_m21987 on Wed 26 Dec 2018, 16:54, edited 1 time in total.
Re: BBCSDL: Using the clipboard
I would usually do:
Code: Select all
IF INKEY$(-256) = "W" THEN
REM Running in BB4W
ELSE
REM Running in BBCSDL
ENDIF
Richard.