Posted by: Nerea Diez
Hello,
I use MS Windows messages when the user press the TAB key in multiline
fields. In SQL Windows 5.0.3 PTF7, this code run correctly but not in
Centura. The sentence:
Set nPos = SalSendMsg( hWndItem, EM_GETSEL, 0, 0 )
in Centura return "0" in nPos and in SQL Windows 5.0.3 PTF7 return correct
value, for example "2818091". Perhaps Centura doesn't recognize the
EM_GETSEL message?
The code is:
On WM_KEYDOWN
If wParam = VK_TAB
Call Tratar_Tabulador ( )
Function: Tratar_Tabulador
Local variables
Number: nPos
Number: nPos1
Number: nPos2
Actions
Set nPos = SalSendMsg( hWndItem, EM_GETSEL, 0, 0 )
Set nPos1 = SalNumberLow( nPos )
Set nPos2 = SalNumberHigh( nPos )
Call SalStrReplace( MyValue, nPos1, nPos2 - nPos1, SalStrRepeatX( ' ', 7 ),
MyValue )
Set nPos1 = nPos1 + 7
Set nPos2 = nPos1
Set nPos = (nPos2 * 0x10000) + nPos1
Call SalPostMsg( hWndItem, POSICIONAR_FOCUS, 0, 0 )
Call SalPostMsg( hWndItem, EM_SETSEL, 0, 0xFFFF )
Call SalPostMsg( hWndItem, EM_SETSEL, 0, nPos )
Call SalSetFieldEdit( hWndItem, TRUE )
Thanks for your help,
Nerea.