Why would a SharePoint lookup menu require a double-click to select an item? - sharepoint-2007

I have a SharePoint feature which programatically creates 3 lookups in a custom list, one from each of 3 different lists via extremely similar CAML markup.
The only differences in the CAML are the List, ID, Name, DisplayName and StaticName properties yet one of these lookups looks slightly different (has a slightly more "modern" drop-down arrow) than the other two and this same menu requires I double-click in order to select an item instead of single-clicking as I do with the other lookups.
Might anyone have seen this before and have an idea of what I might look into to make this lookup operate as a single-click menu?

The style of dropdown displayed is usually related to the number of items, although it also renders as a standard select element when viewed in firefox.
For any other field type it would make sense to create a custom field control, but due to code that expects things to be named "Lookup", lookup fields are next to impossible to extend.
The best way to customize a specific field is probably with javascript/jquery. When you click on the dropdown arrow, ShowDropdown (in core.js) is called. This creates a select element with options set from the pipe delimited list in the choices attribute of the textbox.
Add some code to the page so that on load EnsureSelect and FilterChoice or similar are called to create the select element. Set properties on the textbox and select elements so that the textbox as hidden and the select element is a visible dropdown. Have SetCtrlFromOpt called on change rather than on blur/double click so that the control that the server will read and save is properly updated.
The same approach could be used to keep the combo box but add a click event to set the value rather than requiring a double click.

