Multiplesel listview

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Is there any way to have a multiple selection listview?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.

as far as I know planned for release 3.20

Tranquilizer/ Secretly!
Registred PureBasic User
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Any workarounds until we wait for the next release?

i tried changing the style with api calls but it does not work:

hlist=ListViewGadget(1, 10, 10, 100, 100)
oldstyle=getwindowlong_(hlist,#GWL_STYLE)
SetWindowlong_(hlist,#GWL_STYLE,oldstyle Or #LBS_MULTIPLESEL)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

You need a SendMessage_() to the ListView.

Look for LB**** constants in the MS Platform SDK.


(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

wich message do i have to send?

with the code i posted the listbox does not appear in the parent window, there are a lot of listbox messages:

http://msdn.microsoft.com/library/en-us ... e#messages

but if the listbox is not there..., has this been done before?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Sorry, Justin - my fault.

Your error: "oldstyle Or #LBS_MULTIPLESEL"

"OR" is logical "OR" and gives back 0 or 1.
What you need here is a bitwise "OR", so
you have to use "|" for "OR".
AND, OR,.. = LOGICAL (return 0 or 1)
|, &,... = BITWISE

Complete example:

Code: Select all

OpenWindow(0,10,10,400,400,#PB_Window_SystemMenu,"ListBox")
CreateGadgetList(WindowID())
hlist=ListViewGadget(1, 10, 10, 380, 380)


oldstyle=getwindowlong_(hlist,#GWL_STYLE)
SetWindowlong_(hlist,#GWL_STYLE,oldstyle | #LBS_EXTENDEDSEL );| #LBS_MULTIPLESEL)


For a = 1 To 100
    AddGadgetItem(1,-1,"TEST "+Str(a))
Next a


Repeat
Until WaitWindowEvent() = #PB_EventCloseWindow
Start this little code and select the items.
Hold down SHIFT or CTRL (STRG) for selecting.

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

It does not work for me, the listbox appears but i can't make a multiple selection with ctrl or shift. In fact i can't change any listbox style, like LBS_NOSEL etc..

It seems i will have to wait until the new release, thanks in any case.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> It does not work for me

Confirmed: doesn't work for me either (W2K).


PB - Registered PureBasic Coder
Post Reply