• UIFC Issue

    From Mlong to All on Sunday, October 11, 2020 20:16:56
    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?
  • From Digital Man to Mlong on Sunday, October 11, 2020 22:29:04
    Re: UIFC Issue
    By: Mlong to All on Sun Oct 11 2020 08:16 pm

    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?

    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.

    digital man

    Rush quote #68:
    He's a radio receiver, tuned to factories and farms
    Norco, CA WX: 65.9°F, 82.0% humidity, 0 mph SSW wind, 0.00 inches rain/24hrs
  • From Mlong to Digital Man on Monday, October 12, 2020 14:33:39
    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;
  • From Mlong to Mlong on Monday, October 12, 2020 14:46:44
    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);
    }
  • From Digital Man to Mlong on Monday, October 12, 2020 18:20:07
    Re: Re: UIFC Issue
    By: Mlong to Digital Man on Mon Oct 12 2020 02:33 pm

    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;

    Thanks, no fixed.

    digital man

    This Is Spinal Tap quote #34:
    We'd love to stand around and chat, but we've gotta sit down in the lobby Norco, CA WX: 88.3°F, 30.0% humidity, 8 mph ENE wind, 0.00 inches rain/24hrs
  • From Digital Man to Mlong on Monday, October 12, 2020 18:23:37
    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,

    digital man

    Sling Blade quote #6:
    Karl: he should've had a chance to grow up. He would had fun some time.
    Norco, CA WX: 87.2°F, 30.0% humidity, 6 mph E wind, 0.00 inches rain/24hrs
  • From Digital Man to Mlong on Monday, October 12, 2020 18:52:05
    Re: Re: UIFC Issue
    By: Digital Man to Mlong on Mon Oct 12 2020 06:23 pm

    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,

    I played around with JS uifc the copy/cut/paste mode flags and it seemed to work as expected. Here's a little test script I wrote, if it's of any help:

    load("uifcdefs.js");
    if(!uifc.init("Test app"))
    exit(-1);
    js.on_exit("uifc.bail()");
    do {
    var selection = uifc.list(WIN_CUT|WIN_COPY|WIN_PASTE, "test", ["one",
    "two", "three"]);
    uifc.msg(format("selection = %x", selection));
    } while(selection != -1);


    digital man

    Synchronet "Real Fact" #94:
    Synchronet v3.16c was released in August of 2015 (5 years after v3.15b).
    Norco, CA WX: 85.0°F, 32.0% humidity, 8 mph E wind, 0.00 inches rain/24hrs
  • From Mlong to Digital Man on Monday, October 12, 2020 20:18:59
    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
  • From Digital Man to Mlong on Monday, October 12, 2020 22:38:27
    Re: Re: UIFC Issue
    By: Mlong to Digital Man on Mon Oct 12 2020 08:18 pm

    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

    Seems to work for me. The test script I pasted, if you hit Ctrl-C while teh 3rd item is highlighted, it displays:
    ╔[■]═══════════════════╗
    ║ selection = 30000002 ║
    ╠══════════════════════╣
    ║ │OK ║
    ╚══════════════════════╝

    And MSK_COPY is 0x30000000 and the 3rd option index is 2. So that makes perfect sense.

    digital man

    This Is Spinal Tap quote #8:
    Derek Smalls: Making a big thing out of it would have been a good idea.
    Norco, CA WX: 78.4°F, 31.0% humidity, 0 mph SSW wind, 0.00 inches rain/24hrs
  • From Mlong to Digital Man on Tuesday, October 13, 2020 06:57:46
    Thanks for your help digital man, I was able to get it working now. Still lots to do but I hope to have something cool to show you all soon