Curses

All flavors welcome.
Forum rules
Be kind.
Post Reply
User avatar
richmond62
Posts: 509
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Curses

Post by richmond62 »

set the cursor to something

does NOT work in recent versions of LiveCode on MacOS:

https://forums.livecode.com/viewtopic.php?f=7&t=37192
Attachments
Accursed Cursors.livecode.zip
Stack.
(4.18 KiB) Downloaded 3 times
User avatar
overclockedmind
Posts: 72
Joined: Sat Apr 30, 2022 9:05 pm
Location: Midwest US
Contact:

Re: Curses

Post by overclockedmind »

richmond62 wrote: Mon Aug 01, 2022 7:16 pm set the cursor to something

does NOT work in recent versions of LiveCode on MacOS:

https://forums.livecode.com/viewtopic.php?f=7&t=37192
LCC (branded) 963, Linux Mint (Ubuntu 20.04 derivative,) the first two buttons don't do a thing, and the third (last) pops the script of the button as if there's something wrong with the script I'm supposed to see, and fix.
Regards,
Joshua

If I post once, without editing to clarify at least one time, it'll be a miracle.
User avatar
OpenXTalkPaul
Posts: 686
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Curses

Post by OpenXTalkPaul »

richmond62 wrote: Mon Aug 01, 2022 7:16 pm set the cursor to something

does NOT work in recent versions of LiveCode on MacOS:

https://forums.livecode.com/viewtopic.php?f=7&t=37192
Invisible Cursor works here, must lock the cursor before and/or (?) after changing the cursor:

Code: Select all

lock cursor; set the cursor to ""; wait 3 seconds; unlock cursor
or

Code: Select all

lock cursor; set the cursor to EMPTY; wait 3 seconds; unlock cursor
for invisible cursor for 3 seconds. Works for me on MacOS 12.4 & OXT 9.6.3.

I rarely use cursors lately, I used to use them frequently as a quick activity indicator ('set cursor to busy')

I do remember similar behaviors even going back to HyperCard days, and including with very own 'CursorDo XCMD' (circa 1994/95?, built with FutureBASIC, and includes an easter-egg: my special "New-F'ing-Jersey Cursor"). I always had to micro-manage the cursor with lock/unlock.

