There are no XOJO examples and apparently nothing in the LR.
There is no discussion in the forum on them.
PopupArrow is missing an event apparently that would cause action, except for KeyDown. There is no MouseDown in either
There is also no way of knowing what happens when does a keyDown.
Enumerations
FacingDirections is available but…
Yes I can add my own events but I’d rather learn how it’s used.
Hi Arthur!
Both of these components have KeyUp and KeyDown events. If you want to perform an action on KeyUp, you must implement the KeyDown event and Return True. Not that you will need to set Allow Focus to True in order to use the keyboard events.
DisclosureTriangle has an Action event that is raised when the user clicks the control, while PopupArrow exposes the mouse events (MouseDown and MouseUp, Return True in MouseDown for MouseUp to be raised).
Typically, these are implemented so that either the FacingDirection or Value – depending on what functionality you’re looking for – is changed when an action occurs via one of the aforementioned Mouse of Keyboard events.
Example KeyUp for DisclosureTriangle:
if Asc( key ) = 32 then
if me.FacingDirection = DisclosureTriangle.FacingDirections.Left then
me.FacingDirection = DisclosureTriangle.FacingDirections.Right
else
me.FacingDirection = DisclosureTriangle.FacingDirections.Left
end if
me.Invalidate( False )
end if
Thanks. I understood the code. I really wanted to know how they are used.
I should add why I’m asking. I want to attach it to a listBox to make it function like a comboBox. I only need one line of it to be shown while indicating other lines are in the box.
ComboBox is like a PopupMenu excepted it have “like an EditField” in the first Row; you can type into that Row what you want or select from the other Rows (Predefined at design time or by code).
You set a DisclosureTriangle on top of the first row of the listbox. In the Action event, you adjust the size of the listbox to show or hide rows. I use it like this with a TextField, with a listbox on a floating window that I position just beneath the TextField for a dropdown effect. It’s a lot more work, but I think it gives a better user experience.
Yes, I know that reproduces a ComboBox, but it gives me a lot more control in code. There are things you can’t do with a combobox, much less a popupmenu, which is even more limited.
Sorry that I cannot remember the word. It’s when you place an object on top of another object and you get problems, like one doesn’t show. It something like merge. How do you prevent that?
I am assuming the triangle is not floating.
I get the part of the Action event.
I agree with you that it would provide a better experience.
I haven’t seen that problem. And it’s been so long since we implemented it that I don’t recall the issues we had to work around. I will say that when we use it in a listbox cell, we use a common DisclosureTriangle positioned outside the listbox and not visible. We position it when needed. So it does kind of float.
We create the triangles last, after all the other controls, so they stay “on top”. And we probably break Parenting, but I’d have to dig into that to be sure.