PDA

View Full Version : ScrollComponent - disabling buttons during scroll



BigBMan
04-16-2011, 08:27 PM
I've got a horizontal set of icons/buttons I scroll with the ScrollComponent. Wondering what the best solution would be to disabling them when the parent Entity is being scrolled. I'm thinking of creating a ScrollInputSwitchComponent, which would disable all sibling Entities while they are being scrolled. Ideas?

Seth
04-17-2011, 02:44 PM
Hmm, not sure I understand. You have a scrolling area inside of another scrolling area? (one ScrollComponent embedded in another one?)

BigBMan
04-17-2011, 04:47 PM
Sorry, I have a set of ButtonOverlayComponents inside a scroll area. They are rather large buttons and I want to avoid the user activating a button click while they are scrolling through them.

Seth
04-17-2011, 11:36 PM
Ah, ok.

Well, if you want the behavior to be a click down on a button clicks, but to ignore the click releases, you could do this for each button during setup:


pButtonEnt->GetComponentByName("Button2D")->GetVar("buttonStyle")->Set(uint32(Button2DComponent::BUTTON_STYLE_CLICK_O N_TOUCH));

Or try BUTTON_STYLE_CLICK_ON_TOUCH_IGNORE_DRAGGING or BUTTON_STYLE_CLICK_ON_TOUCH_RELEASE for the other available behaviors.

If the behavior you want is "once the person starts scrolling, ignore button presses" this works with BUTTON_STYLE_CLICK_ON_TOUCH, but it seems like you'd also want to ignore that first click even on a button IF they start dragging with it immediately after, instead of just release it.

I don't see a built in way to do that yet... maybe the solution would be to make ScrollComponent smarter and if more than say, 10 pixels of movement is detected then it could mark the touch as "taken" so the button will ignore it - (TouchStripComponent does this for example)