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)Â
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.
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
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Automatic Focus on TPopUpMenu Item
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,
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
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com