Results 1 to 8 of 8

Thread: [Answers] Combobox

  1. #1
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135

    [Answers] 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.



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    Last edited by josipradnik; 2016-03-02 at 04:13.

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    If you require two columns in the combobox, I believe you could do the following:
    Code:
    Lianja.Get("page1.section3.cboName").columncount = 2
    In the choices attribute, you could use:
    Code:
    +select customers.companyname,customers.city from customers
    (Although the blank entry may no longer be available)



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    Last edited by josipradnik; 2016-03-02 at 04:08.

  3. #3
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    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
    HerbTube: comboboxCss - https://youtu.be/VuH2ZA3DZDI



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...p?2717-Answers

  4. #4
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    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.






    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352

    These answers are also systematized on the site "Lianja developer": https://lianjadeveloper.wordpress.co...gory/combobox/

  5. #5
    Junior Member
    Join Date
    Oct 2018
    Posts
    2
    Question: How to adjust the number of displayed items in a combobox ?

  6. #6
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,840
    Hi Jealac,

    Please see https://www.lianja.com/doc/index.php/Choices.

    Regards,

    Yvonne

  7. #7
    Junior Member
    Join Date
    Oct 2018
    Posts
    2
    Hello,

    but is it possible to have more than 10 rows displayed at a time ?

  8. #8
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,840
    Hi Jealac,

    No, currently the maximum displayed items in desktop Apps is 10.

    Regards,

    Yvonne

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us