Jump to content
  • Advertisement
Sign in to follow this  
Hortense

Need tutorial for custom gui Listbox

This topic is 3168 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to design a categorized listbox for use with directX and could really use a tutorial, guide, something. I tried searching the site but found nothing that didn't simply gloss over it. To clarify, because i know its not really called a categorized list box. From windows, open up a folder and click View->Details. Thats what i am trying to do, multipe columns for each list item, ability to sort by each column, ascending or descending, the ability to add or remove columns as desired, etc. I know its not called a multicolumn list box, atleast that brings up a list which scrolls left to right, instead of up and down. Whether or not the tutorial uses directX is irrelevant, as i am really only having trouble with the mechanics of the list box, i can manage directX just fine. I have come up with two or three solutions that would work, but they often manage it by coupling or massive data duplication, This, to me, is improper. It seems there must be a better, cleaner, correct way of doing it, i just can't figure it out. Although this wouldn't be the first time i've chased a fantasy "perfect" solution. Any help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
That looks more like a table to me. Instead of trying to shoe-horn a list into a table, assuming you are, it is probably a good idea to start from scratch in building it.

For displaying, I'd assume you would use an array of rows, each containing an array of cells. Each cell then contains the information. How you would sort this information, I have no idea, although multiple linked lists springs to mind.

I don't really have any other ideas or examples for you, as I've never actually written a table widget/window, but hopefully this will nudge you in the right direction

Share this post


Link to post
Share on other sites
That's a pretty specific thing you're trying to do and I don't think there's going to be a "tutorial or guide" that specifically addresses the problem you're trying to solve.

If you can give us some idea as to how your data is represented and what sort of features you want your listbox to have, maybe we can help you come up with a basic design.

(Also, "multi column listbox" seems like the correct name for this control to me. I believe the control that explorer uses for View->Details, is called a "list view" [some examples], but in reality the control that explorer uses for View->Details is actually the same control it uses for all other views - the "list view" control in Win32 is pretty powerful [smile])

Share this post


Link to post
Share on other sites
It will probably help just having a better name for what i want to search for.


The plan was to design this component from the ground up, then see if i could trim the fat and derive it from the basic list box later, having some similar qualities, atleast at first glance. but if it needs to stand on its own, thats perfecty fine. Not trying to shoe horn anything in.

everything i listed is what veiw->details does. not really anything specific i don't think...

My biggest problem, which i hinted at earlier, is i make mountains out of mole hills. i sometimes ridiculously overexaggerate the costs of doing things in my mind, or conclude that something isn't correct/object oriented, and it becomes difficult to convince myself i am mistaken. Even if someone hasn't done it exactly the same as the designs i have running around in my head, seeing them address the pitfalls i forsee, often is enough. Also in this particular case, i have seen alot of games do this control very, very badly(dominions, civilization). Which only makes me obsess more.

The control is for a game. The list is meant to display various game objects of potentially different types, but with obviously some common variables/components, for user selection. While not neccessary, i would like all the functionality i see in view->details. resizing columns, changing the order of columns, hiding columns. highlighted the seected column, etc.

Since the data is already present in the objects(things like name, cost, size, build time, whatever), i would rather not, if possible, duplicate it. So instead of filling in a half dozen or so strings which represent the individual columns, for each listed item, somehow cleanly track back to the object and retrieve the information directly.However I consider passing the object to the list veiw to be a really bad design, its no longer a generic, reuseable control.

My current thinking is to divide the controll into two parts, one part handles the scrolling, the placement of columns, which columns are visible, etc. the second part then houses and sorts the data, dispays when asked by the list veiw. this second part can then be overwritten on creation. So it could have a basic version which uses strings for each column that must be manually set, and then i could override it with a custom one which you could then, by my thinking, safely give direct access to the objects. Essentially, "user drawn", although it does a little more than draw.

The next thing i am trying to figure out the best possible solution for is managing communication with this control. The current design simply lumps all controlls into the equivelent of a window, with all the other controls i have written, the communication with them is very generic, so this works perfectly fine, however with the list box, and especially this list veiw, the communication isn't generic at all. it takes alot of very specific interaction. I abhore microsofts messaging system, and its casting of variables into Lparam,wparam, however if i store controlls as themselves, it become limiting, since i need to know every control type there will ever be, and i loose the generic functionality for the rest of interaction , which is very useful(repositioning, recursive drawing, etc).


I hope that makes it clear what i am looking for and trying to do, but i know that i am horrible at explaining things in text.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!