Hi,
the manual says for DisplayPopupMenu(#Menu) : "Displays a PopupMenu under the current mouse position or at the given screen location".
On devices with no mouse, likes phones or Touchscreens in generell, the menu appears on top left (0, 0) of the Screen.
Is there a way to determine the coordinates of a TouchScreen tap? Then I could store and use it with OpenMenu...
Ciao dige
Touchscreen and DisplayPopupMenu()
Re: Touchscreen and DisplayPopupMenu()
Works with an Android terminal.
Test with an apk
Code: Select all
Declare DisplayMenuPopUp()
Declare IsMobileDevice()
;Remove debug window
!$('div').eq(0).remove()
OpenWindow(0, 0, 0, 0, 0, "", #PB_Window_Background)
If CreatePopupMenu(0)
MenuItem(1, "item 1")
MenuItem(2, "item 2")
MenuItem(3, "etc ...")
EndIf
If IsMobileDevice()
BindEvent(#PB_Event_LeftClick, @DisplayMenuPopUp())
Else
BindEvent(#PB_Event_RightClick, @DisplayMenuPopUp())
EndIf
Procedure DisplayMenuPopUp()
DisplayPopupMenu(0, WindowID(0))
EndProcedure
Procedure IsMobileDevice()
!if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
! return true;
! } else {
! return false;
! }
EndProcedure
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Re: Touchscreen and DisplayPopupMenu()
I could have used DeviceInfo(#PB_Device_Platform) to determine if I am on a mobile terminal ....
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
- majikeyric
- Posts: 7
- Joined: Mon Feb 24, 2014 11:07 pm
- Contact:
Re: Touchscreen and DisplayPopupMenu()
DeviceInfo() is not reliable, I personnaly call the Mobile Detect PHP script (http://mobiledetect.net/) at the beginning of my apps.