FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Valid , sbutton Cancel no me funciona
Posts: 142
Joined: Sun Oct 09, 2005 01:36 AM
Valid , sbutton Cancel no me funciona
Posted: Mon Jan 16, 2006 12:24 AM

Estimado Colegas

Como puedo hacer que me funcione cancel de sbutton y no que me
ejecute la funcion del valid,

Muchas Gracias
Fabian

Databaselab2002@yahoo.com.ar

@ 0.8,09 Get mg2 var xmesa Of oDlg size 40,30 font oFont Picture "999" Valid busmes((xmesa,Odlg,mg2,nkey,xturno,xadicion),.t.) && update

@ 0.8 , 16+20 sbutton b2 FILENAME "ok1.bmp" size 24,24 OF oDlgd cancel TEXT ON_BOTTOM NO BOX action local(xtelefo,Odlgd,otelefo,olbx1)

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Valid , sbutton Cancel no me funciona
Posted: Mon Jan 16, 2006 11:05 AM

@ 0.8 , 16+20 sbutton b2 FILENAME "ok1.bmp" size 24,24 OF oDlgd ;
TEXT ON_BOTTOM NO BOX action local( (xtelefo,Odlgd,otelefo,olbx1), oDlgD:End() ) CANCEL

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 143
Joined: Fri Oct 07, 2005 03:14 PM
Valid , sbutton Cancel no me funciona
Posted: Mon Jan 16, 2006 04:21 PM

Fabian vas a tener que modificar la clase Control el método KillFocus agrega TSButton como en este ejemplo :

METHOD KillFocus( hCtlFocus ) CLASS TControl

local oWnd

if ! Empty( hCtlFocus ) .and. ::bValid != nil .and. WndParents( hCtlFocus, ::hWnd ) .and. ;
( oWnd := oWndFromhWnd( hCtlFocus ) ) != nil .and. ;
Upper( oWnd:Classname() ) $ "TBUTTON;TBTNBMP;TSBUTTON" .and. ;
( oWnd:lCancel != nil .and. oWnd:lCancel .and. ;
( ::oWnd:nLastKey != VK_TAB .and. ::oWnd:nLastKey != VK_RETURN .and. ;
::oWnd:nLastKey != VK_DOWN .and. ::oWnd:nLastKey != VK_UP ) ) // JAAM Agregue ";TSBUTTON" para que le haga caso a
::oWnd:lValidating = .t. // la clusula CANCEL en los botones
::oWnd:nLastKey := 0
::ForWhen()
::oWnd:lValidating = .f.
::LostFocus()
return nil
else
if Upper( GetClassName( hCtlFocus ) ) == "TBTNBMP"
::oWnd:nLastKey := 0 // it fixes TBtnBmp CANCEL clause
endif
endif

                             // in FiveWin++ lValidating comes as nil sometimes

if ! Empty( hCtlFocus ) .and. ( ::oWnd:lValidating == nil .or. ! ::oWnd:lValidating ) ;
.and. IsWindowVisible( ::oWnd:hWnd ) .and. WndParents( hCtlFocus, ::hWnd )
PostMessage( ::hWnd, FM_LOSTFOCUS, hCtlFocus )
endif

return ::LostFocus( hCtlFocus )

Saludos
Joel Andujo

Continue the discussion