PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Ian Bayly on October 15, 2008, 12:42:18 AM

Title: List Box and %LBS_MULTIPLESEL - Change at runtime (Beginner?)
Post by: Ian Bayly on October 15, 2008, 12:42:18 AM
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


Title: Re: List Box and %LBS_MULTIPLESEL - Change at runtime (Beginner?)
Post by: TechSupport on October 15, 2008, 08:47:45 AM
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.

Title: Re: List Box and %LBS_MULTIPLESEL - Change at runtime (Beginner?)
Post by: Ian Bayly on October 15, 2008, 04:38:37 PM
Thanks for your advice Paul.

Regards

Ian B