datagrid in iOS scroller (improved questions)

Terry Judd terry.judd at unimelb.edu.au
Fri Mar 23 02:48:50 EDT 2012



On 23/03/2012, at 5:34 PM, "Ken Corey" <ken at kencorey.com> wrote:

> On 22/03/2012 21:42, Ken Corey wrote:
>> On 22/03/2012 20:02, Michael Doub wrote:
>>> I have successfully used form data grids on IOS with no problem. Can
>>> you be more clear on the symptoms of your problem?
>>> 
>>> Are you setting the layer mode of the grid to scrolling and
>>> AcceleratedRendering of the stack to true?
>>> 
>>> http://livecodejournal.com/forum/viewtopic.php?f=23&t=54
>> 
>> Hi Michael,
>> 
>> Thanks for writing.
>> 
>> The symptom is that when I touch and drag to scroll the formatted area
>> of the dataGris scrolls up too without revealing any more of the details
>> of itself.
> 
> Ah, that's better.  After a night's sleep, I can (hopefully) express myself better.
> 
> The symptom is that scroll events are used to set the hScroll and vScroll of the group, which moves the contents up.
> 
> What I want to do is forward the "scrollerDidScroll" method on to the datagrid, and let the datagrid handle the scrolling instead of moving a group.
> 
> Of course, the datagrid needs to be able to talk back to the scroller to tell it how big it is, where it is in the total height of its content, etc.
> 
> Added wrinkle: The datagrid does not have fixed-height rows.  They are variable.  That means that if I'm at the top of a 50 element datagrid, and displaying 10, the size of the other 40 haven't been created yet, and so I don't know how big they'll be.  I guess I could shoot for an average height, and just guess.
> 
> So I guess my improved questions would be:
> 1) How do I send scrollerDidScroll events into a datagrid?
> 2) How do I tell the scroller how big the datagrid is?
> 3) BONUS: if I don't have fixed height rows in the datagrid, how can I figure out how tall the datagrid is in total?
> 
> -Ken

Hi Ken - don't know if it will help but what I usually do is put group the form datagrid inside of another group (with the datagrid as the only member) and then lock the 'parent' group to the required size. Then, each time I update the datagrid I set it's height to the maximum value of the height of the parent group and the dgFormattedHeight of the datagrid. I use this same value to set the scroller object's dimensions.

Terry...




More information about the use-livecode mailing list