NetTalk Central

Author Topic: Suppress Tool Tips in Desktop Mode  (Read 4088 times)

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Suppress Tool Tips in Desktop Mode
« on: April 22, 2014, 10:25:32 PM »
Hi Bruce,

Is there any way to suppress tool tips in desktop mode when the device is a tablet?

Regards,
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Suppress Tool Tips in Desktop Mode
« Reply #1 on: April 22, 2014, 10:45:40 PM »
Suppressing tips is easy; set

p_web.site.notips = true

I'd do this in the webHandler, ProcessLink method, before the parent call.

Figuring out if the user is on a tablet is harder. More specifically, when is a tablet not a tablet? For example, a surface pro with a keyboard and mouse. Is that still a tablet?

but let's pick the low-hanging fruit of Android and iOS.


if p_web.IsMenuTouch()
  p_web.site.notips = true
end


cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Suppress Tool Tips in Desktop Mode
« Reply #2 on: April 22, 2014, 11:03:52 PM »
That's awesome thanks Bruce!

I was testing the screen width using javascript to load desktop mode if mobile mode was set and the screen width is larger than a standard mobile phone width:

<script type="text/javascript">
$(document).ready(function(){
  if ($(window).width() > 600) {
    SetSessionValue('tablet',1);
    window.open("LoginForm?_mobile_=0","_self");
  } 
});
</script>

That stops mobile mode from loading automatically on a tablet. BUT p_web.IsMenuTouch() seems easier. What does it do exactly?

Regards,
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Suppress Tool Tips in Desktop Mode
« Reply #3 on: April 23, 2014, 02:59:21 AM »
check out netweb.clw and you'll see the code. It's not going to work everywhere (especially devices like Surface which have a mouse and Touch) but it deals with the obvious stuff in the short term.

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Suppress Tool Tips in Desktop Mode
« Reply #4 on: April 23, 2014, 01:10:13 PM »
Ahh I see, thanks Bruce.

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Suppress Tool Tips in Desktop Mode
« Reply #5 on: April 28, 2014, 03:19:05 PM »
Hi Bruce,

Just tested this with an iPad and it is not working. Looking at the User-Agent string that is coming in from the iPad, the IsMenuTouch() method isn't able to correctly match for an iPad.

IsMenuTouch currently looks for:

instring('ipad ',self._useragent,1,1)

...but the User-Agent string of this particular iPad was:

User-Agent: Mozilla/5.0 (iPad; CPU OS 7_1 like Mac OS X) AppleWebKit...

I think you may want to remove the space in each of the 'instring' check of this method so they look like:

instring('ipad',self._useragent,1,1)

Regards,
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Suppress Tool Tips in Desktop Mode
« Reply #6 on: April 28, 2014, 10:59:18 PM »
done

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Suppress Tool Tips in Desktop Mode
« Reply #7 on: April 28, 2014, 11:50:06 PM »
Awesome, thank you!