A couple of GUI questions

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
rimbou
Posts: 20
Joined: Fri Nov 24, 2006 12:09 pm

A couple of GUI questions

Post by rimbou »

1) On IGUIWindow. Is there any way to prevent irrlicht from drawing the X to close the window?
2) On IGUIListBox. It always displays an scrollbar even if it's not needed. Can you make it only appear when necessary?

I know I could change those things in the irrlicht source, but I was wondering if there is some way to do this using the IGUISkin or something else.

Thanks.
________
Vapir no2
Last edited by rimbou on Fri Feb 18, 2011 6:07 pm, edited 1 time in total.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

1) should be quite simple if you look at the API
2) you can set the scrollbar invisible yourself though i don't know if there's any easy way of knowing whether it's needed or not.
Image Image Image
rimbou
Posts: 20
Joined: Fri Nov 24, 2006 12:09 pm

Post by rimbou »

JP wrote:1) should be quite simple if you look at the API
Yes that was very easy. getCloseButton()->setVisible(0)
JP wrote: 2) you can set the scrollbar invisible yourself though i don't know if there's any easy way of knowing whether it's needed or not.
I guess I'll have to add a function to the IGUIListBox that returns a pointer to the IGUIScrollBar
________
Lamborghini Lm002 Specifications
Last edited by rimbou on Fri Feb 18, 2011 6:07 pm, edited 1 time in total.
rimbou
Posts: 20
Joined: Fri Nov 24, 2006 12:09 pm

Post by rimbou »

If anyone is interested I made a patch:

Code: Select all

$ diff old --to-file=new
diff --to-file=new old/CGUIListBox.cpp new/CGUIListBox.cpp
382a383,387
> //! Returns a pointer to the Scroll Bar
> IGUIScrollBar* CGUIListBox::getScrollBar()
> {
>       return ScrollBar;
> }
diff --to-file=new old/CGUIListBox.h new/CGUIListBox.h
71a72,74
>               //! Returns a pointer to the Scroll Bar
>               virtual IGUIScrollBar* getScrollBar();
>
diff --to-file=new old/IGUIListBox.h new/IGUIListBox.h
15a16
>       class IGUIScrollBar;
60a62,64
>
>               //! Returns a pointer to the Scroll Bar
>               virtual IGUIScrollBar* getScrollBar() = 0;
I probably didn't use the right diff options to make the patch, so please enlienghten me on what options should I use ;)
________
BUY NO2 VAPORIZER
Last edited by rimbou on Sat Mar 12, 2011 6:06 am, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Try 'diff -Naurp <olddir> <newdir>'
rimbou
Posts: 20
Joined: Fri Nov 24, 2006 12:09 pm

Post by rimbou »

This patch adds getScrollBar() to IGUIListBox. This is useful for example if you dont want to display the scrollbar on the listbox.
Example:

Code: Select all

ListBox->getScrollBar()->setVisible(0);
Here it is with the other options.

Code: Select all

$ diff -Naurp old new
diff -Naurp old/CGUIListBox.cpp new/CGUIListBox.cpp
--- old/CGUIListBox.cpp 2006-11-26 07:11:36.000000000 +0100
+++ new/CGUIListBox.cpp 2006-12-13 19:35:49.687500000 +0100
@@ -380,6 +380,11 @@ void CGUIListBox::setIconFont(IGUIFont*
                IconFont->grab();
 }

+//! Returns a pointer to the Scroll Bar
+IGUIScrollBar* CGUIListBox::getScrollBar()
+{
+       return ScrollBar;
+}

 } // end namespace gui
 } // end namespace irr
diff -Naurp old/CGUIListBox.h new/CGUIListBox.h
--- old/CGUIListBox.h   2006-11-26 07:11:34.000000000 +0100
+++ new/CGUIListBox.h   2006-12-13 19:35:11.796875000 +0100
@@ -69,6 +69,9 @@ namespace gui
                //! Update the position and size of the listbox, and update the
scrollbar
                virtual void updateAbsolutePosition();

+               //! Returns a pointer to the Scroll Bar
+               virtual IGUIScrollBar* getScrollBar();
+
        private:

                struct ListItem
diff -Naurp old/IGUIListBox.h new/IGUIListBox.h
--- old/IGUIListBox.h   2006-06-17 08:12:12.000000000 +0200
+++ new/IGUIListBox.h   2006-12-13 19:36:17.562500000 +0100
@@ -13,6 +13,7 @@ namespace irr
 namespace gui
 {
        class IGUIFont;
+       class IGUIScrollBar;

        //! Default list box GUI element.
        class IGUIListBox : public IGUIElement
@@ -58,6 +59,9 @@ namespace gui

                //! sets the selected item. Set this to -1 if no item should be
selected
                virtual void setSelected(s32 id) = 0;
+
+               //! Returns a pointer to the Scroll Bar
+               virtual IGUIScrollBar* getScrollBar() = 0;
        };
________
MY WEBCAMS HOOKUP
Post Reply