If you tried this stuff from the example at www.byerley.net/KT_ListBox.zip and
it didn't work, it's a snafu on my part in the readme and the example data. If
you will just rename the myFile.txt file to TestData.txt, it will work as
advertised. As a further note, when you populate a variable listbox from an
expression or lookup, the multi-select will fail, but if you populate it by
Adding Items by Cursor or by Load_From_File, it will work OK (be certain there
is a variable assigned to the ListBox though)
> Using the New DLCall Function to call the Win API SendMessage Function we can
> Select and DeSelect a ListBox's items in a few lines of code without
> iterating through the entire list. Here's How:
>
> First, put the following Declaration where it will be called ONLY ONCE during
> a given RBase User Session, likely in a StartUp File of some kind. (Yes the
> Pluses are line continuation so the news reader wouldn't wrap it)
>
> -- Declaration of SendMessage:
>
> StdCall function 'SendMessageA' +
> alias 'SendMessage' +
> (Integer, Integer, Integer, Integer) : Integer
>
>
>
> Then on a form put a ListBox of some kind although I only tested it with a
> variable User Defined ListBox.
> assign it a Component ID (I used LBList )
>
> in the OnAfterStart EEP , Set the ListBox to MultiSelect:
>
> PROPERTY lblist multiselect 'true'
>
> Put a couple of buttons on the form, One to Select All and one To DeSelect
> All
>
> The Code for Select ALL:
>
> --Begin
>
> SET VAR vhnd TEXT = NULL
> GETPROPERTY lblist handle vhnd
> SET VAR vhwnd INTEGER = (INT(.vhnd))
> SET VAR vret INTEGER = NULL
> SET VAR lb_setsel INTEGER = 389
>
> SET VAR vlparam INTEGER = -1
> --SET VAR vbool INTEGER = 0 -- false removes Selected
> SET VAR vbool INTEGER = 1 -- true Sets Selected
> SET VAR vret = +
> (dlcall('User32', 'SendMessageA' , vlparam, vbool, lb_setsel, vhwnd))
>
> RETURN
>
> --End
>
> The Code for DeSelect ALL:
>
> --Begin
>
> SET VAR vhnd TEXT = NULL
> GETPROPERTY lblist handle vhnd
> SET VAR vhwnd INTEGER = (INT(.vhnd))
> SET VAR vret INTEGER = NULL
> SET VAR lb_setsel INTEGER = 389
>
> SET VAR vlparam INTEGER = -1
> SET VAR vbool INTEGER = 0 -- false Removes Selected
> --set var vBool integer = 1 -- true Sets Selected
> SET VAR vret = +
> (dlcall('User32', 'SendMessageA' , vlparam, vbool, lb_setsel, vhwnd))
>
> RETURN
>
> --End
>
> That's All there is to it. If you want to download a fully functioning demo,
> here is the link (Just remember to execute the delcaration of the SendMessage
> Function prior to running the form)
>
> www.byerley.net/KT_ListBox.zip
>
>
>
>
>
>
> Mike Byerley
>
> "We Cannot Approach or Discuss 'YES', Until we
> Have A Complete And Thorough Understanding Of 'NO'"
>
>