Página 1 de 1
Automatic Focus on TPopUpMenu Item
Publicado: Mié Oct 05, 2011 1:03 pm
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)Â
Automatic Focus on TPopUpMenu Item
Publicado: Jue Oct 06, 2011 10:28 am
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,
Automatic Focus on TPopUpMenu Item
Publicado: Jue Oct 06, 2011 9:04 pm
por emeasoft
Thanks for the help Ignacio