A place to show off my creations and maybe write some articles on DesktopX scripted object creation techniques.
Part 2 - The inital idea
Published on September 24, 2004 By pjpowell In Scripts
While working on a recent(ish) widget which needed a themed listbox I came across a problem. The problem is that there is no real way to customise a standard listbox control to the degree that it would not look out of place on a custom widget.

As a result I decided to code a listbox control from scratch. The control would be entirely made of png's and text objects. There would not be any reliance on ActiveX controls. The other goal would be that it has to be fast in operation.

The list of goals are as follows:

Listbox will be entirely made of DesktopX objects and use no external plugins apart from DXScript.
Listbox will be fast in operation.

Listbox must allow the following actions (may think of more later) :

PJListbox.AddItem - Adds an item to the listbox
PJListbox.RemoveItem - Removes an item from the listbox
PJListbox.Clear - Empties the listbox
PJListbox.SaveToFile - Saves the list to a file
PJListbox.ReadFromFile - Populates the list from the file
PJListbox.Sort - Sorts the listbox (probably using a quicksort)

For this the following objects will be needed:

PJListBox - This is the Controller. Contains all the clever stuff.
PJLBItem1 - This is the base object all items will be duplicated from. Only needs to respond to a click by telling the controller it’s been clicked.
PJLBUp - This is an up arrow.
PJLBDown - This is a down arrow.
PJLBScrollBar - This is the bar the scrollthumb will move in.
PJLBScrollThumb - This is the thumb that allows scrolling.

Comments
No one has commented on this article. Be the first!