I added some 'lock cursor' AFTER your set cursors and it works as expected.
You got my cursor stuck as a tick or termite (or whatever that bug is, lol, good thing I had that line in my message box.

Here's modified version:
Accursed Cursors working.oxtstack
(4.58 KiB) Downloaded 3 times
User avatar
richmond62
Posts: 509
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Curses

Post by richmond62 »

Thanks for the help.

To a certain extent that is my own stupidity as in my Devawriter Pro source stack I have a bespoke
cursor, but I implemented that about 12 years ago and then forgot how I did it. :?
User avatar
OpenXTalkPaul
Posts: 686
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Curses

Post by OpenXTalkPaul »

richmond62 wrote: Wed Aug 03, 2022 10:17 am Thanks for the help.

To a certain extent that is my own stupidity as in my Devawriter Pro source stack I have a bespoke
cursor, but I implemented that about 12 years ago and then forgot how I did it. :?
Glad to help.
Eventually I'd like to get back to my music sequencing oriented coding, long ago I had 16x16px cursors set up for various musical note lengths, set via a palette of note buttons (Whole Note, Half, Quarter, Q-Triplet, Eighth, etc.) for use in 'step-writing' music ('playSentence' strings). Most recently I was messing with cursors a little bit while working on oxtTools, mostly that stack uses edit/browse and the 'grab' hand, I'd like to add in a few Photoshop type cursors there. We have the PS move layer-mover cursor (our current 'edit' mode cursor), do we have the circle-target-crosshair (for pixel-color sampler)?
User avatar
OpenXTalkPaul
Posts: 686
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Curses

Post by OpenXTalkPaul »

I added this stack to the web playground this morning and it doesn't work at all there, apparently there is zero cursor support in the Emscripten engine :-( ? We can probably set cursor via JavaScript, but that would likely have to be a custom library handler, unless that could be quickly patched in to the standalone-community.9.6.3.js engine file (which may be possible in certain cases).
User avatar
OpenXTalkPaul
Posts: 686
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Curses

Post by OpenXTalkPaul »

Adding the property <someTagElement element.style.cursor="move"> (for example) to DOM sets an HTML elements cursor within that element of the page, with javaScript you can do:

Code: Select all

document.body.style.cursor = "move";
Which works for setting "move" cursor while the mouse is within the outer page, but NOT within our Emscripten 'canvas' area, nor inside of web playground's little console-text area (which obviously we want text handling cursors there anyway).

According to this web site: http://www.javascripter.net/faq/stylesc.htm
virtually all web browsers include the following built-in cursors:
auto
move
no-drop
col-resize
all-scroll
pointer
not-allowed
row-resize
crosshair
progress
e-resize
ne-resize
default
text
n-resize
nw-resize
help
vertical-text
s-resize
se-resize
inherit
wait
w-resize
sw-resize

So I guess we just need to use JS to get the Emscripten Engine's canvas element by ID or Name, so that we can set the cursor within our web stack(s) canvas area (which is your effective screenRect as far as the Emscripten engine is concerned). At least for these browser built-in cursors, but will do more research to see if we can get custom-cursors working with JS.
User avatar
OpenXTalkPaul
Posts: 686
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Curses

Post by OpenXTalkPaul »

OpenXTalkPaul wrote: Wed Aug 03, 2022 12:52 pm So I guess we just need to use JS to get the Emscripten Engine's canvas element by ID or Name, so that we can set the cursor within our web stack(s) canvas area (which is your effective screenRect as far as the Emscripten engine is concerned). At least for these browser built-in cursors, but will do more research to see if we can get custom-cursors working with JS.
This puts our canvas element into the variable targetCanvas:

Code: Select all

var targetCanvas = document.getElementById("canvas").getElementsByClassName("emscripten")[0];
Probably the best way for a completely custom cursors with OXT on the web is to create a Base64 data URL from a .curs file, then we can that as the cursor-to-use URL.
.
..
...
....
This bit of JS works for changing the cursor, but then the Emscripten Engine crashes immediately after :(

Code: Select all

var canvas = document.getElementById('canvas');
canvas.setAttribute("style", "cursor: zoom-out");
User avatar
OpenXTalkPaul
Posts: 686
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Curses

Post by OpenXTalkPaul »

OH! Of course so simple, this works for setting the cursor image in our Emscripten Engine

Code: Select all

document.getElementById("canvas").style.cursor = "zoom-in";
document.getElementById("canvas").style.cursor = "zoom-out";
document.getElementById("canvas").style.cursor = "arrow";
I tried a few things to get cursors working 'natively' to our xTalk engine (like adding revCursors.rev) but nothing worked.
But this works just fine. So the next thing would be to get custom cursors working, need to write a script that exports our xTalk 'native' cursor pixel maps into a base64 encoded data URL that we can then pass out to our JS instead of the standard web browser cursor names.
User avatar
OpenXTalkPaul
Posts: 686
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Curses

Post by OpenXTalkPaul »

So I wasted a bunch of time trying to get custom cursors (png,gif,svg, URLs, data URI, etc.) to work within the Emscripten canvas, with absolutely no luck. It seems Emscripten uses a JS port of Simple Direct Media Layer (SDL, which I have mentioned as a library to possibly wrap with Builder FFI bindings).
So I need to find some Emscripten_SDL example code for changing the cursor in SDL (or rather the Emscripten port of it).
https://wiki.libsdl.org/SDL_CreateCursor

That's a back burner thing I think, web stacks can use the CSS cursors for now. I have more interesting fish to fry.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests