Dragging is hard but see some good info on the net. Did some other addition that may nice: edit tab label like excel style.
Some code for in Tabcontrol:
| Code: |
LBUTTONDBLCLK()
{
editLable = FieldControl
{
New(text, width) { super(width:width set:text); .SubClass() }
GETDLGCODE(lParam)
{
if MSG(lParam) is false
return 0
if MSG(lParam).wParam is VK.RETURN
.Window.Result(.Get())
return 'callsuper'
}
}
SendMessageRect(.Hwnd, TCM.GETITEMRECT, .GetSelected(), rc = Object())
ClientToScreen(.Hwnd, pt = Object(x:rc.left y:rc.top))
w = ((rc.right - rc.left) / .AveCharWidth) / 2
textOld = .GetText(.GetSelected())
textNew = Dialog(.Hwnd, Object(editLable, textOld, w) x:pt.x + 3 y:pt.y + 1 border:0 style: WS.POPUP)
.SetText(.GetSelected(), textNew is false ? textOld : textNew)
return 0
} }
|
Of course need to .SubClass() in New() and needing some argument to enable/disable label editing.
ESC will exit editing, RETURN will confirm editing.
Width w is based on trial/error, work fine for labels that are not too wide.