List Box and %LBS_MULTIPLESEL - Change at runtime (Beginner?)

Started by Ian Bayly, October 15, 2008, 12:42:18 AM

Previous topic - Next topic

Ian Bayly

I need to toggle a windows style on a listbox between Single select Multiple select using Option buttons.

I have the ob working because I populate the Listbox from different MS Access tables, depending on the ob.

I've researched to the extent that I think need to use Control Send as there is not a FireFly FF Command.
I suspect I need to provide a unique id for the LB control.  I don't see where I can do this unless I build the ListBox at runtime.
OR maybe it can't be done at runtime.

Any help greatly appreciated.

TIA

Ian B



TechSupport

Hi Ian,

I am pretty sure that Windows will not allow you to dynamically change that style at run time. Sometimes you can toggle styles at run time using SetWindowLong and SetWindowLong but in this case I don't think that you can.

As easy solution may be to create two ListBoxes at design time. One with SingleSel and one with Multiple Sel and toggle the visibility of each depending on the needs that you have at runtime.

I would create a global variable that tracks which ListBox that you want visible and then call a routine that shows/hides the two ListBoxes as well as move them into position (I would use the SetWindowPos api for this).

BTW, to send messages to a control you use the api function "SendMessage". PB's CONTROL SEND is just a wrapper around the "SendMessage" api.


Ian Bayly