Plans for more native elements?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Plans for more native elements?

Post by richardmac » Sat Jan 08, 2011 7:57 pm

We have the scroll wheel picker, I know, but...

Well, will there ever be native support for something like this:

Image

This type of interface is, for settings, the standard Apple way of doing things. I've only just begun to read Apple's Human Interface Guidelines for the iOS, but this type of thing is everywhere, to the point where this look and feel are expected. I can rig a hack that sort of looks like this, but it won't behave the exact same way. In Apple's, you touch an element, it is then hilighted in blue and the text turns white, and the screen slides over to display the contents of what you selected. I'm wondering if there's a plan to include this somehow in a future version?

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Plans for more native elements?

Post by richardmac » Sat Jan 08, 2011 9:21 pm

I've been trying to simulate this, and it's impossible to do it properly. You'd have to do the entire thing with images - you couldn't do it with any kind of a real text field. This is a pretty big key thing for iOS development.

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Plans for more native elements?

Post by richardmac » Sat Jan 08, 2011 10:19 pm

Here is my best attempt and you can see the issues. I created a graphic for the background that looks like Apple's standard look, and put a field on top of it set to "list." There are two major issues - one, when you click on a line, the hilight goes over top of the background image/graphic. I suppose I could hide/show a duplicate image in the correct location, somehow. The second issue is that in order to get the hilighting to line up with the typical Apple look, the text sits too low. It's supposed to be centered on the line. As far as I can tell, LiveCode has no real way of changing that property.

One thing that DOES work, is when you view this on the iPad, the hilighted text color changes to white.

Anyone doing any serious iPad development is going to run into this same issue eventually. This is as close as I've gotten - does anyone have any ideas?

Image

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Plans for more native elements?

Post by bn » Sun Jan 09, 2011 2:23 am

Hi Richard,

I ran into the same problem of the font sticking to the bottom. I used superscript in the html of the htmlText of the field.

I looks a littel better if you set the htmlText of the field to "sup". It lifts the text 3 points. Which is not centered to the horizontal middle but looks a bit better.

Code: Select all

-- adjust boldness and superposition of text
function createHTML pNames
   put "<p>" into tP
   put "</p>" into tPEnd
   put "<sup>" into tSup
   put "</sup>" into tSupEnd
   put "<b>" into tB
   put "</b>" into tBEnd
   put "&#9;" into tTab
   
   -- this is not correct html but Rev/Livecode completes the missing syntax
   repeat for each line aLine in pNames
      if the number of chars of aLine > 1 then
         put tSup & tP & tB & tTab &  word 1 of aLIne & tBEnd && word 2 to - 1 of aLIne  & tPEnd & tSupEnd & return after tCollect 
      else
         put  tP & tSup & aLine & tSupEnd & tPEnd & return after tCollect
      end if
   end repeat
   delete last char of tCollect -- a return
   return tCollect
end createHTML
this function formats the text bold and superscript. You would probably have to adjust this code to your needs
Pass the text to the field to format to this function and set the htmlText of the field to the return value of the function.

Kind regards

Bernd

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Plans for more native elements?

Post by richardmac » Sun Jan 09, 2011 3:55 am

Thanks for the help - I ended up figuring how to do what I wanted to, or very very close to it. I'm going to put it in a new thread in case people want to know how to simulate this - they might not happen to read this thread.

hliljegren
Posts: 108
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: Plans for more native elements?

Post by hliljegren » Sun Jan 09, 2011 12:37 pm

I think you have to create a group instead of using a field, then you have total control of the layout, can add the "correct" behavior on touch etc. I'm currently implementing something similar for a project, and for me the only way to go is to use a group.

I've created one group for each line in the list and then another group that contains the complete list, i.e. several "lines". Much the same way the datagrid works. This functionality could in fact be implemented using the datagrid in form mode. YES as the datagrid is "pure" LiveCode it works in iOS!
___________________________________
MacBook Pro, 15" 2.6GHz i7 Mac OS X 10.10.4
iMac 27", 3.2 GHz Quad i7, Mac OS 10.10.4
LiveCode 7.0.6 or 8.0dp4

RickD
Posts: 31
Joined: Thu Feb 11, 2010 5:47 pm

Re: Plans for more native elements?

Post by RickD » Fri Jan 14, 2011 6:28 pm

hliljegren:

Have you been successful in using a datagrid AND the scroller native control?
I have done a text field scroll well.
I have also done a well behaved datagrid.
But i have not been able to scroll and make selections on a datagrid with the native scroller control???

I think this is a real show stopper for deploying data driven LiveCode apps in the apple store. We need a good apple like list management system like richardmac outlined at the beginning of this post. A simple scrollable text field will not meet the UI standards iPhone customers demand of native applications.

Any suggestions would be greatly appreciated.

hliljegren
Posts: 108
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: Plans for more native elements?

Post by hliljegren » Mon Jan 17, 2011 12:49 am

RickD:

Well I haven't had time to try out the datagrid for extensive use on the iOS devices. I rolled my own list management for my current app, as I thought that I wanted a bit finer control, and mostly the datagrid felt like a bit overkill for my needs. My basic priciple for doing these kind of things is to:
1. Create the layout for one "row" in the list.
2. Create a group from this layout.
3. Create a behavior that handles the data setting and getting in that group. This behavior should also handle the selection for the group, (i.e turn the background blue etc) and the layout for a single row (if you want to support rotation).
4. Create a group for the list.
5. Create a behavior that will handle the list. This handle should be able to add new elements to the list, delete elements, etc.

My plan is to do two layouts, one for retina display and one for "regular" displays. Then I will let my list handler select layout based on the display resolution. I have done some minor (but successful!) testing for this.
It's not that hard when you realize the power of groups and behaviors in LiveCode. And as you then have a group you can "attach" that to a UIScrollView as in the example in the examplestack. I guess you need to optimize the drawing if you need to be able to handle several hundreds of rows but for my purpose it works well.
___________________________________
MacBook Pro, 15" 2.6GHz i7 Mac OS X 10.10.4
iMac 27", 3.2 GHz Quad i7, Mac OS 10.10.4
LiveCode 7.0.6 or 8.0dp4

RickD
Posts: 31
Joined: Thu Feb 11, 2010 5:47 pm

Re: Plans for more native elements?

Post by RickD » Mon Jan 17, 2011 7:01 pm

hliljegren:

I agree with you 100%. It just requires a lot more work than just using LC native controls.
At any rate, I will try your approach. Thanks for the posts!

Cheers

Post Reply

Return to “iOS Deployment”