DirectButton unselect in DirectScrolledList?

Hi,

I’ve been goofing around a bit with DirectGui lately (yes, in python), and I ran across a problem, when adding DirectButtons in a DirectScrolledList.
In my itemMake-function, I create thus a DirectButton, and use the command= to set the ‘selected-event’, I used button.bind(DGG.ENTER/EXIT to set mousehover events, but I could not find any way to set an event when an item is unselected.
From within my itemMake function I don’t have access to my list so I can’t loop through all the items in the list and mark them as unselected. Currently it looks pretty odd because if I select a different item in the list with the mouse, the old one still shows as if it were selected.

Any help/ideas would be much appreciated.

Thanks in advance,
pro-rsoft

bump

Seems like you would need to add a new event to the DirectScrolledList for this purpose. Shouldn’t be too hard, but you’ll need to be skilled with reading obtuse Python code. :slight_smile:

David

Yes, I’ve indeed really noticed the DirectGui python code is kind of messy, (and undocumented!).
But thanks for your answer. I’ll, uh, try something out.

ynjh_jo made something similar and posted his code. Did you take a look at it? (I didn’t search the forum for it, I could post it in this thread if you like).

Also, since we are talking about DirectButton, I’m starting to work with them and I’m wondering if anyone knows how to make a button press down (and execute) using a shortcut key?

Would I use something like setState() ?

Unfortunately the documentation for Directbutton is full of Methods that are undocumented.

C

Might be best just to listen for the key event and call the same function that your button is set to call when it is clicked.

David

Thanks,

Yeah I poked around the Button class and the best I could figure was to disable the button and then call the same function that the button would call. Ideally I would like the button to actually “click” down and run its own code instead of calling it twice in two different places, but I’ll survive… :slight_smile: