Thanks Monte, I did over-summarize. I'm not sure why it's going wrong, but it sounds like it's something I'm doing. I have a standard "createScroller" handler that I've been using for years, but I've never had to set the hScroll before. It's always been zero.

In this case, I set the hScroll of the group to the formattedWidth of the group, which may be wrong. The engine seems to compensate though and sets the scroll as far as it should go. Then I call "createScroller" and pass the name of the group. The handler:

command createScroller pName
  -- pName = the long ID of a grp
  put the rect of control pName into tRect
  put the hScrollBar of control pName into tHScroller
  put the vScrollBar of control pName into tVScroller
  put the hScroll of control pName into tHScroll
  put the vScroll of control pName into tVScroll
set the hScrollBar of control pName to false -- remove fld scrollbars on mobile
  set the vScrollBar of control pName to false
  mobileControlCreate "scroller", pName
  mobileControlSet pName, "rect", tRect
put ("0,0," & (the formattedwidth of control pName) & "," & the formattedheight of control pName) into tContentRect
  mobileControlSet pName, "contentRect", tContentRect
  mobileControlSet pName, "hScroll", 0
  mobileControlSet pName, "vScroll", 0
  mobileControlSet pName, "hIndicator", tHScroller
  mobileControlSet pName, "vIndicator", tVScroller
  mobileControlSet pName, "hScroll", tHScroll
  mobileControlSet pName, "vScroll", tVScroll
  mobileControlSet pName, "visible", true
end createScroller

I initialize both the group and the scroller to 0 before doing anything else, because when I wrote it I couldn't get them to align correctly otherwise. I should also probably mention that I'm using fullscreenMode "showAll" and the group is expanded beyond the borders of the card to fill the screen; i.e., it probably has a negative left margin and a wider right margin. When the scroller finally does scroll (after resetting itself) it scrolls too far at the left side by the number of pixels between the screen left and the card left, and cuts off the same amount on the right side.

Can you see what I should change?


On 5/28/19 6:33 PM, Monte Goulding via use-livecode wrote:
Hi Jacque

I’m thinking you are over summarising what you are doing here. For example, I 
expect you mean to set the hScroll of the group to the formattedWidth - the 
width of the group. Are you setting the contentRect appropriately before 
setting the hScroll of the scroller?

Cheers

Monte

On 27 May 2019, at 8:03 am, J. Landman Gay via use-livecode 
<use-livecode@lists.runrev.com> wrote:

I want to verify this is a bug and not just me.

I'm creating a mobile scroller over a group. I want the group to initially 
display with its hScroll all the way to the right. I'm doing this:

zoom the group out to fill the screen
create a mobile scroller with the same rect
set the hScroll of the group to its formattedWidth
set the hScroll of the scroller to the scroll of the group

If I insert an answer command to show the scroller's hScroll it reports the 
correct number. But the scroller always acts like its scroll is 0, and it won't 
scroll to the left at all. But scrolling it to the right zaps both it and the 
group to zero and after that it scrolls normally.

I've also tried not setting the group's scroll and just setting the scroller 
alone, thinking it might trigger the scrollerDidScroll handler, but it doesn't.

If I don't set any hScroll at all on either the group or the scroller, all is 
well.

Has anyone else seen this?

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to