A 'PopupList' control (implemented with OOP).
Posted: Thu Jan 31, 2008 7:45 pm
Update - Jan 1st 2008.
Bug fixed.
The PopupList control was destroying all other ownerdrawn controls placed on the same window! Doh!
Download
===============================================
Hi,
I was in need of a simple (and easy to implement!
) control which combined the functionality of a basic popup menu with a scrollable listbox gadget and one which could be positioned anywhere. By simple I mean that I wanted Windows to do all the hard work of tracking the mouse, dealing with overlap, keyboard control etc.
Hence, a whopping great cheat was in order!
Still, minimal testing aside, it seems to work okay.
Here's a quick demo Windows exe which you can try :
http://www.purecoder.net/PopupList.exe
(Simply run it and right-click anywhere in the Window etc.)
Methods exposed by the PopupList class :
NOTES.
Bug fixed.
The PopupList control was destroying all other ownerdrawn controls placed on the same window! Doh!

Download
===============================================
Hi,
I was in need of a simple (and easy to implement!


Hence, a whopping great cheat was in order!
Still, minimal testing aside, it seems to work okay.
Here's a quick demo Windows exe which you can try :
http://www.purecoder.net/PopupList.exe
(Simply run it and right-click anywhere in the Window etc.)
Methods exposed by the PopupList class :
Code: Select all
AddItem(position, text.s)
ClearItems()
Destroy()
GetColor.l(colorType)
GetFont.l()
GetHeight.l()
GetItem.s(position)
GetItemCount.l()
GetState.l()
GetWidth.l()
GetX.l()
GetY.l()
RemoveItem(position)
Resize(x, y, width, height)
SetColor(colorType, color)
SetFont(font)
Show.l(state=-1)
- There is no help manual / user guide. Instead, look at the residents file for a few comments on each method where appropriate. Most methods are completely and utterly self explanatory.
- This can easily be extended to allow for icons etc.
- Embedding other controls within this control is quite feasible. It would be quite a bit of work though and it is not something which I require just yet, so I will leave this for another day.
- I haven't done much testing!