RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

previous/next pages in gump

plus

Sorceror
previous/next pages in gump

Hi,

I have this gump which I want to add previous and next buttons too. I've tried everything I can think of but there is always something wrong with the method I choose.

Here is my method so far which comes from RunebookGump.cs:
Code:
 private void AddBackground()
		{
					
			AddImage(46, 27, 500);			
				
			
		for ( int page = 0; page < 8; ++page )
			{
			AddButton(46, 27, 501, 501, 0, GumpButtonType.Page, (1 + page) ); // previous page
		
			
				if ( page < 7 )				
					AddButton(402, 27, 502, 502, 0, GumpButtonType.Page, (page + 3) ); //next page
			}	
		}

The buttons show up but when they are pressed the gump just closes. I can't seem to work out what is wrong. Here is my gump so far:

Code:
using System;
using Server;
using Server.Gumps;
using Server.Items;
using System.Collections;

namespace Server.Gumps
{
	public class MonsterbookGump : Gump
	{
		private Monsterbook m_Book;
				
		public Monsterbook Book{ get{ return m_Book; } }
		
		private void AddBackground()
		{
					
			AddImage(46, 27, 500);			
				
			
		for ( int page = 0; page < 8; ++page )
			{
			AddButton(46, 27, 501, 501, 0, GumpButtonType.Page, (1 + page) ); // previous page
		
			
				if ( page < 7 )				
					AddButton(402, 27, 502, 502, 0, GumpButtonType.Page, (page + 3) ); //next page
			}	
		}
	
		
		public MonsterbookGump(Monsterbook book): base( 0, 0 )
		{
			m_Book = book;			
			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;	
			this.Resizable=false;
					
			

			AddPage(1);
			AddImage(46, 27, 500);
			AddButton(402, 27, 502, 502, 0, GumpButtonType.Page, 2);			
			//AddBackground();
			AddLabel(120, 44, 0, @"Monsters Killed");
			AddLabel(103, 86, 0, @"Cows");
			AddLabel(133, 86, 0, book.CowPoints.ToString());
			AddLabel(103, 106, 0, @"Other");
		
			AddPage(2);
			AddBackground();
			AddImage(261,12, 990);
			AddImage(260, 13, 653);

			AddPage(3);
			AddBackground();
			AddImage(46, 27, 500);
			AddImage(251, 15, 50617);
			AddImage(337, 25, 50647);
			AddImage(252, 17, 13);
			AddImage(251, 15, 60469);
			AddImage(231, 0, 1882);
			AddImage(230, 6, 1876);

		}
		

	}
}

Thanks for any help.

Plus
 

Seige

Wanderer
Hey!

Check out the gump from the pages for the reward stone! If you can't find an answer in the gump, post another reply and I will see what i can do...
 

plus

Sorceror
Well that is one way, though, I want to know how to do the way I have attempted.

I was hoping it would save me time instead of adding button after button on every page of the gump.

I was convinced that the way I was doing it should work but it doesn't. So I have posted to get another person's opinion on what could be wrong.

Thanks anyway :)
 

Seige

Wanderer
ok, here you go

Try this, seems you have a number wrong...

AddButton(402, 27, 502, 502, 0, GumpButtonType.Page, 2);

Nees to be this:
AddButton(402, 27, 502, 502, 2, GumpButtonType.Page, 2);

and so on for your others

as for this line
{

AddButton(46, 27, 501, 501, 0, GumpButtonType.Page, (1 + page) ); // previous page

if ( page < 7 )
AddButton(402, 27, 502, 502, 0, GumpButtonType.Page, (page + 3) ); //next page
}

try this, might have to experiment
{
AddButton(46, 27, 501, 501, 1, GumpButtonType.Page, (1 + page) ); // previous page

if ( page < 7 )
AddButton(402, 27, 502, 502, 1, GumpButtonType.Page, (page + 3) ); //next page
}
 

plus

Sorceror
Nope, still the same thing, the gump just closes.

I've tried changing the numbers and stuff but I still get the same outcome. Anymore ideas?
 
Code:
			for ( int i = 0; i < m_List.Count; ++i )
			{
				if ( (i % 11) == 0 )
				{
					if ( i != 0 )
					{
						AddButton( 300, 370, 4005, 4007, 0, GumpButtonType.Page, (i / 11) + 1 );
						AddHtmlLocalized( 335, 370, 300, 35, 1011066, false, false ); // Next page
					}

					AddPage( (i / 11) + 1 );

					if ( i != 0 )
					{
						AddButton( 20, 370, 4014, 4016, 0, GumpButtonType.Page, (i / 11) );
						AddHtmlLocalized( 55, 370, 300, 35, 1011067, false, false ); // Previous page
					}
				}

				// code for gump components you want on each page

from the GuildMobileList.cs
 

plus

Sorceror
Oh yeah, I completely forgot about the Guild gumps and stuff. Thanks.

Sadly, maybe because it's late, I just can't get my head round the arethmetic involved. When I manage to compile it all that happens is the pages just flick from 1 to 2.

I may just do it the long winded way. :rolleyes:

Thanks for help though guys.
 
Top