Quantcast Dropdowns In a Nutshell - EQ2Interface
EQ2Interface.com
Search Downloads


Go Back   EQ2Interface > Developer Discussion > XML Modification Help & Info

Reply
Thread Tools Search this Thread Display Modes
  #1  
Unread 04-08-2005, 07:47 PM
Zonx's Avatar
Zonx Zonx is offline
A Green Troll
This person is a EQ2Map developer.
Featured
 
Join Date: Dec 2004
Server: Blackburrow
Posts: 2,221
Send a message via Yahoo to Zonx
Default Dropdowns In a Nutshell

I wont bother with all the usual properties, only what's needed to make dropdowns function.

Dropdowns are essentialy a mechanism for sellecting a row of data properties (aka fields or cells) from a database table.

The database for a dropdown is the DataSource object (not a DataSourceContainer).

Nested within the DataSource are Data Items. Data Items are essentially the rows of your database. They have only 1 default property "Name", which is used for internal referencing.

Data Items can be given any additional properties you desire. Each property used is esentially a field (or cell) in the database table. The name you give each property doesn't really mater. What matters is that you use the same property names on each Data Item. Corisponding property names form a column in your database table. The values assigned to those properties are the cells of the table.

Dropdowns also require a RowTemplate that includes at least 1 property used in the DataSource. The RowTemplate defines what's displayed in each row of the dropdown menu. The typical RowTemplate is /Templates.dropdowntemplate which uses a "text" property for display.

You'll also need to give the dropdown a style that defines its normal background and highlight background. The standard style is /dropdownlist.dropdown_default

So at a minimum, you have a dropdown object:

Code:
<Dropdownbox DataSource="MiscMapsDS" Name="MiscDropdown" RowTemplate="/Templates.dropdowntemplate" Size="51,16" Style="/dropdownlist.dropdown_default"/>
Which pulls data from the "MiscMapsDS" DataSource.

Example:
Code:
<DataSource Name="MiscMapsDS">
<Data Name="Misc" text="Misc"/>
<Data Name="World" text="World"/>
<Data Name="The Isle of Refuge" text="The Isle of Refuge"/>
</DataSource>
Each of the "text" values will be used in the menu.

Ok so we've got a menu, but it doesn't actually make anything happen. Here's where the magic happens!

Dropdowns have an OnSelect event handler that can be used to drive scripts when a selection is made. You can also pull the value of any property for the selected row using SelectedItem.propertyname. Combineing these 2 functions allows data to be pulled from the DataSource and passed to other objects.

Example:

Code:
Onselect="parent.TextWidget.text=SelectedItem.text"
This passes the value of the selected item's text property to TextWidget.

Ok maybe that's not so exciting. Lets try something more advanced. First lets add a property to each Data Item for associated commands.

Code:
<DataSource Name="MiscMapsDS">
<Data command="parent.size='10,10' parent.location='1,1'" Name="Misc" text="Misc"/>
<Data command="parent.size='20,20' parent.location='2,2'" Name="World" text="World"/>
<Data command="parent.size='30,30' parent.location='3,3'" Name="The Isle of Refuge" text="The Isle of Refuge"/>
</DataSource>
Now we'll add a simple button to recieve the command and exicute it when pressed.

Code:
<Button Name="RunCommands" Size="2,2" Visible="false"></Button>
Fianally we'll give the dropdown an OnSelect script to pass the command to the button, and press the button, thus exicuting the command.

Code:
<Dropdownbox DataSource="MiscMapsDS" Name="MiscDropdown" OnSelect="parent.RunCommands.OnPress=SelectedItem.command
parent.RunCommands.Press=true"
RowTemplate="/Templates.dropdowntemplate" Size="51,16" Style="/dropdownlist.dropdown_default"/>
Result: We now have a menu that runs any script associated with the selected text

Last edited by Zonx : 04-09-2005 at 07:07 AM.
Reply With Quote
  #2  
Unread 04-08-2005, 08:58 PM
dc_roenfanz's Avatar
dc_roenfanz dc_roenfanz is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Unkown
Posts: 588
Send a message via Yahoo to dc_roenfanz
Default

So, if I understand this, your sample drop down above is like ... the jump to forum dropdown. Click the down arrow, select forum, hit go. Right? I mean basically not exactly.

Ok, I think I understand that. maybe. OK about a thrid of it but they. thats cool.

