Jump to content

[SOLVED] deactivating spacebar from triggering guicrtlcreatebutton


Xandy
 Share

Recommended Posts

I press button to capture key stroke, spacebar presses button again.

To the effect of spacebar cannot be captured as it will always trigger new key to be captured.

I can change the buttons to input fields and I think that would solve this issue.

Is there anything I can do to work around spacebar triggering button press?¿

Edited by songersoft
Link to comment
Share on other sites

for $i=0 to $hotkeysonpage-1
    if($appmsg==$buttonkey[$i]) Then;you clicked set key
        do;loop until keypress is recorded
            for $ii=0 to $keymax-1;detect keypress
                if(_IsPressed($key[$ii], $dll)) then
                    $keyfound=1
                    ExitLoop
                endif
            next
        until $keyfound=1
        $keyfound=0
        GUICtrlSetData($buttonkey[$i], $keyname[$ii])
        $hotkey[$i+$hotkeypage*$hotkeysonpage][0]=$key[$ii]
        $hotkey[$i+$hotkeypage*$hotkeysonpage][1]=$ii
        ExitLoop
    endif
next

So yah pressing 'spacebar' records the spacebar press, but forces the button to be pressed again thus undoing the captured spacebar.

Can I disable 'spacebar' from pressing the button[]?

I understand I can add a special case to insert 'spacebar', but I was hoping to only have to make a special case for 'pause'. You see 'pause' key or $key[12] which is equal to '13' doesn't break the detect key loop either and I figure it has something to do with the effect of the 'pause' key in Windows. I can however set 'pause' to a $hotkey[][] manually and it works fine for my purposes from there. I can set 'spacebar' manually too, but if I can disable spacebar from triggering the $button[] press, I won't have to and users will be able to assign spacebar as a hotkey with the detect key loop.

I'm looking for any information about the 'pause' key and stopping spacebar from triggering selected button presses.

Thank you

Posted Image

It's hard to tell what's happening in this picture, but I hear they're worth 1000 words.

You might be able to see how spacebar fails, trust me it does.

Edited by songersoft
Link to comment
Share on other sites

Hey come on, I'm in pain... lol.

Posted Image

Can anyone offer me away to help myself? For instance am I not being specif enough about the problem I'm having? Am I being too much of a 30 year old boy? Is there simply no solution to the spacebar pressing buttons? You know the spacebar presses buttons, right? Can I stop that from happening?

Maybe I am just silly goose.

I blowup a picture of myself using a SDL c++ program I called pixel_chart. Pixel_chart scans images and records the pixels into an array. p[id][5]0dis_x, 1dis_y, 2r, 3g, 4b.

I wanted pixel_chart to be able to store as many pixels as the computer's ram would allow, turns out that my MSVS compiler would not let me make huge arrays. So you know if I wanted to store 800*600 pixels (and I wanted twice that, and then I'm still sure I would have wanted more), int p[480000][5] would crash the program real quick like. So I dug around on the internet and found malloc code for a 2d array. Using that code, I made an array class with functions to suit my purposes and fill up to all RAM and Virtual mem.

//c++ code
class arrayclass {
public:
    int **array;
    int xdim, ydim;
    arrayclass();
    int **make2darray(int x, int y);
    void freearray();
    void setarray(int val);

};
arrayclass::arrayclass() {
    xdim=0; ydim=0;
}
int **arrayclass::make2darray(int x, int y) {
    int i=0;
    xdim=x; ydim=y;
    array = (int**)malloc(x * sizeof(int *));
    if(array == NULL) {
        fprintf(stderr, "out of memory\n");
        exit(1);
    }
    for(i = 0; i < x; i++) {
        array[i] = (int*)malloc(y * sizeof(int));
        if(array[i] == NULL) {
            fprintf(stderr, "out of memory\n");
            exit(1);
        }
    }
    if(array == NULL) {
        fprintf(stderr, "out of memory\n");
        exit(1);
    }
    for(i = 0; i < x; i++) {
        array[i] = (int*)malloc(y * sizeof(int));
        if(array[i] == NULL) {
            fprintf(stderr, "out of memory\n");
            exit(1);
        }
    }
    return array;
}
void arrayclass::freearray() {
    int i=0;
    for(i = 0; i < xdim; i++)
        free(array[i]);
    free(array);
}
void arrayclass::setarray(int val)
{
    int i, j;
    for(i = 0; i < xdim; i++)
        {
        for(j = 0; j < ydim; j++)
            array[i][j] = val;
        }
}

I didn't need that many pixels to blowup my face, I only needed 30000-all_the_white.

Posted Image

Meet a single frame of the Windows search dog.

I offer him or her, as donation for any attention I can get.

ps,

I just want to take a second to thank all the people that make this forum and Autoit possible. This forum makes me happy like you wouldn't believe. Sometimes I get to help someone, and I also get to beg for help myself. I truly love it. I've been learning how to program for 21 years. There is so much that I do not know, and I have so much love for the programs I write that do reflect my goals. Uhhm just some programmer's love, thank you.

Edited by songersoft
Link to comment
Share on other sites

I poured over the help file again, searching for away to reset the button focus. That's how I found the function to set the $button[$i] focus to false, and that allows me to capture the spacebar without pressing the button to set the hotkey again. Thanks again, i'll be back with more I'm working on. I'm looking for away to improve my clipper.au3 that's how I sampled the Windows search puppy graphic frames, but I'm probably too vague at this point. I just want it to capture more frames a second. I wrote a make_animation c++ program to remove any frame that is the same as the last frame. Somebody might be willing to help me find the best or a good way of capturing graphics with autoit. Right now I use

_ScreenCapture_Capture ($savepath & $frames & ".bmp", $sample[0], $sample[1], $sample[2], $sample[3]). I'm thinking it would be faster to save only to an array than to write to the hard disk each frame. Then I could just write all the frames from ram to hard drive at the end of the sampling.

So if anyone wants to give me a heads up on away to do that, i'll do my best to listen and learn, maybe it's best I over come my fear of the unknown.

But I wouldn't complain if you tried to help me with that.

oh yah, are these graphics annoying? I didn't mean for that. Please let me know, it's just it gives me a chance to try and prove ability cause I write most of the tools I use to manipulate the graphics I display. but if they make my topics unbearable, cause of lag or something, I need you to let me know.

Posted Image

for $i=0 to $hotkeysonpage-1
    if($appmsg==$buttonkey[$i]) Then;you clicked set key
        do;loop until keypress is recorded
            for $ii=0 to $keymax-1;detect keypress
                if(_IsPressed($key[$ii], $dll)) then
                    $keyfound=1
                    ExitLoop
                endif
            next
        until $keyfound=1
        $keyfound=0
        GUICtrlSetData($buttonkey[$i], $keyname[$ii])
        $hotkey[$i+$hotkeypage*$hotkeysonpage][0]=$key[$ii]
        $hotkey[$i+$hotkeypage*$hotkeysonpage][1]=$ii
;added this code to solve pressing the button again when trying to capture spacebar key press
                if($hotkey[$i+$hotkeypage*$hotkeysonpage][1]==15) then _GUICtrlButton_SetFocus($buttonkey[$i], false)
        ExitLoop
    endif
next

Till next time,

Thanks for letting me find my own way.

Edited by songersoft
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...