LibreOffice Base - How to populate listbox values(not sql/table) from code? - libreoffice-base

I am toying with Base but am stuck on how to set the ListSource of a ListBox with an array of values rather than data from a query.
Any help would be appreciated.

To add entries manually, edit the form and create a new list box. Right-click on the control and choose Control. At General tab of control properties window, edit List entries property: add the first item, press Shift+Enter, and then add another item.
From How to Programmatically add or remove items in ListBox FORM control, #Lyrl writes:
The listbox array content is clunky; it's actually easier to work with if the form is connected to a Base file and the listbox content is determined by an SQL string.
That page also shows macro code to populate the list with an array of values.
oListBox.StringItemList() = Array("One", "Two", "Three")

Related

Custom drop-down as an item in a kendo tree

I am trying to create an item that is a button "show more" and when you press on it you can show a kind of context menu / drop down that all of the items in that drop down are with checkboxes and there is a search component in it too, so you can search some items in the dropdown by their name. For example: (instead of "c++,c#,Object c" it's should show "show more", i.e. static text)
I tried to use kendoContextMenu. But I don't know if it's could work because the problem with context menu is that when I will click on a checkbox the menu will close. Please advise me of a way to do that or if you have an example of code. Thanks!
The MultiSelect component might be a good starting point
https://docs.telerik.com/kendo-ui/api/javascript/ui/multiselect.
My understanding is that MultiSelect does not have a "select more than one at a time in dropdown" feature.
You might consider using a pop up window and within that implement your own custom ui that features everything you want
search term box
scrolling list of selected and selectable items
accept or cancel changes in selection
Regarding your dojo that extends drop down list, I can't code the extension for you. However, changing the dataSource assignment to a setDataSource call will populate the extension component according to the template.
// kendo.ui.DropDownList.fn.dataSource = options.testItemSource;
me.setDataSource(options.testItemSource);

Win32 ComboBox: Programmatically select (highlight) string from the list, without update the edit control

My goal is to Programmatically select items from the List of the combo box, but without updating the edit control. The same can be achieved with the mouse. E.g. when you drop down and hover an item from the list, that item is highlited. And that is all. If you want to select in it the combo box (e.g. move it to the edit control) - you must click on the LisBox.
I tried with CB_SELECTSTRING. But it automatically updates the ComboBox edit control with the selected text which is not what I want. I want to do this using raw Win32 or VB6
Thanks
There is a big difference between highlighting an item in the drop-down list and actually selecting an item to make it active. CB_SELECTSTRING selects an item, as its name implies. But there is no official ComboBox API to highlight an item, though.
However, you can display the drop-down list manually (CB_SHOWDROPDOWN), and either:
move the mouse over the desired item so the list can perform hot-tracking logic.
manipulate the list directly. Use CB_GETCOMBOBOXINFO or GetComboBoxInfo() to get the list's HWND, and then send LB_SETCURSEL to it.

ComboBox in windows forms Datagridview control

I have a datagridview on a windows form. It has clolumn [EmployeeNumber, EmployeeName and EmployeeDepartment].
I want to be able to edit values directly in the grid but i want EmployeeDepartment to be a combobox column, such that on cell edit, a combobox shows up with available options for the employee department. Has any one been able to implement such functionality?
The DataGridView actually has a DataGridViewComboBoxColumn. If you go to the column designer, and add a new column you'll notice you can select one of a few types. It behaves exactly as you have described - on edit, it appears. The DataGridView uses things called editing controls, and has various events for swapping the control into the cell on edit.
Either way, if all you want is a drop-down, that's available out of the box.
To populate the combo box with items, in the column editor you will notice that it has an Items property for manually setting items, or you can use the data binding properties: DataSource, DisplayMember, ValueMember. Data-binding has issues when an expected value is not in the items collection, you will get a lot of cell errors; but they can be avoided.
Some helpful links:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxcolumn.aspx
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/e8e2d9eb-fe39-42ab-9a18-2194dac54675/

InfoPath 2007 - Populate drop-down list on-the-fly

I'm working on an InfoPath 2007 form. I have two drop-down lists and i need the second to be populated with items bases on the value chosen in the first list. I use c# to populate the drop-dpwn lists from external sources. I've tried to use the OnChange event to make all this, but the second list is still empty.
If anyone knows, please tell me.
You can filter the entries for the second drop-down list based on your first list (but only if the entries are based on a data source, not manually entered).
Bring up the properties window for
your second drop-down list.
Select your data source.
Click on the button to the right of the Entries text box.
Select the repeating node you wish to use for the basis of your list entry.
Click the Filter Data button. From here you can enter a filter to limit the entries displayed based on the value of your first drop-down list.
Your question was a bit ambiguous. You may be trying to populate a secondary data source based off of your first drop-down list. This should work fine with an OnChange event. Can you post the code you are using to do this?
Some additional tips that may help:
The change event will not fire until focus moves off of the list box. So, for the second drop down to populate, you will need to set the first drop-down then hit tab or click elsewhere in the form.
I don't know the size or nature of the data source you are using for the second drop-down list, but you may consider downloading the entire data source and filter it using the method I described above. This may be a better solution as you won't need to make a database query between entering the first list box and the second one.

How to bind test data to a SketchFlow ComboBox?

I haven't been able to successfully bind some test data to a SketchFlow ComboBox. I added a sample data source and created a collection with some basic string values. There are a number of tutorials on how to bind to a ListBox in SketchFlow and that works fine, just not finding anything for a ComboBox.
One thing that caught me out a few times is that you need to have your data in "list mode" before you drag it on to the control (combo box or list box).
It seems to work as I expected, so perhaps I'm not understanding your issue correctly, but I'll give it a shot! I created a sample DataSource with a couple of strings in it, added a ComboBox to the layout root and then just dragged the Collection from the DataSource and dropped it on the ComboBox.
Keep in mind that if you drag the DataSource itself, you'll only be setting the DataContext property of the ComboBox and that's not enough to get your items to display. You also need the ItemsSource bound to the Collection of the DataSource and an ItemTemplate or a DisplayMemberPath to tell the ComboBox how to display your items.
Additionally, if you use the drag and drop method of binding, it will use the ItemTemplate approach for you, which may or may not be what you want as it will generally create a StackPanel and display all fields from the row in your Collection per item in the ComboBox. You can remove the ItemTemplate and set DisplayMemberPath to whichever field you wish to have displayed from your data source's collection.

Resources