METHOD Set( cNewItem ) CLASS TComboBox
local nAt
if ValType( cNewItem ) == "N"
nAt = cNewItem
if nAt == 0
nAt = 1
endif
else
nAt = AScan( ::aItems,;
{ | cItem | Upper( AllTrim( cItem ) ) == ;
Upper( AllTrim( cNewItem ) ) } )
endif
if ValType( cNewItem ) == "N" .or. nAt != 0
::Select( nAt )
Eval( ::bSetGet, cNewItem )
SetWindowText( ::hWnd , cNewItem ) // added this line
else
cNewItem := cValToChar( cNewItem )
Eval( ::bSetGet, cNewItem )
SetWindowText( ::hWnd , cNewItem )
endif
return nil
METHOD Set( cNewItem ) CLASS TComboBox
local nAt
if ValType( cNewItem ) == "N"
nAt = cNewItem
if nAt == 0
nAt = 1
endif
else
nAt = AScan( ::aItems,;
{ | cItem | Upper( AllTrim( cItem ) ) == ;
Upper( AllTrim( cNewItem ) ) } )
endif
if ValType( cNewItem ) == "N" .or. nAt != 0 .and. ::oGet == nil
::Select( nAt )
else
cNewItem := cValToChar( cNewItem )
endif
Eval( ::bSetGet, cNewItem )
SetWindowText( ::hWnd , cNewItem )
return nil
if lAnd( ::nStyle, CBS_DROPDOWN )
if !lAnd( ::nStyle, CBS_DROPDOWNLIST )
if ::oGet != nil
::oGet:hWnd = GetWindow( ::hWnd, GW_CHILD )
::oGet:Link()
::oGet:bLostFocus = ;
{| hCtlFocus, nAt, cItem| cItem := GetWindowText( ::hWnd ), ;
nAt := ::SendMsg( CB_FINDSTRING, 0, Trim( cItem )) + 1,;
Eval( ::bSetGet, cItem ),;
::Select( nAt ),;
SetWindowText( ::hWnd, cItem ),;
If( ::bValid != nil .and. ;
GetParent( hCtlFocus ) == GetParent( ::hWnd ),;
If( ! Eval( ::bValid, ::oGet, Self ),;
::PostMsg( WM_SETFOCUS ),),) }
::oGet:SetFont( ::oFont )
::oGet:bKeyChar = { | nKey | If( ( nKey == VK_TAB .and. ! GetKeyState( VK_SHIFT ) ) .or. ;
nKey == VK_RETURN,;
( ::oWnd:GoNextCtrl( ::hWnd ), 0 ),;
If( nKey == VK_TAB .and. GetKeyState( VK_SHIFT ),;
( ::oWnd:GoPrevCtrl( ::hWnd ), 0 ),) ) }
endif
::oGet:bKeyChar = { | nKey | If( ( nKey == VK_TAB .and. ! GetKeyState( VK_SHIFT ) ) .or. ;
nKey == VK_RETURN,;
( ::oWnd:GoNextCtrl( ::hWnd ), 0 ),;
If( nKey == VK_TAB .and. GetKeyState( VK_SHIFT ),;
( ::oWnd:GoPrevCtrl( ::hWnd ), 0 ),) ) }
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 40 guests