Page 1 of 1
scrolling and clicking
Posted: Sat Mar 07, 2020 4:55 pm
by BigameOver
Hi,
In my app there is a scrolling group. Inside the group there is a field.
When the user click on the field it should move him to another card but instead it doesnt work and it let him only scroll the group (field).
How can I make the program notice between clicking on the field and scrolling it?
thanks for the helping

Re: scrolling and clicking
Posted: Sat Mar 07, 2020 5:17 pm
by Klaus
Hi BigameOver,
editable (= UNLOCKED) fields do not receive a "normal" mouseclick, only a right-click!
So maybe that is the probem?
Best
Klaus
Re: scrolling and clicking
Posted: Sat Mar 07, 2020 5:27 pm
by BigameOver
Hi Klaus,
The app is only for android.
Re: scrolling and clicking
Posted: Sat Mar 07, 2020 5:35 pm
by Klaus
Same applies to this platform!
What did you script so far?
And is that namely field locked or not?
Are you using native scroller(s)?
Re: scrolling and clicking
Posted: Sat Mar 07, 2020 6:17 pm
by BigameOver
I am attaching the file here
Re: scrolling and clicking
Posted: Sat Mar 07, 2020 6:27 pm
by Klaus
Sorry, I don't own any mobile device (yes, no cellphone, that's me), so I cannot test your stack.
Re: scrolling and clicking
Posted: Sat Mar 07, 2020 7:05 pm
by dunbarx
Hi.
I commented out the lines restricting to mobil. The single field on cd 1 is not a scrolling field, so I made it one. The variable "sScrolling" is never "false", so the handler "touchTable" never fires. I changed it to:
Code: Select all
on mouseFakeUp
-- if the environment is not "mobile" then exit mouseFakeUp
if _sScrolling is true
then
put false into _sScrolling
-- else
send "touchTable" to field "chooseTable" of group "scrollerGroup" in 0 sec
end if
set the layerMode of me to "Static"
end mouseFakeUp
I also commented out this:
Code: Select all
-- set the label of button "machinePicker" of card "mainCard" to the text of item tCell of line tLine of me
Because there is no button "machinePicker" anywhere. If there was, before the change to the "if/then" construction, an error would have been thrown when LC could not find that button.
So at least now a click in the field sends you to the next card.
But I am only fooling around here. It seems that what you want to do could instead be implemented in just a handful of lines of code in a single handler. But perhaps you are preparing for much additional functionality, and that is fine.
So can you give a rundown of the major gadgets you want from this app? And fix the things above and write back.
Craig
Re: scrolling and clicking
Posted: Sat Mar 07, 2020 7:57 pm
by BigameOver
Hi dunbarx,
I think you didn't understand what I want.
I want the app to open the card "mainCard" if the user clicks on the group and doesn't scroll it.
If he scrolls the group, the app will not open this card.
However, thanks for the helping

Re: scrolling and clicking
Posted: Sat Mar 07, 2020 9:59 pm
by dunbarx
Hmmm.
It was something I said. Oh yes:
So at least now a click in the field sends you to the next card.
Try this in a new stack. Make two cards. On card 1 make a scrolling field with enough lines of text in it so you have to scroll to see it all. Set the lockText of the field. Group the field (though this is not necessary at all). Put this into the field script:
The way scrolling fields are built, with the above one-liner, the body of the field will accept a "mouseUp" message, but the area of the scrollbar will not. So you can either scroll all day, or click and navigate.
Craig
Re: scrolling and clicking
Posted: Sat Mar 07, 2020 10:03 pm
by dunbarx
Hmmm, again.
Or was it important for you that the user be able to click in the actual scrollbar area, without moving the mouse, and navigate? This is not usual practice, but anything can be kluged.
Let me know...
Craig
Re: scrolling and clicking
Posted: Sun Mar 08, 2020 6:09 pm
by jacque
The handler will be different depending on whether you are using a native mobile scroller or just a normal LC group. You won't get smooth scrolling with plain LC groups and the scrollbar is almost too small to use. Layout is also different depending on which method you use.
If you are using a native scroller, save the group scroll in a script local variable on mouseDown, and on mouseUp compare the scroll to the saved start position. If either the vscroll or the hscroll is less than 10 then it's a tap. (If 10 pixels isn't enough you can increase it slightly.) Native scrollers should be applied to the group, and the field inside the group needs to be as tall as the field's formattedHeight. If the group contains more objects than just the single field, you'll need to nest the grouped field inside the larger group and it gets a bit more complex.
Or are you using regular LC controls only? It's difficult to work with narrow scrollbars on mobile phones but if that's your choice then use mouseUp to detect a tap. The scrollbar will handle the scrolling without any scripting.