I'm trying to use the copy/paste functionality inside of uifc for javascript
While WIN_CUT is available in C, it is not available in javascript
I see that there are two entires in uifc.h for 1<<17 which is WIN_CUT and WIN_HLP
Then in javascript, in uifcdefs.js, there is just the entry for WIN_HLP
When using WIN_HLP though, it enables the Cut option that I am looking for
It seems maybe this is a bug? Why are there two constants for 1<<17?
Re: UIFC Issue
By: Mlong to All on Sun Oct 11 2020 08:16 pm
It seems maybe this is a bug? Why are there two constants for 1<<17?
Not really a bug, just multiple "sources of truth" which tend to get out of sync over time.
The WIN_HLP mode flag is not used in UIFC/JS, so that's why I reused that bit for WIN_CUT. Now fixed in git.
Re: UIFC Issue
By: Mlong to All on Sun Oct 11 2020 08:16 pm
It seems maybe this is a bug? Why are there two constants for 1<<17?
Not really a bug, just multiple "sources of truth" which tend to get out of sync over time.
The WIN_HLP mode flag is not used in UIFC/JS, so that's why I reused that bit for WIN_CUT. Now fixed in git.
Thanks, getting closer. Still trying to figure out how to read that they pressed ctrl-c/ctrl-v and how to handle. I ran into another inconsistency:
in the c file:
#define MSK_COPY 0x30000000
#define MSK_CUT 0x40000000
#define MSK_PASTE 0x50000000
in the js file:
const MSK_GET = 0x30000000;
const MSK_PUT = 0x40000000;
const MSK_EDIT = 0x50000000;
Here's how I am dealing with this weirdness, if it gives you any hints as to what is wrong in the source:
if (selection&MSK_GET) {
// actually put ctrl-x
selection ^= 0x50000000;
uifc.msg("You pasted into index " + selection);
} else if (selection&MSK_PUT) {
// actually get ctrl-v
selection ^= MSK_PUT;
uifc.msg("You copied from index " + selection);
}
Re: Re: UIFC Issue
By: Mlong to Mlong on Mon Oct 12 2020 02:46 pm
Here's how I am dealing with this weirdness, if it gives you any hints as to what is wrong in the source:
if (selection&MSK_GET) {
// actually put ctrl-x
selection ^= 0x50000000;
uifc.msg("You pasted into index " + selection);
} else if (selection&MSK_PUT) {
// actually get ctrl-v
selection ^= MSK_PUT;
uifc.msg("You copied from index " + selection);
}
The proper way (if it works, which I don't know has been confirmed in JS): would be like this:
if ((sleection & MSK_ON) == MSK_COPY) {
selection &= MSK_OFF;
uifc.msg("You copied from index" + seleection);
}
There have been issues in the past with JS numbers > 0x7fffffff, so it's possible there might be a hitch that needs to be resolved before it works 100% for you. Let me know how you fare,
It works fine now for cut and paste, but I cannot get it to work for copy. It just never seems to match the MSK_COPY. I'll have to play around with it some more later
Sysop: | Ree |
---|---|
Location: | Toronto, ON |
Users: | 2 |
Nodes: | 10 (0 / 10) |
Uptime: | 01:42:46 |
Calls: | 369 |
Files: | 2 |
Messages: | 38,903 |