iPad differences

Forum to discuss the Web client version of Servoy.

iPad differences

Postby antonio » Mon May 16, 2011 2:14 pm

It seems that iPad doesn't like the onElementFocusGained and onElementFocusLost form events. I have a global method to highlight the current field by changing the background color. Works fine on most platforms but on iPad it causes the keyboard to hide as each field is entered.

Code: Select all
function onElementFocusChanged(event) {
   var vElem = event.getElementName()
   var vEventType = event.getType()
   var vForm = event.getFormName()
   if (vElem && vForm)
   {   
      var vElementType = forms[vForm].elements[vElem].getElementType();
//      application.output(vElementType)
      if (vElementType == ELEMENT_TYPES.TEXT_FIELD || vElementType == "TYPE_AHEAD") // doesn't look nice on combobox
      {
         if (vEventType == "focusGained")
         {
            forms[vForm].elements[vElem].bgcolor =  '#ffffcc' // pale yellow
            //'#ccffff' // pale blue
            //'#ffffcc' // pale yellow
            //'#ffff99' // yellow
         }
         else {
            forms[vForm].elements[vElem].bgcolor = '#ffffff' // white
         }            
      }
   }
}

I've tried this to remove the methods when an iPad is detected.

Code: Select all
function fixIpad() {
   var vAgent = Packages.org.apache.wicket.Session.get().getClientInfo().getUserAgent()
   var vIpad = utils.stringPatternCount(vAgent,"iPad")>0
   if (vIpad)
   {
      var vForm = solutionModel.getForm("ce_frm_invoices");
      vForm.onElementFocusGained = SM_DEFAULTS.NONE
      vForm.onElementFocusLost = SM_DEFAULTS.NONE
   }
}

However I get an error
Cannot convert -1 to com.servoy.j2db.scripting.solutionmodel.JSMethod
Tony
Servoy 8 - 2022.03 LTS
antonio
 
Posts: 638
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia

Re: iPad differences

Postby Harjo » Mon May 16, 2011 2:30 pm

I would do this in the servoy_webclient_default.css.

One place, for ALL web-client fields.....
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: iPad differences

Postby antonio » Mon May 16, 2011 2:38 pm

Thanks Harjo, I only want to do it for WC on iPad. WC on other platforms handles the event ok.
Tony
Servoy 8 - 2022.03 LTS
antonio
 
Posts: 638
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia

Re: iPad differences

Postby jcompagner » Mon May 16, 2011 3:23 pm

for setting method references to null you have to use SM_DEFAULTS.COMMAND_NONE

Will look if we can make that a little bit more clear.

Edit: Or just use form.myevent = null;
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: iPad differences

Postby antonio » Tue May 17, 2011 10:07 am

I wonder if the behaviour could be fixed, so we can use onElementFocusChanged(event) on iPad?
Tony
Servoy 8 - 2022.03 LTS
antonio
 
Posts: 638
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 6 guests