MapInfo Pro Developers User Group

Welcome to the MapInfo Pro Developers community!Β  We areΒ a group dedicated to the discussion and understanding of MapBasic and .Net MapInfoPro AddIn development.Β Bring your questions and ideas here. This group includes several members of the Pro development team from around the world.

Please feel free to start a discussion in the discussion tab or join in a conversation.

Product InformationΒ  Ideas PortalΒ  MapInfo Community Downloads

Discussions

Members

Resources

Events

Β View Only
  • 1.  Pre selecting items in a multi-list box

    Posted 02-07-2018 22:21

    Hi,

    After all this time I now have a requirement to pre-select items in a multi-list box - i.e set the initial selected items. I thought I could just loop though the number of items and set the value so if I had three items then I would do:-

    for n = 1 to 3

        Alter control X value n

    next

    This does not work - it is just the last item that is selected.

    Does anyone know how to do this?

    Many thanks



  • 2.  RE: Pre selecting items in a multi-list box

    Posted 02-09-2018 11:07

    Martin,

    We do a similar thing and it seems to work ok.

    The dialog handler calls a procedure that loops though an array of items pre selected and sets the value as you have done.

    David

     

     

     



  • 3.  RE: Pre selecting items in a multi-list box

    Posted 02-11-2018 16:17

    Hi Martin,

    I am uncertain how to do this officially, but typically I'd use the LB_SETSEL win32 message if you're using a list box: https://msdn.microsoft.com/en-gb/library/ms909693.aspx . If you're using a list view I'd use the LVM_SETITEMSTATE  message instead: https://msdn.microsoft.com/en-us/library/ms930194.aspx



  • 4.  RE: Pre selecting items in a multi-list box

    Posted 02-12-2018 04:01

    Thanks for the replies - I will have another go!?



  • 5.  RE: Pre selecting items in a multi-list box

    Employee
    Posted 02-15-2018 06:13

    Let us know how you get along, Martin.

    The trick is to do the preselecting in the handler of the dialog.

    You can find a sample of how to do this here: http://www.twiav.nl/php/mbsampleM.php#mlbx



  • 6.  RE: Pre selecting items in a multi-list box

    Posted 02-15-2018 06:25

    Hi everyone - sorry I meant to update this. I did get it working and I was on the right path initially. My schoolboy error.. this was done as a part of a dialog rebuild and I had it set as a listbox!

     

    oops 😳 ?