Author Topic: Changing focus to scrollview  (Read 3281 times)

albert

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Changing focus to scrollview
« on: January 02, 2014, 08:03:21 AM »
Hello all!

Let's see if I can explain my problem in an understandable way :)

I have a level select screen with a list of item throught i move with keys (UIKey Buttons), when I select a level i need to show a "layer" on top with a skin selection with a scrollview and want to navigate with buttons too (I place it out of see, and move in with TweenPosition).

My problem is that when I move the layer in, the focus continue in the level selection, so I can't move the skin with buttons because of focus. If I click on the scrollview, then I can move que skins with the buttons (I have duplicate and modified the UI Center On Click script, to UICenter on Select), but i don't know how to change the focus when I select the level.

In addition, can I disable buttons when I click other buttons?

I hope is understandable ^^

Thanks!!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Changing focus to scrollview
« Reply #1 on: January 02, 2014, 11:21:44 AM »
Unfortunately I don't understand what you're asking here. Changing focus to scroll view... scroll view can't be controlled using keyboard or joystick. Then you talk about clicking on scroll view... how can you click on a scroll view? Scroll view is just a script that goes on a panel, neither of which respond to events. Only widgets with colliders will respond to events, and thus can get selection/focus. In any case, you can change the selection using UICamera.selectedObject = YourNewGameObject.

albert

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Changing focus to scrollview
« Reply #2 on: January 02, 2014, 12:00:12 PM »
Sorry for my explanation hehe,

I have a scroll view with some sprites inside that have colliders and buttons scripts. There is and original function called "UICenter on click" to center in the scrollview, I have modified the OnClick to OnSelect and assigned "UIKey Buttons" to each sprite, so I can control them by keys, centering the selected sprite in the scrollview.

As you comment, I'll try to change the focus on the buttons to the sprites inside the Scrollview with the UICamera function when I press the outside button of level select :)

Thanks!

simba

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Changing focus to scrollview
« Reply #3 on: March 25, 2014, 09:47:17 AM »
Sorry for my explanation hehe,

I have a scroll view with some sprites inside that have colliders and buttons scripts. There is and original function called "UICenter on click" to center in the scrollview, I have modified the OnClick to OnSelect and assigned "UIKey Buttons" to each sprite, so I can control them by keys, centering the selected sprite in the scrollview.

As you comment, I'll try to change the focus on the buttons to the sprites inside the Scrollview with the UICamera function when I press the outside button of level select :)

Thanks!

Sorry to bring up 2 months old topic, hope you can still read it, but i need exactly what you did with the scrollview and  the keyboard.. can you tell me more precisely how you did it? newbie here :)

simba

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Changing focus to scrollview
« Reply #4 on: March 25, 2014, 10:57:11 AM »
Sorry for the bothering.. figured it out, simple as fruck, just placed the uibutton script on the gameobject and worked like a charm ;)