my mouse no working

  • Kurgusov

    Kurgusov - 2007-07-22

    I read the post further back and where her mouse problem was solved
    by adding  *keypad (stdscr, TRUE);* it doesnt help me as keypad (stdscr, TRUE) is
    set to true by default.(was already on).

    I cant get the mouse to figure.

    #include <curses.h>

    #define COLOR1 1

    void mousey ( void );

    int main(){

    slk_init ( 55 );
    initscr ();
    resize_term ( 90, 160 );

    raw ();
    cbreak ();
    start_color ();
    keypad ( stdscr, TRUE );
    curs_set ( 0 );

    init_pair ( COLOR1, COLOR_CYAN, COLOR_BLACK );
    attron ( COLOR_PAIR ( COLOR1 ));

    mousey ();

    endwin ();
    return 0;

    void mousey ()
    int ch;

    mouse_set ( ALL_MOUSE_EVENTS);
    ch = getch ();

    if ( ch == KEY_MOUSE){ mvprintw ( 3, 3, "mouse on");}
    else{ mvprint ( 3, 3, "mouse off");}


    could you please tell me what I need to do so that the mouse works !


    • William McBrine

      William McBrine - 2007-07-22

      Your sample program works for me (after I change the bogus "mvprint" to "mvprintw"); I see "mouse on" when I click a mouse button. If it doesn't work for you, you might have to be more specific about your environment -- platform, compiler, version, etc.

      BTW, 'system("pause>NUL");' is very silly. You can achieve the same effect with much less overhead (and more portability) via a simple getch().

    • Kurgusov

      Kurgusov - 2007-07-22

      thanks for your reply,

      Ive tried various things including creating a new project with just the default source file
      and adding my mouse fuction,to no effect.

      OS is windows xp professional ver.2002 service pack 2.
      Im using curses 3.2
      My IDE is dev-cpp which uses the mingw port of gcc for its compiler.

      just as a footnote,
      when I press the mouse button a cursor sized white block appears under the mouse pointer.

      well,I have a feeling you wont be able to help me here,
      but hope springs eternal.

    • William McBrine

      William McBrine - 2007-07-22

      The white block is the start of a selection for the clipboard. You have "QuickEdit Mode" enabled in the Properties for your Command Prompt. It's taking control of the mouse.

    • William McBrine

      William McBrine - 2007-07-22

      I've changed things for the next version so that QuickEdit Mode is automatically disabled when mouse input is enabled (and reenabled when mouse input is disabled, if it was enabled before).

    • Kurgusov

      Kurgusov - 2007-07-23

      oh,wow,your bloody good at this.



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks