In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Automatic Focus on TPopUpMenu Item

Xailer professional forum in English
Responder
Avatar de Usuario
emeasoft
Mensajes: 1094
Registrado: Mié Abr 01, 2009 4:12 pm
Ubicación: emeasoft
Contactar:

Automatic Focus on TPopUpMenu Item

Mensaje por emeasoft »

Hello Xailers,
I wish to know if there is a way to set the focus automaticaly on the first item of a TPopUpMenu.
Thanks,
Juliano

Attached files TPopUpMenu.zip (2.9 KB)Â
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Automatic Focus on TPopUpMenu Item

Mensaje por ignacio »

emeasoft escribió el mié, 05 octubre 2011 13:03Hello Xailers,
I wish to know if there is a way to set the focus automaticaly on the first item of a TPopUpMenu.
Thanks,
Juliano
I am afraid is not possible. BTW, you can put the property lDefault to .T. on that first Item so if no popup item is selected then the action of that item will be triggered. That item will also be shown in boldface.
But I'm afraid right now this feature is not working on for TSplitButton. This is the code to fix it:
METHOD ShowPopupMenu( oPopup, nLeft, nTop ) CLASS XControl
STATIC lProcessing := .F.
LOCAL nOption
IF ! lProcessing .AND. ! Empty( oPopup )
lProcessing := .T.
::oForm:oPopup := oPopup
ClientToScreen( ::Handle, @nLeft, @nTop )
nOption := TrackPopupMenu( oPopup:Handle, TPM_RETURNCMD, nLeft, nTop, ::Handle )
::oForm:oPopup := Nil
lProcessing := .F.
IF nOption != 0
oPopup:DoAction( nOption )
ELSE //<<<<<<<<<<<<<<<<<<<<<<
oPopup:DoDefault() //<<<<<<<<<<<<<<<<<<<<<<
ENDIF
ENDIF
RETURN lProcessing
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder