MultiColumnList Keyboard Scroll

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

saejox
Just popping in
Just popping in
Posts: 8
Joined: Sun Nov 20, 2011 18:17

MultiColumnList Keyboard Scroll

Postby saejox » Fri Jan 13, 2012 16:16

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 ?

saejox
Just popping in
Just popping in
Posts: 8
Joined: Sun Nov 20, 2011 18:17

Re: MultiColumnList Keyboard Scroll

Postby saejox » Fri Jan 20, 2012 23:19

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);

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: MultiColumnList Keyboard Scroll

Postby CrazyEddie » Mon Jan 23, 2012 07:14

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.

saejox
Just popping in
Just popping in
Posts: 8
Joined: Sun Nov 20, 2011 18:17

Re: MultiColumnList Keyboard Scroll

Postby saejox » Tue Jan 24, 2012 11:49

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:

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: MultiColumnList Keyboard Scroll

Postby CrazyEddie » Wed Jan 25, 2012 08:27

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.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 16 guests