How many items has the source list of every lookup field?
Lookup fields shows a "Combo" when the source list has 10 items (I'm not sure if 10 item is the exact limit). When the source list has more than 10 items the lookup field shows a "ListArea" control that works as you said.

I have exactly the same problem. One difference I have noticed is that the one listbox that requires a double-click is a lookup field, whereas the one that doesn't is a choice field with pre-populated choices. Don't know if that helps.

Related

Excel enter cell value from a list

I have a budget spreadsheet for simple money transactions. One of the columns is the transaction category (e.g. Grocery, Auto Supplies, Insurance, Entertainment, etc.)
Rather than spell out, let's say, Insurance, in a given cell, I would like a list of possible values to appear, so that I can select one of the values (e.g., Insurance) and have Excel put that value in the cell for me. That way I make sure that Insurance is spelled the same each time I use it.
Is there an easy way to set this up in my workbook, preferably without getting into VBA coding?
You can create a dropdown lists in Excel. What I found from this video:
"
Select the cells that you want to contain the lists. On the ribbon, click the DATA tab, and click Data Validation. In the dialog, set Allow to List. Click in Source. In this example, we are using a comma-delimited list. The text or numbers we type in the Source field are separated by commas. And click OK. The cells now have a drop-down list.
"

How can I auto-fill Edit fields by using different options of a drop-down list?

am using a VCL form in Delphi, where I have put about 10 edit boxes.
These Edit boxes contain values that are related to specific models of solar panels.
These values are needed in order to calculate the output power of a solar panel.
So far, I am able to type these values in every run with the command:
c0:= StrToFloat(Edit1.Text);
for c0 to c10. But, instead of asking the user to manually type these 10 values in each run, is there any way to let the user select one option (i.e. a model of a solar panel) of a drop down list and these values being filled automatically for them?
Does the combobox do such a thing and if yes, how exactly? I am sorry, I am a very new Delphi user. Any help much appreciated.
Set the combo box Style to csDropDownList.
Populate the combo box Items with appropriate values for the user to select.
Add an OnSelect event handler. This will fire whenever the user selects a new item in the combo box.
Implement the OnSelect event handler by populating the edit controls with appropriate values, based on the value of ItemIndex.
You will need to think a little about the UI. If the user changes the combo box selection, then the edit control values change. But can the user then modify the edit controls? Now the values in the edit controls no longer match the combo box. Is that what you want? I guess that the UI needs a little more polish.

Select fields from multiple records in DBgrid to input in checklistbox?

I created a simple DB with Database desktop (Name, Age, Mail, Place etc.).
One name can include more Places (for example Steve: London, Bukarest, Ukraine).
I want to choose from these places in a new checklistbox or similar component. Is there any way to add these items from the DBGRID into the checklistbox to choose from?
I could not find any tool in the Data controls palette where i can select more items.
dgMultiSelect in dbgrid-->Options allows users to select more than one row.
IIRC it returns bookmarks which are not the easiest thing to work with :(

Combo box that can open quickly with lots of items

I've got a custom combo box descended from DevExpress's TdxfCustomComboBox. It works really well in most cases... and then I got a report from a client that when they try to open it it takes 3 seconds for the popup to appear. After a bit of investigation, I found out that that's because their database has about 12000 items that it's trying to populate, and it recreates the popup window and populates it each time.
This means that StdCtrls.TListBoxStrings.Add, which contains this line, gets called 12000+ times, once for each string.
SendMessage(ListBox.Handle, LB_ADDSTRING, 0, Longint(PChar(S)));
Processing this line requires several trips through multiple layers of message handlers and really bogs things down. I find this kind of silly since only about a dozen or so items are actually displayed in the popup window at once anyway. Does anyone know of a combo box control that doesn't require this sort of pre-loading and can scale?
EDIT: Unfortunately, making it not load 12,000 items is not an option here. The number of items in the combo box is based on the number of items in the database, and they all have to be available. Neither is making it into something other than a combo box. Not enough screen real estate for that.
the best solution that I can think of is using a TButtonEdit and when you click on the button a TVirtualStringTree(which is lightning fast) will popup containing the items, whenever the user clicks on a item the popup will close and the selected item will be displayed in the TButtonEdit's text property -- this can be achieved in a matter of minutes(5-10)
Another possibility: can you create the combo box at start-up and keep it around, reparenting it when you need it on this form?
Failing that, could you load the strings into another string list and .Assign to the combo box as necessary? (I'm not familiar with TListBoxStrings.)
Some options.
1./ Do you really have to populate with 12,000 items? can you use some filtering scheme and only return a subset of that data?
2./ Do you have to use a Combo box? do you have the screen real estate to use a virtual list view instead? (handle the storage and paging yourself)
3./ Create your own Virtual combo box...model the virtualization techniques on the virtual list view.
4./ Cheat...rather than a combo box, use a edit box with a "browse" button that opens a list that you can fill dynamically.
As far as I know there is no mode that lets you do this already with the dev express (or native) combo boxes.
ComboBoxes and ListViews experience performance degradation on an exponential curve, becoming really bad with thousands of items. Use Virtual lists whenever possible, if you have more than a few thousand.
Maybe you can use a LookupComboBox (also from DevExpress). Here you can load the data into a single DataSet where the Comboboxs are refering to it.
Honestly, three seconds sounds pretty good for loading 12000 records into a control like that.
Does the drop-down have to descend from TdxfCustomComboBox? I think you'd be better off rolling your own combo-box-like control here that would page through an associated dataset as required rather than pre-loading all the strings. Ideally you could build filtering into it too.
This is just a foolish design! A better option is to add a button which the user can click on. When he clicks on it, a new form opens with a connection to the options table and it will display all the options in the way you prefer. The user then has to select one, could use pageUp/PageDown and all kinds of filters because -of course- you'd be using a DBGrid to display the options and then the user clicks the "Select" button which will return the selected option back.A new form would provide all the space you would need!
From a design viewpoint, anyone considering a dropdown list with 12.000 options will be considered a fool by the users of this software! It would definitely make it very unpopular, no matter how fast you make it! Why, you say? Because users can't find what they need in a list that big without additional search options!

Benefit of using DBComboBox over CombBox?

So I'm messing around with a new project in Delphi 2009 and the default components that can be dropped onto a form for accessing data consist of a SQLConnection, DataSource and SQLQuery. If I add a simple select to the query component, say:
select name from customers
and then drop a DBComboBox on the form and link it up with the DataSource I get a single record in the combo box. After using Google for half and hour to figure out what I was doing wrong it looks like you have to manually add some code to your project which loops through the dataset and adds all the records to the drop down box. Something like:
while not SQLQuery.eof do
begin
DBComboBox.items.add(SQLQuery.fieldbyname('name').asstring);
SQLQuery.next;
end;
And that actually sort of works, but then you get a list in the drop down which you can't actually select anything from. Regardless of the result though I'm wondering why would you even use a DBComboBox if you have to manually add the result of your query to it? Seems to me that if it doesn't automatically populate the db combo box with the result of the query then we might as well be using a non-data-aware component like tcombobox.
I guess what I'm asking is why does it work this way? Isn't the purpose of data aware drag-and-drop controls to minimize the amount of actual written code and speed development? Is there a method that I'm missing that is supposed to make this easier?
A TDBComboBox doesn't get its list of values from the database; it gets its current value from the database. Link it to a field in your dataset, and when you change the active record, the combo box's current value will change. Change the combo box's current value, and the corresponding field's value will change.
If you want to get the list of values from the database as well, then use a TDBLookupComboBox.
This is all covered in the help:
Using TDBListBox and TDBComboBox
Displaying and Editing Data in Lookup List and Combo Boxes
Defining a Lookup List Column
I think you want the TDBLookupComboBox because that allows you to lookup from a list of items where the list comes from a dataset.
In the TDBComboBox, the list is just a TStrings manually filled with data.
--jeroen
DbCombox is a dbaware version of the standard combobox component.

Resources