Can't customize ListboxTextItem

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

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Thu Feb 07, 2008 20:49

A slightly different interface would be to have each line consist of
  • a label describing the game action, potentially with a tooltip containing a detailed explanation
  • a pushbutton for the first key mapping
  • a pushbutton for the second key mapping
  • a scrollbar to scroll through the various entries


Clicking on either pushbuttons would open a dialog to allow the user to specify the keyboard key, either a single key or a combination with shift, ctrl, and alt. Once the user has specified the keyboard keys to activate the action you can display those keys as the text of the pushbutton.

The dialog could contain checkboxes to specify whether the shift, ctrl, and alt keys should differentiate between the left and right keyboard keys. The dialog could also contain three pushbuttons: ok (accept the key combination), cancel (do not change anything), and clear (to unmap this game action).

Have a look at CEGUIBuildDialog for an example application that uses a scrollbar to change the data displayed on a layout similar to what I've described above. Just skip the code that animates an Ogre mesh and concentrate on the scrollbar.

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Wed Feb 13, 2008 09:56

I may be blind but, I can't find the code which shows how the scrollbar works.

Can you tell me where exactly this section is or describe it to me how this scrollbar works?

Thank you!

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Wed Feb 13, 2008 13:27

The trick was to search for "Scrollbar" which reveals scrollbar->subscribeEvent(Scrollbar::EventScrollPositionChanged, Event::Subscriber(&DialogBuild::handleScrollChanged, this)); leading to

Code: Select all

bool DialogBuild::handleScrollChanged(const CEGUI::EventArgs& args)
   {
   int newScrollOffset;

   // This event gets thrown when the scroll bar position moves even a little bit,
   // and may not cause a change in the scrollOffset.
   // Only do an update if scrollOffset actually changes.
   newScrollOffset = (int)scrollbar->getScrollPosition() * DIALOG_BUTTON_COLUMNS;
   if (newScrollOffset != scrollOffset)
      {
      scrollOffset = newScrollOffset;
      PopulateButtons();
      }
   return true;
   }


and DialogBuild::PopulateButtons(void) which is where the "magic" happens. Basically the screen contains static/unchanging items that appear to scroll through a list because of the accompanying scrollbar (it's simpler to look at the provided image to understand this textual description).

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Tue Feb 19, 2008 08:00

Yeah, I do understand that.

But how do I have to arrange the widgets that a scrollbar can move statictext- and buttonelements?

Just inserting them in the same window doesn't work, does it?

Bye, Chaos

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Tue Feb 19, 2008 12:22

One important keyword in my previous post is the word appear. None of the widgets actually move. They only appear to move because you change their contents. I sent you to that page because we're missing a concrete example of a scrollbar in action.

I've wikied a pseudo multi-column listbox example. Hopefully this will clear up any questions.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 17 guests