Disable only one item in a wxpython.listbox - listbox

I am trying to disable only one item in a listbox with wxpython. I already searched in the Internet for a way to do this, but I found nothing...
I hope you can give me a hint!

I don't think there's a direct way to do this, so the only way would be to do it by hand: catch click events, use the HitTest to find which item was selected, and then ignore the event if it's the "deactivated" item. (Tree Controls have the EVT_TREE_SEL_CHANGING which would be useful here, but there's no analog for a ListBox afaik.)

You will need to bind to wx.EVT_LISTBOX and check if the selection is in your "deactivated" list. If so, set the selection to a different item in the control.

Related

Is there a specific component that works with Swift 3 to represent a "ComboBox / Spinner"?

I'm starting to work with Swift 3 and I'm having difficult to find a "easy" solution to create a "ComboBox/Spinner".
I saw some alternatives like using PickerView and Collapse TableView, but It seems to be a solutions to make these components to looks like a ComboBox, It's a adaptation, but It's not a "real comboBox".
I would like to know If there's a component that works with Swift 3 that really represents a ComboBox/Spinner.
Thank you.
As Eric says in his comment, controls aren't defined in Swift, they're defined in the OS frameworks.
iOS does not have a combo box. That's a Windows thing. The standard system component for picking items from a list is a UIPickerView. I've implemented a custom control that's rather like a combox box before, and you may be able to find a 3rd party control that does what you want.
Don't know if this is the kind of combobox system you are looking for:
https://gyazo.com/ce6388cf29f9c33f67df2b6a54c95768
If so you could create a custom button which looks like a combobox. Then if not selected you have an image of a not selected combobox and when someone selects the button change it to the image of a selected combobox.
You create an array, add the amount of custom buttons to the array as you want, you give each button the same selector. Then when someone selects an item, deselect another button if there is one selected and select the button the user did press.
I hope this helps you.

How to SelectAll only visible VirtualTreeView items?

I have hidden some VirtualTreeView items using VirtualTree.IsVisible[n] := false;.
In one function I iterate through all selected items using VirtualTree.GetNextSelected(n); method. But there is a problem - if I manually select a few items for example using CTRL-click or SHIFT, the items which get looped are the ones selected.
But if I press CTRL + A to select all then GetNextSelected gives me all nodes, including those which are hidden.
I did a workaround by checking if (VirtualTree.IsVisible[n]) ... to avoid looping through all items and fetch only visible ones, but this seems like a bug or maybe there is an option which controls how CTRL + A will behave - will it select only visible nodes or all of them?
So is this a bug or maybe I missed some selection option (I examined them all) or am I supposed to use some other method for looping only through visible nodes?
As it appears by David Heffernan and Joachim Marder, it is a design choice and not a bug. For this reason, one needs to introduce a workaround when looping through items using GetNextSelected by checking if (VirtualTree.IsVisible[n]) ... to loop only through visible items.

In TButtonGroup.ButtonOptions what does adding gboGroupStyle do?

The help indicates that adding gboGroupStyle to the ButtonOptions on a TButtonGroup:
"Specifies that the buttons should inherit the group style that is set on the container."
But this explanation still leaves me lost - any ideas?
The gboGroupStyle option in the TButtonGroup.ButtonOptions property has nothing to do with GroupIndex as it's known e.g. from TSpeedButton.
Setting of the gboGroupStyle option to True allows you to:
set the TButtonGroup.ItemIndex property, so you can predefine which button will be focused as default, nothing cool
click the buttons with ENTER or SPACE keys, what will fire the TGrpButtonItem.OnClick event of the button item (if assigned), perform its action, or fire the TButtonGroup.OnButtonClicked event
I agree the name of this is quite misleading, but that's what I found in the source code from Delphi-XE2.
gboGroupStyle makes the TButtonGroup act as a group - that means, one and only one button is selected at a given time. It is similar to grouping several TSpeedButtons with the GroupIndex, where only one button inside that group is selected at any time. The currently selected button can be read and written via the ItemIndex property of TButtonGroup. To visualize the selected button one can implement an OnBeforeDrawButton or OnDrawButton handler.
From my experimentation it looks like if gboGroupStyle is used then the ItemIndex property can be set to something other than -1, so that the TButtonGroup remembers the last button that was pressed.

CustomListField using VerticalFieldManager

My requirement is to create a customlistfieldmanager by extending verticalfeildmanager, I am not able to figureout how to do this?
I am not able to understand why my manager has asked me to use this method.
any sort of help is welcomed!
It's possible that he's asked you to do this because of the most limiting factor of a normal ListField: you're stuck with uniform heights.
What you'll need to do is have a parent container that is a scrolling VerticalFieldManager. Inside of that will be custom Managers that can handle the same functionality as the row would in a ListField. It needs to accept focus and fire off an event when it's clicked. You'll also need to keep track of what item number it is, so that when it's clicked it knows how to notify any listeners about which one was selected. Also, the parent VFM will need to be able to keep track of which "row" is currently selected -- in this case which one has focus.
Edit for comment
If you add a NullField into each of them it can accept focus but won't actually show up as anything. To determine if a "row" (the Manager) has focus, you can use getFieldWithFocus() on that Manager and the one that doesn't return null is the row that is selected. You will probably also have to do some custom painting to draw the selection highlight
You will have to dynamically add and remove custom elements from your CustomListFieldManager as you add and remove elements from a VerticalFieldManager.
Your manager asked that because he want you to learn how to handle custom object to understand how to use managers.

Delphi - ListView Question

Is there a ListView (ListBox) or similar component that allows me to easily drop another component in a specific column. (Multiple columns)? Like a checkbox, button or drop down list or all the above. (It would be nice to be able to sort via the header also)
If not does anyone know of a resource on how to custom draw something like this?
Thanks
-Brad
Check out VirtualTreeView at www.soft-gems.net
It does virtually everything :-)

Resources