Combobox

Q:

In VFP the combo box has style property. It could be Dropdown List or Dropdown combo.
When set to dropdown list the user can only select from a given list.
When set to dropdown combo the user can either select from list or enter a new value directly in the combo.
How can I achieve the dropdown combo effect in lianja form section.

A:

A ComboBox cannot be edited.

Look at “autosuggestions” to achieve that functionality.

Name:  Screen Shot 2017-05-08 at 8.58.18 AM.jpg Views: 37 Size:  45.9 KB


 

Combobox

If you require two columns in the combobox, I believe you could do the following:
Lianja.Get("page1.section3.cboName").columncount = 2
In the choices attribute, you could use:
+select customers.companyname,customers.city from customers
(Although the blank entry may no longer be available)

Q:
in which event additems method can be used to load initial value in the list or combo item when the app starts.
A:
Use the ‘ready’ event. During development in the Lianja App Builder, the ‘ready’ event is called when the App is loaded, so just save and reload the App to force the ‘ready’ event to be called and see your new code.

Q:
In a canvas section, I can set the Data size to small, medium, large, largest and auto.
I would like to use that in a custom VFP section.
I have tried namespace.combobox.datasize=”largest”.
A:
you need to set the fontsize attribute.
(had a typo in my stylesheet. font-size was there)

Q:
What custom delegate is typically used to start an event with one of the choices?
A:
I think what you are asking is… What delegate is used to handle a change of selected value in a combo box. The “change” delegate is called if you change a combo box interactively.

A quick Tutorial on style a combobox

Combobox

Q:
How do I create a combo box for the user to select from a few predefined selections in a form
A:
If you specify selections in the Choices attribute of a field in a Form Section, it will automatically be displayed as a combobox.


Q:
Combobox in grid
A:
This is not currently supported for numeric columns in Grids. If you datamap it to character you should be able to do it:
Choices: 1,2,3,4
Get data mapping: str(name-of-field,1,0)
Set data mapping: val(“{}”)


Q:
On my page I have a combobox (ankrtpar) that only should be enabled if a property (ankrtkey) of my object is filled.
So I entered in the combobox attribut dialog: not empty(loObj.ankrtkey)
That had no effect. So I deleted it and opend the code and filled in:
proc page1_section2_ankrtpar_enabledwhen()
set step on
THIS.Enabled = not empty(loObj.ankrtkey)
endproc
A:
The enabledwhen() event should be triggered when you go into Runtime View.
The ‘Enabled When’ is expecting an inline command or the name of the delegate to call – it does not evaluate a condition. Try putting your condition in the actual method and set Lianja.get(“ankrtpar”).enabled to .T. or .F. .


Q:
After I add a new entry on page1, if I select page2, the combobox does not get updated with the newly added values from page1.
A:
Lianja.get(“page2.section1.mycombo”).choicelist = Lianja.get(“page2.section1.mycombo”).choicelist
in the section.activate.
The activate, visiblewhen, enabledwhen and mousedown events for the combobox itself are also called before the list is populated.


Q:
We can change the choicelist ie Lianja.get(“page1.section1.field1”).choicelist = “East,West,North,South” in code (and can test it in code to ensure it has changed ok) but how do we refresh the combo box contents?
We have tried :
Field.Refresh()
Section.Refresh()
Page.refresh()
but the only time it seems to take effect is change page & then back to the original page.
We didn’t understand what you meant when you wrote
“You can change the selections in the “dataChanged” delegate if you need to.” We are not changing records, rather reacting to a selection in another combo box which calls our function().
We are trying to make these changes from code as the conditions are fairly complicated.
A:
Just do it from the console and the values should change in the combo. If that works as expected the just change it in the “Change” delegate for another combo box.
In your case you are always in edit mode so i’m not sure if that is affecting it.
That being the case switch in and out of edit mode should do the trick.