Page 1 of 1
Posted: Sun Oct 06, 2002 7:51 pm
by BackupUser
Restored from previous forum. Originally posted by blueb.
Hi,
I'm working on getting file names from a directory
with ExamineDirectory command and stuffing the
results into a ListViewGadget.
Everything works well, except the ListViewGadget
does not display the filenames in alphabetical order.
How can I sort the ListViewGadget? Or do I need
to stuff the results in an array first, then
insert the array into the LV?
The AddGadgetItem "position" flag doesn't work here.
Regards,
--blueb
Posted: Sun Oct 06, 2002 8:54 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
I think you must sort the array first. If you want to allow the user to sort the list afterwards, check this:
viewtopic.php?t=869
Bye,
El_Choni
Posted: Sun Oct 06, 2002 9:09 pm
by BackupUser
Restored from previous forum. Originally posted by blueb.
That's what I thought.
I'll take a look at your sample.
Thanks,
--blueb
Posted: Mon Oct 07, 2002 12:21 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
You simply create a ListBox with the styles:
#LBS_SORT | #LBS_NOINTEGRALHEIGHT | #LBS_HASSTRINGS
and for adding new stuff you use:
SendMessage_(handle, #LB_ADDSTRING, 0, String).
Code: Select all
hWnd = OpenWindow(1,100,100,400,300,#PB_Window_SystemMenu,"ListBox Sort")
CreateGadgetList(hWnd)
ListViewGadget(1, 10,10,280,280,#LBS_SORT | #LBS_NOINTEGRALHEIGHT | #LBS_HASSTRINGS)
StringGadget (2,300,50, 90, 20, "Type here")
ButtonGadget (3,320,75, 50, 20, "Add")
Repeat
Select WaitWindowEvent()
Case #PB_EventCloseWindow: End
Case #PB_EventGadget
Select EventGadgetID()
Case 1 ; ListView
If EventType() = #PB_EventType_LeftDoubleClick
; show the selected listview entry on doubleclick
MessageRequester("INFO",GetGadgetItemText(1,GetGadgetState(1),0),0)
EndIf
Case 3 ; Button: Add
SendMessage_( GadgetID(1), #LB_ADDSTRING, 0, GetGadgetText(2))
EndSelect
EndSelect
ForEver
cya,
...Danilo
(registered PureBasic user)
Posted: Mon Oct 07, 2002 12:42 am
by BackupUser
Restored from previous forum. Originally posted by blueb.
Thanks Danilo.
SendMessage did the trick!
Regards,
--blueb
Posted: Mon Oct 07, 2002 4:12 am
by BackupUser
Restored from previous forum. Originally posted by PB.
Danilo: Your tab indents are 3 spaces, not 2? Does the new editor
let us specify the value now?
PB - Registered PureBasic Coder
Posted: Mon Oct 07, 2002 4:28 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
Hehe... PB
Look at the code - i use 2, 3 and 4 spaces.

Its my personal coding style:
Code: Select all
If x = 1 next line here, 3 spaces
Endif
Case 1
Code here, 5 spaces
Case 2
Code here
But now, Fred said i should always use 2 spaces
for indents... so all my personal style got
mixed up - but is still very readable, IMHO.
For me, mostly 3 spaces and TAB set to 8 or 10 is OK.
You´ll see the complete new Editor in few hours
with 3.40...
cya,
...Danilo
(registered PureBasic user)
Posted: Mon Oct 07, 2002 9:32 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
Originally posted by Danilo
You´ll see the complete new Editor in few hours
with 3.40...
cya,
...Danilo
Which time frame

Earth

Universe
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Posted: Mon Oct 07, 2002 10:01 pm
by BackupUser
Restored from previous forum. Originally posted by Andre.
I would say: look for the v3.40 update tommorow late night (12.00 pm)
Regards
André
*** German PureBasic Support ***
Posted: Tue Oct 08, 2002 1:49 am
by BackupUser
Restored from previous forum. Originally posted by PB.
Which time frame

Earth

Universe
Sorry Franco: I reported some bugs and correct some documentation
last night for Fred, so I may have contributed to delaying the
release. At least it'll be a more bug-free release!
PB - Registered PureBasic Coder
Posted: Tue Oct 08, 2002 3:23 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.