Jump to content

Problems with cursor not appearing in editable listview cell - _GUICtrlEdit_SetSel


Recommended Posts

Hi

I have the following code which allows me to hit tab and move to the next editable cell in a listview. However the cursor won't show and the focus lies on the ok button for some reason - any thoughts on where I'm going wrong? I've tried all sorts - strangely enough, when I put a msgbox at the end of the code (in place of the sleep) the cursor appears correctly - without it (even with the sleep), no cursor!

If $keycode = 9 Then
  $tiSubitemtext = _GUICtrlListView_GetItemText(GUICtrlGetHandle($WMListView), $tItem, $tSubitem)
  $iLen = _GUICtrlListView_GetStringWidth(GUICtrlGetHandle($WMListView), $tiSubitemtext)
  $aRect = _GUICtrlListView_GetSubItemRect(GUICtrlGetHandle($WMListView), $tItem, $tSubitem)
  $hEdit = _GUICtrlEdit_Create(GUICtrlGetHandle($WMListView), $tiSubitemtext, $aRect[0], $aRect[1], _GUICtrlListView_GetColumnWidth(GUICtrlGetHandle($WMListView), $tSubitem), 20, BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT))
  _GUICtrlEdit_SetSel($hEdit, 0, -1)
  _WinAPI_SetFocus($hEdit)
  $hDC = _WinAPI_GetWindowDC($hEdit)
  $hBrush = _WinAPI_CreateSolidBrush(0)
  FrameRect($hDC, 0, 0, _GUICtrlListView_GetColumnWidth(GUICtrlGetHandle($WMListView), $tSubitem), ScaleWidth(20), $hBrush)

  Sleep(1500) ; with a msgbox here, I can see the cursor - which implies the guictrleditsetsel above is working
EndIf

It looks like the tab key is being processed twice - once by the listview, moving the cell to the next highlighted cell, and secondly by the gui, moving the focus to the next button...

Edited by DelStone
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...