Control In Listbox

  1. 2 weeks ago

    I am probably getting confused with another language but thought there was a way to get other controls to sit inside a cell in a listbox? Did I imagine that?!

    I want the last cell in each row to have a delete button instead of text saying delete if that makes sense?

    Theres no way to embed a control in a desktop listbox
    At best you could do something like Alex Restrepo's old code which did custom cells
    It works pretty well - but its still not embedding an actual custom control in a listbox cell

  2. Emile S

    Jan 13 Europe (France, Strasbourg)

    Add a menuItem (Delete) with a Keyboard shortcut, Add a Menu Handler and Populate the Menu Handler with code, then the user is able to select/delete each, any Row at will.

  3. @Emile S Add a menuItem (Delete) with a Keyboard shortcut, Add a Menu Handler and Populate the Menu Handler with code, then the user is able to select/delete each, any Row at will.

    Thanks Emile but I'm not struggling to find an alternative way, I already have a way to do it, I just wanted to put a button in the listbox and there have been other times I've wanted to put controls in a listbox too.

    I guess it just can't be done.

  4. Emile S

    Jan 13 Europe (France, Strasbourg)
    Edited 2 weeks ago

    No, it can be done, excepted I’ve done the way I wrote above. *

    Your project, your will.

    Look there:

    http://docs.xojo.com/ListBox.ColumnTypeAt

    and follow your way (make more search to find what you want).

    * The problem I have with what you want to implement is the empty row(s) here and there. But as I wrote earlier: your software.

    Edit II:
    http://docs.xojo.com/ListBox.CellTypes

    Now, you can eventually add an image of a button and use that as a Delete button (with code). But once more, I may be wrong (or not what you really want).

  5. @Emile S No, it can be done, excepted I’ve done the way I wrote above. *

    Your project, your will.

    Look there:

    http://docs.xojo.com/ListBox.ColumnTypeAt

    and follow your way (make more search to find what you want).

    * The problem I have with what you want to implement is the empty row(s) here and there. But as I wrote earlier: your software.

    Edit II:
    http://docs.xojo.com/ListBox.CellTypes

    Now, you can eventually add an image of a button and use that as a Delete button (with code). But once more, I may be wrong (or not what you really want).

    Hi, thanks again for that but my question was can you use other standard controls in a listbox. I think I was getting confused with a language I used on Windows a few years back. Thanks again.

  6. Emile S

    Jan 13 Europe (France, Strasbourg)
    Edited 2 weeks ago

    The only one provided is the CheckBox. Read the second link (enum).

    And to give you a strick answer: no.

    Sorry, stupid question: have-you tried to drop the control you- want to use on a ListBox ?

  7. @Emile S The only one provided is the CheckBox. Read the second link (enum).

    And to give you a strick answer: no.

    Yes, I use the checkbox often. Thanks, thought so. Shame.

  8. Sam R

    Jan 13 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    Fake it:
    use pushButton.drawInto into a picture.graphics;
    draw picture in Listbox.cellTextPaint event;

    Extra bonus points for getting a pixel perfect image using window.bitmapForCaching and swapping it when the window changes screens.

    p.s. pushButton.drawInto directly into listbox.cellTextPaint seems to crash my apps, using a picture is more trouble, but appears more reliable.

  9. Phillip S

    Jan 13 Pre-Release Testers

    p.s. pushButton.drawInto directly into listbox.cellTextPaint seems to crash my apps, using a picture is more trouble, but appears more reliable.

    I had the same problem, so its not you. DrawInto directly in CellTextPaint always crashes, so use a picture instead.

  10. Another alternative is to roll your own list box using a container control for the list box and one (or more) container controls as your rows.

    A quick example here:

    https://storage.googleapis.com/charlierobin-1245.appspot.com/downloads/listbox_with_container_control_rows.zip

    (Very rough and ready, just to show the general principle of the thing. I have no idea how this looks or behaves on Windows or Linux.)

    Of course, with container controls as the basis of a row, you can then have whatever you want on each row of your list.

  11. Brock N

    Jan 13 Pre-Release Testers, Xojo Pro

    You might be interested in this article

    https://forum.xojo.com/46100-what-can-i-embed-within-a-weblistbox

  12. @Brock N You might be interested in this article

    https://forum.xojo.com/46100-what-can-i-embed-within-a-weblistbox

    Thanks Brock but I'm talking Desktop not Web.

  13. Norman P

    Jan 15 Pre-Release Testers, Xojo Pro Answer outside

    Theres no way to embed a control in a desktop listbox
    At best you could do something like Alex Restrepo's old code which did custom cells
    It works pretty well - but its still not embedding an actual custom control in a listbox cell

  14. @Norman P Theres no way to embed a control in a desktop listbox
    At best you could do something like Alex Restrepo's old code which did custom cells
    It works pretty well - but its still not embedding an actual custom control in a listbox cell

    Thanks Norman.

    I've settled for making the last column a smaller font size with the text in bold, it stands out enough to be obvious to the end user. Can't quite see why Xojo would add a checkbox and not a button as well, I would imagine it would be a quite requested feature.

  15. Emile S

    Jan 15 Europe (France, Strasbourg)

    @Rod P smaller font size with the text in bold

    You can draw an image (small) instead, it will be more obvious.

    @Emile S Now, you can eventually add an image of a button and use that as a Delete button (with code).

    ;)

or Sign Up to reply!