Page 1 of 1

MultiColumnList Keyboard Scroll

Posted: Fri Jan 13, 2012 16:16
by saejox
hi,

i have implemented keyboard item scroll like this

Code: Select all

const CEGUI::KeyEventArgs& key = static_cast<const CEGUI::KeyEventArgs&>(arg);

   if (key.scancode == CEGUI::Key::ArrowUp)
   {
      CEGUI::ListboxItem *selecteditem = bag->getFirstSelectedItem();

      if(selecteditem == NULL)
         return false;

      CEGUI::MCLGridRef grid =  bag->getItemGridReference(selecteditem);
      
      if(grid.row == 0)
         return false;
      
      bag->setItemSelectState(grid, false);
      grid.row--;
      bag->setItemSelectState(grid, true);


      return true;
   }


my question is
how can i auto scroll list so that when selected item becomes invisible list scroll automatically?
is there a way to make the list to always show selected item ?

Re: MultiColumnList Keyboard Scroll

Posted: Fri Jan 20, 2012 23:19
by saejox
i'm assuming silence means: nobody did something like this :cry:

i gave up on the idea. for now.
i'll just scroll list for a fixed amount every time up or down key pressed.

Code: Select all

      CEGUI::Scrollbar *s = bag->getVertScrollbar();
      s->setScrollPosition(s->getScrollPosition()-10);

Re: MultiColumnList Keyboard Scroll

Posted: Mon Jan 23, 2012 07:14
by CrazyEddie
A couple of the other list types have an 'ensureItemIsVisible' function, but the MCL does not for some reason - that might have been useful for you, though I'm not 100% clear on what you wanted to do. Currently keyboard support of any kind is not well provisioned.

CE.

Re: MultiColumnList Keyboard Scroll

Posted: Tue Jan 24, 2012 11:49
by saejox
CrazyEddie wrote:A couple of the other list types have an 'ensureItemIsVisible' function, but the MCL does not for some reason - that might have been useful for you, though I'm not 100% clear on what you wanted to do. Currently keyboard support of any kind is not well provisioned.

CE.


ensureItemIsVisible is exactly what i want. but it doesn't exist in mcl . :cry:

Re: MultiColumnList Keyboard Scroll

Posted: Wed Jan 25, 2012 08:27
by CrazyEddie
Yeah. You could look into adding that if you like (make it good and submit a patch / pull request to mantis, please :)). The code would be similar to the way it's done in Listbox. My advice would be to add ensureRowIsVisible, ensureColumnIsVisible and then ensureItemIsVisible would be implemented in terms of those two functions.

CE.