Where is the combobox object in interface builder? - ios

I just updated to Xcode 5.0.2 and in interface builder on the lower right corner where I can drag and drop objects I don't see combobox any more. I tried using the search field below and typed combobox, NSCombobox, but nothing.

Using a UIPickerView will probably get you far

It's easy to make a ComboBox lookalike. It consists of only three parts in InterfaceBuilder xib:
A Label for holding the selected choice. I've made it with a white background to look like an input field.
A graphic Button with an arrow
A ListView
The ListView is normally invisible (setHidden:TRUE) and is placed over other items in this xib.
A tap on the Button makes the ListView visible (setHidden:FALSE).
At selection, didSelectRowAtIndexPath writes the selected string to the label and set ListView hidden.

Combo boxes are available only for Mac projects, not iOS projects, so you're getting the expected behavior. If you create a Cocoa application project and type combo in the object library's search field, the combo box and combo box cell objects should appear in the object library.
I'm surprised you were able to access a combo box in earlier versions of Xcode. I don't remember combo boxes ever being available in iOS projects.

I also needed a HTML select-like control (single-selection dropdown list) without breaking the XCode legacy GUI interface across past and future iOS releases.
I ended up coding DownPicker, a lightweight control which does just that combining UITextField and UIPickerView. It can be used either as custom control (UIDownPicker) or also as control wrapper, upgrading any existing UITextField.
Here's how it looks like:
For more info and download you can check this brief tutorial or the GitHub project page (both made by me - the project is open-source).

Related

SendToBack TlistItemImage at design time or runtime in fireMonkey

In TlistView Dynamic appearance I added a few object appearanced to the item.
I have a TextObjectAppearence and an ImageObjectAppearence.
I want to set the image to be a background for the text meaning the text should be on top of the image.
I tried right-clicking on the image object and selecting SendToBack but it doesn't seem to work.
At run-time, there's also not any way to call ListItemImage.sendtoback etc.
what is the right way of doing it?
I've attached a screenshot of the two items overlapping...
The only way I found is to open fmx file in text mode and to move the various objects in the order needed (first is the deeper)

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.

Icon in header row for column setup

I would like to add an icon to the header of my data grid as it is done in Thunderbird.
There is an icon that is above the vertical scrollbar, no matter the position of the horizontal scrollbar. This icon allows the setup of the columns.
In Delphi there a lot of different grid components, that allow customizations and adding icons to there cells / header cells. But I could not find any component that has an area above the vertical scrollbar that is fixed, which when clicked allows some action. I could even use the VirtualTreeView component to emulate the grid, if it turns out to be easier to customize that component.
I am looking for some guidance on what need to be done to get that functionality.
Thanks,
Thomas
VirtualTreeView in Listbox mode would be nice, because of it's speed, great documentation and ease use in MVC-like patterns. Delphi tempts to store data in the visual components themselves, which letter causes troubles. While VTW allwos the same, it also allows to acutally separate data from GUI, and i like it.
But i am surprised by your claim "which when clicked allows some action.".
Even most basic components allow it:
http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Grids.TCustomGrid.OnFixedCellClick
So could you make more detaiils, why you cannot use standard components ? with screenshot and editors, how u want it rendered, where you want to click and what kind of action should happen ?

how to set the tabwidth of the listbox portion of a TComboBox in Delphi

You can easily achieve a multicolumn effect in a listbox by setting the TabWidth property of TListbox. For example, http://delphi.about.com/cs/adptips2000/a/bltip1200_3.htm
I need to do the same in the drop down list of a ComboBox, but comboboxes don't publish any TabWidth property.
Any ideas?
In a comment to this answer advising you to owner-draw the list box items you say:
I'm wondering why I must do that when the required functionality already exists on a listbox
A combo box is actually composed of three native child windows - the combo box itself, an embedded edit, and a list box. You can use the GetComboBoxInfo() function to fill a COMBOBOXINFO structure (i.e. a TComboBoxInfo record) with information about the control, and it will return the 3 HWND elements in it. With that you are able to alter the appearance and behaviour of the list box. In principle.
For the list box to use the tab stops it needs to have the LBS_USETABSTOPS style flag set. Unfortunately this can't be turned on later, the list box has to be created with it. So you could use the functionality only if you were able to turn the style flag on for the list box, which is created during the CreateWindowEx() call for the combo box. AFAICS this can only be done by hooking the CreateWindowEx() call itself, identifying the internal call that creates the list box, and altering the passed style. This means runtime modification of code, and not in your executable but in a Windows DLL.
Owner-drawing the list items looks like it would be much easier.
From what I know there is not so simple way as TabWidth here but you can override Paint method and draw it yourself. Looking at listbox and combobox sources may help.

Delphi control that could mimic "Add-ons|Extension list" of Firefox?

My aim is to update the look of the GUI in my app. Currently my GUI contains a lot of listboxes which are used to edit some objects in an old fashioned way, that is, user double-clicks an item and a dialog is shown to modify the corresponding object.
I think a good modern approach is how Firefox displays the extensions installed (a snapshot below).
My question is about how to build such a GUI in Delphi(win32) easily? Are there any components you use mimicing such behaviour or will I just need to code this from stratch using panels? (IMO a very cumbersome job I'd like to avoid - the selection logic, resizings, etc...)
You can do something similar (not exactly) with standard components; TDBCtrlGrid, TSpeedButton,...
alt text http://img8.imageshack.us/img8/9585/imagen29ox3.png
If you're using Delphi 2007 or Delphi 2009, you might be able to do something similar using TCategoryButtons (from the 'Additional' component palette page). Drop it on a form and right click to display the popup menu, and then click "Categories Editor...". Add a category with the resulting dialog, set it's caption, and optionally set up Items it contains. Not exactly the same, but it might do what you need.
You could also use a dialog with a TTreeView (if you have categories of objects) or TListView to emulate the Delphi 2007 Projects->Options dialog. Clicking an item in the TreeView or ListView displays the proper page of a TPageControl to configure the object.
I mostly agree with Lars, but I would use a frame for each item instead of a panel. That would separate into its own file, and you would get easy designtime support for it.
Using a TFrame for each list item and put them all Aligned Top on a TScrollBox might work. Also see TDBCtrlGrid which does something like that in combination with datasets.
It can be done with existing Delphi controls.
For instance in the TCustomListBox control you can create your own OnDrawItem event to draw your own list item. You also need to create your own OnMeasureItem to change the item height.
In some cases it is very limited, so if you want more freedom you will need to do it from scratch.

Resources