- Code: Select all Expand view
#include 'Fivewin.ch'
//----------------------------------------------------------------------------//
Function Main()
Local oDlg
Local oGet := Array( 2, 0 )
Local cVar := { Space( 20 ), Space( 20 ) }
Define Dialog oDlg
@ 10, 10 Get oGet[ 1 ] Var cVar[ 1 ] Size 100, 10 Of oDlg Action PopupBrowse( { 'UNO', 'DOS', 'TRES' }, oGet[ 1 ], { || .t. } ) Pixel
@ 35, 10 Get oGet[ 2 ] Var cVar[ 2 ] Size 100, 10 Of oDlg Action PopupBrowse( { 'UNO', 'DOS', 'TRES' }, oGet[ 2 ], { || .t. } ) Pixel
Activate Dialog oDlg On Init oDlg : lHelpIcon := .f. Centered
Return 0
//----------------------------------------------------------------------------//
Function PopupBrowse( aValue, oGet, bInit )
Local oDlg
Local oBrw
Local aPoint := { oGet : nTop + oGet : nHeight, oGet : nLeft }
If( oGet : Cargo == nil )
aPoint = ClientToScreen( oGet : oWnd : hWnd, aPoint )
Define Dialog oDlg Of oGet : oWnd Style WS_POPUP Size 250, 180
Activate Dialog oDlg NoWait On Init oDlg : SetPos( aPoint[ 1 ], aPoint[ 2 ] )
@ 0, 0 xBrowse oBrw Array aValue Size oDlg : nWidth, oDlg : nHeight Of oDlg Pixel
oBrw : CreateFromCode()
If( bInit # Nil )
Eval( bInit, oBrw )
End
oBrw : PostMsg( WM_SETFOCUS )
oBrw : bKeyDown := { | nKey | If( nKey == VK_RETURN, oDlg : End(), ) }
oBrw : bChange := { || oGet:VarPut( oBrw:aCols[ 1 ]:Value ), oGet:Refresh() }
oBrw : bLButtonUp := { | nRow, nCol | If( nRow > oBrw : nHeaderHeight,;
( Eval( oBrw : bChange ), oDlg : End(),;
oGet : oWnd : GoNextCtrl( oGet : hWnd ),;
oGet : Cargo := nil ), ) }
oGet : bLostFocus := { || oGet : Cargo := nil, oDlg : End() }
oGet : oWnd : bGotFocus := { || oGet : Cargo := nil, oDlg : End() }
//oGet : oWnd : bMMoved := { || oGet : Cargo := nil, oDlg : End() }
oGet : oWnd : bMoved := { || oGet : Cargo := nil, oDlg : End() }
oBrw : Seek( oGet : GetText() )
oGet : Cargo := oDlg
oGet : bKeyDown := { | nKey | If( nKey == VK_DOWN, oBrw : GoDown(), ),;
If( nKey == VK_UP, oBrw : GoUp(), ),;
If( nKey == VK_DELETE, ( oGet : VarPut( 0 ), oGet : Refresh(), oDlg : End() ), ),;
If( nKey == VK_RETURN, oDlg : End(), ), 0 }
oGet : oWnd : bLClicked := { || oDlg:End(), oGet:Cargo := nil }
oGet : oWnd : bMouseWheel := { || oDlg : SetFocus() }
Else
oGet : Cargo : End()
oGet : Cargo = nil
End
Return nil
Muchas gracias.
Saludos