Zonx is 133+ !!!

D
Reply With Quote
  #3  
Unread 04-08-2005, 10:06 PM
Zonx's Avatar
Zonx Zonx is offline
A Green Troll
This person is a EQ2Map developer.
Featured
 
Join Date: Dec 2004
Server: Blackburrow
Posts: 2,221
Send a message via Yahoo to Zonx
Default

heh, it can run any script you associate with a menu item. You might make a menu that completely reconfigures a window 5 different ways.

My latest map windows include menus that load any map on disk

I hope tto retool Kosmos emotes to use a few menus insted of a slew of buttons.
Reply With Quote
  #4  
Unread 04-09-2005, 01:27 AM
Deathbane27's Avatar
Deathbane27 Deathbane27 is offline
aka Mook
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Jul 2004
Server: Nektulos
Posts: 1,451
Default

Thanks for the info/tutorial, Zonx.

I'd sticky this but I think there's already too many in this board. Maybe I will anyway.
__________________
If it ain't broke, it needs more features!
Reply With Quote
  #5  
Unread 04-09-2005, 08:35 AM
Kosmos's Avatar
Kosmos Kosmos is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Lucan DLere
Posts: 581
Default

Great stuff! I also had some ideas instore for the emotes, just haven't had the time to get into the project. I wish I could just sit and play all the time! LoL!

That's a neat little way you got it to work by creating the button.
That is basically the way the StartMenu works, They use a button template, such as yours.

On interesting thing about the StartMenu is that the window sizes according to the number of data objects, which is a pretty nice feature. It doesn't actually use a listbox, or dropdown, but basically creates a list of buttons, using the button template.


I'm sure you also noticed using UI Builder, you can easily sort your list of data items. you can just move items up and down the tree, and it moves them in the list!


Ahh.. pour old emotes is going to get basted! LOL! I needs it badly, I knew when I made it that it would not be long until we figured a better way to do that. This is going to be an incredible tool, thanks for the post Zonx!
__________________
Kosmos
Qeynos Ranger (Retired)
Lucan D'Lere
Reply With Quote
  #6  
Unread 04-09-2005, 08:38 AM
Kosmos's Avatar
Kosmos Kosmos is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Lucan DLere
Posts: 581
Default

One other thing!

Once this problem was figured out, I wanted to post a generic module for the utilities section for this.

Basically a page that contains all the information for a working list box, with generic names and commands that the Mod people could alter for thier own uses. It woud not reference any other objects in SOE.
Like include it's own styles, and graphics references etc, all under the same page.
__________________
Kosmos
Qeynos Ranger (Retired)
Lucan D'Lere
Reply With Quote
  #7  
Unread 04-09-2005, 09:23 AM
Zonx's Avatar
Zonx Zonx is offline
A Green Troll
This person is a EQ2Map developer.
Featured
 
Join Date: Dec 2004
Server: Blackburrow
Posts: 2,221
Send a message via Yahoo to Zonx
Default

Sounds good with one exception...

DropdownStyles generally want images for their backgrounds. Its probably possible to create a style that only uses fill colors, but it'd be prety lame

I'd hate to see a billion mods with a billion itterations of the same DropdownStyle and images baried in them. Not sure, but I suspect this would cause a performance hit. It'd also make it a MAJOR pain to update the menu skin.
Reply With Quote
  #8  
Unread 04-09-2005, 04:26 PM
Deathbane27's Avatar
Deathbane27 Deathbane27 is offline
aka Mook
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Jul 2004
Server: Nektulos
Posts: 1,451
Default

Why not have the example dropbox use the default style?
__________________
If it ain't broke, it needs more features!
Reply With Quote
  #9  
Unread 04-11-2005, 07:37 AM
Zonx's Avatar
Zonx Zonx is offline
A Green Troll
This person is a EQ2Map developer.
Featured
 
Join Date: Dec 2004
Server: Blackburrow
Posts: 2,221
Send a message via Yahoo to Zonx
Default

Some more testing show's Listbox to work virtually identical to dropdown. One interesting difference is the addition of an OnDoubleClick event. Haven't tested this event in game, but it does nothing in UIBuilder.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:09 AM.


Our Network
EQInterface | EQ2Interface | War.MMOUI | WoWInterface | VGInterface | LoTROInterface | MMOInterface