Thread: Change cursor on single edit control

  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    291

    Change cursor on single edit control

    Hello, I have problems changing the cursor over a single edit control. I'm using 'SetClassLong' to apply the new cursor over an edit:

    Code:
    HWND h_disp;//declared as global
    
    void crea_display(HWND hwnd)
    {
    HCURSOR hc;
    
    h_disp=CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",WS_CHILD|WS_VISIBLE|WS_VSCROLL|ES_AUTOVSCROLL|ES_READONLY|
    ES_WANTRETURN|ES_MULTILINE,0,0,0,0,hwnd,NULL,GetModuleHandle(0),NULL);
    SendMessage(h_tracer,WM_SETFONT,(WPARAM)hf2,(LPARAM)MAKELPARAM(TRUE,0));
    
    hc=LoadCursor(NULL,IDC_NO);
    SetClassLong(h_disp,GCL_HCURSOR,(LONG)hc);
    }
    The idea is to set the IDC_ARROW cursor, but for testing purposes I have used the slashed circle. It works well over that 'h_disp' control, the problem is that also is displayed over all other edit controls of the window (even on all the edit controls attached to dialogs).

    It is possible to set a cursor for a single control?

    Thank's in advance
    Niara

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Your cursor change is being applied to all windows of the class type "Edit". One possible solution would be to register your own custom "Edit" window complete with its own procedure. Then create your edit windows using the custom class type.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    291
    Hey BobS0327, thank's for your time and help

    That's a good idea, I'lll take a look at it. Also I have thought on set the text ibeam while processing the initdialog message on dialogs where I need editable edit controls, and reset to the arrow while quit. The cursor is only for stetical purposes since on the main window I have readonly edit controls where I wouldn't like to display the text ibeam cursor.

    Thank's
    Niara

  4. #4
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    291
    Ok I have realized now (sorry if that seems stupid): SetClassLong, that means 'set' for the 'class' the 'long' value, that is applyed to the class, not to the single control

    Niara

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Catching tab or enter in an EDIT control in a regular window
    By Boksha in forum Windows Programming
    Replies: 0
    Last Post: 11-19-2005, 10:27 AM
  2. Edit control template
    By BobS0327 in forum Windows Programming
    Replies: 3
    Last Post: 04-08-2005, 12:10 PM
  3. endless edit control
    By ZerOrDie in forum Windows Programming
    Replies: 3
    Last Post: 03-21-2003, 02:51 AM
  4. Edit Control problem
    By Malek in forum Windows Programming
    Replies: 3
    Last Post: 06-16-2002, 01:12 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM