Re: [Gambas-user] Ugly gtk warnings with tabstrip object
I run clearlooks with tango for icons. -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Headache causing misplaced error message.
Thanks!!! Jussi 2009/4/6 Benoît Minisini gam...@users.sourceforge.net: Hi! Here is very simplified example of the bug I found (Gambas 2.10 and Gambas3 rev. 1917). From that you can easily see what is wrong, but in real life code... This bug seems to be generally in else if, error doesn't have to be division by zero, it could be any. And there could be many lines of else if, still the error message goes to the first line. Dim x As Integer If x = -1 Then '--- YOU GOT ERROR MESSAGE FROM THIS LINE. 'nothing Else If 1 / 0 Then 'nothing Endif Regards, Jussi Finally fixed in revision #1924! Regards, -- Benoît -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] TextArea scrolling
Did you find a solution? 2009/4/4 Jussi Lahtinen jussi.lahti...@gmail.com Hi! How I can automatically scroll down textarea? So that the last message printed to textarea is always showing, without user have to scroll down? Regards, Jussi -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- joshua higgins -- -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] TextArea scrolling
I was just writing about this issue! It turn out to be bug! This works on GTK+, but not with Qt; TextArea1.EnsureVisible() So, if you are using GTK+ you have your solution... If not, you must wait for fix. Jussi On Mon, Apr 6, 2009 at 17:13, Joshua Higgins joshigg...@googlemail.com wrote: Did you find a solution? 2009/4/4 Jussi Lahtinen jussi.lahti...@gmail.com Hi! How I can automatically scroll down textarea? So that the last message printed to textarea is always showing, without user have to scroll down? Regards, Jussi -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- joshua higgins -- -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] TextArea scrolling
I was just writing about this issue! It turn out to be bug! This works on GTK+, but not with Qt; TextArea1.EnsureVisible() So, if you are using GTK+ you have your solution... If not, you must wait for fix. Jussi It's the contrary: The EnsureVisible() method should not be there. :-) But just moving the cursor should make it automatically visible both with Qt and GTK+. Regards, -- Benoît -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] TextArea scrolling
I was just writing about this issue! It turn out to be bug! This works on GTK+, but not with Qt; TextArea1.EnsureVisible() So, if you are using GTK+ you have your solution... If not, you must wait for fix. Jussi Forget my other mail: the EnsureVisible() method is perfectly valid, but I don't see why it would not work with Qt. -- Benoît -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] TextArea scrolling
Absolutely nothing happens in Qt, but with GTK+ it works as expected. It works in your system? Jussi 2009/4/6 Benoît Minisini gam...@users.sourceforge.net: I was just writing about this issue! It turn out to be bug! This works on GTK+, but not with Qt; TextArea1.EnsureVisible() So, if you are using GTK+ you have your solution... If not, you must wait for fix. Jussi Forget my other mail: the EnsureVisible() method is perfectly valid, but I don't see why it would not work with Qt. -- Benoît -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Panning a picturebox inside a scrollview with mouse
Many thanks Steven for your input I have solved this issue using a drawingarea object instead a picturebox. I've stated than it is much less cpu consuming, because the image --a big world map-- I want to show, needs to be updated periodically by other shell command that modifies it with texts and lines, and must be loaded everytime. After a bit of thinking, I prefer don't update the map itself, and draw over it, instead. Here is what I've done so far; you can use the mouse to pan the image around. #See attached project# In the meantime I will take a look to your example, I'm sure it will be very helpfull. Thanks again Regards Jesús Steven James Drinnan escribió: Hi here is an example. In this example, you can embed the ocphotoview into a form. It is from a project that I am working on, so . Some of the code comes from the web camera example. There are some use full functions there as well. To load a picture right click. You can select. By file or Web camera or even from a scanner. Once loaded you can move the picture around by left clicking. You can easily modify the code by checking which button is pressed (but then you will loose the menu feature.) I hope it helps. Its a bit overloaded for what you need but it will hopefully get you pointed in the right direction. If you need any help please ask. Steven Drinnan On Sun, 2009-04-05 at 18:00 +0200, Jesus Guardon wrote: I need some help about this issue, because I'm unable to get it working. What I want to do is panning a picturebox inside a scrollview when I click RMB and move the mouse around. BTW, something usual in a lot of graphical apps. Can anyone help me, please? Attached is the basic project in Gambas2, but without the picture (size too big to be accepted by the list) Regards Jesús -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user mapDX.tar.gz Description: GNU Zip compressed data -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Gambas freezes with Qt apps
Benoît Minisini ha scritto: kbuildsycoca is a KDE program, so either you have gb.qt.kde selected in your project, or maybe you are using a specific Qt theme that depends on KDE. Do you know what Qt theme is used by your freezing applications on your Ubuntu system? Use the qtconfig program for that, or look for the Style= entry in the ~/.qt/qtrc file. Plastik theme. You can help me too by using 'gdb' on the frozen process. Find the PID of the frozen process, and run 'gdb gbx2 PID'. gdb will stop and debug it. Then you can use the 'bt' command to get the stack backtrace and send me the result. Note that Gambas must have been compiled with debugging information enabled. Regards, I'll try this procedure. But freeze maybe is not the correct term. The IDE still runs quite and fine. Simply, the applications seems not to start, waiting for some events that don't happen... In fact, if I press the Stop button, the IDE terminates the program without error messages. -- Ciao. Leo. Web: www.leonardomiliani.com E-mail: leona...@leonardomiliani.com Scegli software opensource - Choose opensource software Co-fondatore di Gambas-it.org Il sito di riferimento della comunità italiana degli utenti di Gambas www.gambas-it.org -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Gambas freezes with Qt apps
Here is the output of the gdb program. -- Ciao. Leo. Web: www.leonardomiliani.com E-mail: leona...@leonardomiliani.com Scegli software opensource - Choose opensource software Co-fondatore di Gambas-it.org Il sito di riferimento della comunità italiana degli utenti di Gambas www.gambas-it.org GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i486-linux-gnu... (no debugging symbols found) Attaching to program: /usr/bin/gbx2, process 7013 Reading symbols from /usr/lib/libqt-mt.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libqt-mt.so.3 Reading symbols from /lib/tls/i686/cmov/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/tls/i686/cmov/libm.so.6 Reading symbols from /lib/tls/i686/cmov/libdl.so.2... (no debugging symbols found)...done. Loaded symbols for /lib/tls/i686/cmov/libdl.so.2 Reading symbols from /lib/tls/i686/cmov/libpthread.so.0...(no debugging symbols found)...done. [Thread debugging using libthread_db enabled] [New Thread 0xb72ca6c0 (LWP 7013)] Loaded symbols for /lib/tls/i686/cmov/libpthread.so.0 Reading symbols from /usr/lib/libffi.so.5... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libffi.so.5 Reading symbols from /lib/tls/i686/cmov/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/tls/i686/cmov/libc.so.6 Reading symbols from /usr/lib/libfontconfig.so.1... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libfontconfig.so.1 Reading symbols from /usr/lib/libaudio.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libaudio.so.2 Reading symbols from /usr/lib/libXt.so.6... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libXt.so.6 Reading symbols from /usr/lib/libjpeg.so.62...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libjpeg.so.62 Reading symbols from /usr/lib/libpng12.so.0... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libpng12.so.0 Reading symbols from /usr/lib/libz.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /usr/lib/libXi.so.6... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libXi.so.6 Reading symbols from /usr/lib/libXrender.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXrender.so.1 Reading symbols from /usr/lib/libXrandr.so.2... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libXrandr.so.2 Reading symbols from /usr/lib/libXcursor.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXcursor.so.1 Reading symbols from /usr/lib/libXinerama.so.1... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libXinerama.so.1 Reading symbols from /usr/lib/libXft.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXft.so.2 Reading symbols from /usr/lib/libfreetype.so.6... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libfreetype.so.6 Reading symbols from /usr/lib/libXext.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXext.so.6 Reading symbols from /usr/lib/libX11.so.6... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libX11.so.6 Reading symbols from /usr/lib/libSM.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libSM.so.6 Reading symbols from /usr/lib/libICE.so.6... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libICE.so.6 Reading symbols from /usr/lib/libstdc++.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libstdc++.so.6 Reading symbols from /lib/libgcc_s.so.1... (no debugging symbols found)...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /usr/lib/libexpat.so.1... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libexpat.so.1 Reading symbols from /usr/lib/libXfixes.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXfixes.so.3 Reading symbols from /usr/lib/libXau.so.6... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libXau.so.6 Reading symbols from /usr/lib/libxcb-xlib.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libxcb-xlib.so.0 Reading symbols from /usr/lib/libxcb.so.1... ---Type return to continue, or q return to quit--- (no debugging symbols found)...done. Loaded symbols for /usr/lib/libxcb.so.1 Reading symbols from /usr/lib/libXdmcp.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXdmcp.so.6 Reading symbols from /lib/tls/i686/cmov/libnss_compat.so.2... (no
[Gambas-user] Simple file dialog question
If you select a file using a file dialog and get back dialog.path, is there any instant way to ret extract just the file name on the end of a long path without having to do any parsing? thanks Richard -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Simple file dialog question
If you select a file using a file dialog and get back dialog.path, is there any instant way to ret extract just the file name on the end of a long path without having to do any parsing? thanks Richard File.Name(TheLongPath) ? -- Benoît -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] A random sort of listview
I came up with a way to random sort listview. (Iuse this for random shuffling card slots on games) But it isnt efficient some pointers if you dont mind? I use two listviews one to sort from and one to sort to: I first copy all the listitems from list 1 to list 2 EXCEPT the key for listview2 items = the integer from my for next loop eg for i = 0 to listview1.count -1 step 1 listview2.add(i, listview1.item.text) next then with a for next loop based on the length of list1 I copy the listview.item key to a string A and listview.item.text to second string B Then I calculate a random number the count of listview2 and add that to a integer C thenadd it to listview2 listview2.add(nA, B,,C) nA creates a key of n1, n2, etc ... AFter the loop ends I run a second loop and run for i = 0 to listview1.count -1 step 1 listview.moveto(i) listview2.item.delete next This gives me a random sorted list in viewlist2 of viewlist1 with no duplicates etc- But is there a more efficient way of doing this? here is total code: PUBLIC SUB button3_click() DIM a AS String DIM d AS Integer DIM e AS Integer DIM i AS Integer DIM c AS Integer listview1.Clear 'clears the list FOR i = 0 TO 199 STEP 1 'number of items to add listview2.Add(i, Slot i) 'adds items to sort to list NEXT 'next item i = 0 FOR i = 0 TO 199 STEP 1 'number of items e = 0 listview1.MoveTo(i) 'goto item a = listview1.Item.Text 'get text PRINT a d = listview1.Key 'get key PRINT old key, d listview1.Item.Delete 'delete item (the cut part of cut and paste) e = Round(Rnd(200)) ' make sure old key doesNOT equal NEW Key PRINT e, the randomimzed number IF e = 200 THEN e = 199 listview2.Add(n d, n a,, e) 'adds cut items after randomly chosen item listview3.Add(n d, n a) PRINT new key, e NEXT 'next item down FOR i = 0 TO 199 STEP 1 'number of items listview2.MoveTo(i) listview2.Item.Delete NEXT ValueBox1.value = listview1.Count END JB SKaggs -- View this message in context: http://www.nabble.com/A-random-sort-of-listview-tp22919766p22919766.html Sent from the gambas-user mailing list archive at Nabble.com. -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] A random sort of listview
jbskaggs a écrit : I came up with a way to random sort listview. (Iuse this for random shuffling card slots on games) But it isnt efficient some pointers if you dont mind? I use two listviews one to sort from and one to sort to: I first copy all the listitems from list 1 to list 2 EXCEPT the key for listview2 items = the integer from my for next loop eg for i = 0 to listview1.count -1 step 1 listview2.add(i, listview1.item.text) next then with a for next loop based on the length of list1 I copy the listview.item key to a string A and listview.item.text to second string B Then I calculate a random number the count of listview2 and add that to a integer C thenadd it to listview2 listview2.add(nA, B,,C) nA creates a key of n1, n2, etc ... AFter the loop ends I run a second loop and run for i = 0 to listview1.count -1 step 1 listview.moveto(i) listview2.item.delete next This gives me a random sorted list in viewlist2 of viewlist1 with no duplicates etc- But is there a more efficient way of doing this? here is total code: PUBLIC SUB button3_click() DIM a AS String DIM d AS Integer DIM e AS Integer DIM i AS Integer DIM c AS Integer listview1.Clear 'clears the list FOR i = 0 TO 199 STEP 1 'number of items to add listview2.Add(i, Slot i) 'adds items to sort to list NEXT 'next item i = 0 FOR i = 0 TO 199 STEP 1 'number of items e = 0 listview1.MoveTo(i) 'goto item a = listview1.Item.Text 'get text PRINT a d = listview1.Key 'get key PRINT old key, d listview1.Item.Delete 'delete item (the cut part of cut and paste) e = Round(Rnd(200)) ' make sure old key doesNOT equal NEW Key PRINT e, the randomimzed number IF e = 200 THEN e = 199 listview2.Add(n d, n a,, e) 'adds cut items after randomly chosen item listview3.Add(n d, n a) PRINT new key, e NEXT 'next item down FOR i = 0 TO 199 STEP 1 'number of items listview2.MoveTo(i) listview2.Item.Delete NEXT ValueBox1.value = listview1.Count END JB SKaggs Hi, Let say you want to populate an array with 0-199 randomly (please note that I write this directly, so check carefully the syntax) dim myArray as integer[200] dim A as integer dim i as integer FOR i=0 to 199 A=int(Rnd(200-i)) ' I think we could use a Swap instruction ' instead of the 2 instructions below myArray[i]=A myArray[A]=i NEXT That's all If these numbers was the keys of the initial Listview you just have to populate the second Listview in the new order Hope this help Dominique Simonart -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] A random sort of listview
Simonart Dominique a écrit : jbskaggs a écrit : I came up with a way to random sort listview. (Iuse this for random shuffling card slots on games) But it isnt efficient some pointers if you dont mind? I use two listviews one to sort from and one to sort to: I first copy all the listitems from list 1 to list 2 EXCEPT the key for listview2 items = the integer from my for next loop eg for i = 0 to listview1.count -1 step 1 listview2.add(i, listview1.item.text) next then with a for next loop based on the length of list1 I copy the listview.item key to a string A and listview.item.text to second string B Then I calculate a random number the count of listview2 and add that to a integer C thenadd it to listview2 listview2.add(nA, B,,C) nA creates a key of n1, n2, etc ... AFter the loop ends I run a second loop and run for i = 0 to listview1.count -1 step 1 listview.moveto(i) listview2.item.delete next This gives me a random sorted list in viewlist2 of viewlist1 with no duplicates etc- But is there a more efficient way of doing this? here is total code: PUBLIC SUB button3_click() DIM a AS String DIM d AS Integer DIM e AS Integer DIM i AS Integer DIM c AS Integer listview1.Clear 'clears the list FOR i = 0 TO 199 STEP 1 'number of items to add listview2.Add(i, Slot i) 'adds items to sort to list NEXT 'next item i = 0 FOR i = 0 TO 199 STEP 1 'number of items e = 0 listview1.MoveTo(i) 'goto item a = listview1.Item.Text 'get text PRINT a d = listview1.Key 'get key PRINT old key, d listview1.Item.Delete 'delete item (the cut part of cut and paste) e = Round(Rnd(200)) ' make sure old key doesNOT equal NEW Key PRINT e, the randomimzed number IF e = 200 THEN e = 199 listview2.Add(n d, n a,, e) 'adds cut items after randomly chosen item listview3.Add(n d, n a) PRINT new key, e NEXT 'next item down FOR i = 0 TO 199 STEP 1 'number of items listview2.MoveTo(i) listview2.Item.Delete NEXT ValueBox1.value = listview1.Count END JB SKaggs Hi, Let say you want to populate an array with 0-199 randomly (please note that I write this directly, so check carefully the syntax) dim myArray as integer[200] dim A as integer dim i as integer FOR i=0 to 199 A=int(Rnd(200-i)) ' I think we could use a Swap instruction ' instead of the 2 instructions below myArray[i]=A myArray[A]=i NEXT That's all If these numbers was the keys of the initial Listview you just have to populate the second Listview in the new order Hope this help Dominique Simonart Well, never write directly like that!! I make some mistake in my sample, here is a new one: DIM myArray AS Integer[200] DIM A AS Integer DIM i AS Integer 'initialize the array FOR i=0 TO 199 myArray[i]=i NEXT 'Randomize the order of the array FOR i = 199 TO 0 STEP -1 A = Int(Rnd(i + 1)) SWAP myArray[i], myArray[A] NEXT -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] A random sort of listview
using your suggestions and the swap command vs manual swapping this is my code: public b as string 'optional string used to hold the array data for file or split later PUBLIC SUB button4_click() ' initialize array DIM myArray AS Integer[200] DIM a AS Integer DIM i AS Integer FOR i = 0 TO 199 STEP 1 'add array items myArray[i] = i NEXT FOR i = 0 TO 199 STEP 1 ' random swap array items a = Int(Rnd(i + 1)) SWAP myArray[i], myArray[a] NEXT FOR i = 0 TO 199 STEP 1 ' write items in listview2 listview1.MoveTo(myArray[i]) c = listview1.Item.Key listview2.add(c, listview1.item.text) NEXT FOR i = 0 TO 199 STEP 1 'optional step to write array as a string for file or whatever use b = slot myArray[i] , NEXT PRINT b END PUBLIC SUB Button1_Click() 'an optional way to load the array values from the variable b and / or a file if b was file loaded DIM egg AS String[] DIM c AS String listview1.Clear egg = Split(b, ,) FOR EACH c IN egg TRY listview1.Add(c, c) IF ERROR THEN RETURN NEXT IF listview1.Count = 200 THEN RETURN END JB Skaggs Simonart Dominique wrote: Simonart Dominique a écrit : jbskaggs a écrit : I came up with a way to random sort listview. (Iuse this for random shuffling card slots on games) But it isnt efficient some pointers if you dont mind? I use two listviews one to sort from and one to sort to: I first copy all the listitems from list 1 to list 2 EXCEPT the key for listview2 items = the integer from my for next loop eg for i = 0 to listview1.count -1 step 1 listview2.add(i, listview1.item.text) next then with a for next loop based on the length of list1 I copy the listview.item key to a string A and listview.item.text to second string B Then I calculate a random number the count of listview2 and add that to a integer C thenadd it to listview2 listview2.add(nA, B,,C) nA creates a key of n1, n2, etc ... AFter the loop ends I run a second loop and run for i = 0 to listview1.count -1 step 1 listview.moveto(i) listview2.item.delete next This gives me a random sorted list in viewlist2 of viewlist1 with no duplicates etc- But is there a more efficient way of doing this? here is total code: PUBLIC SUB button3_click() DIM a AS String DIM d AS Integer DIM e AS Integer DIM i AS Integer DIM c AS Integer listview1.Clear 'clears the list FOR i = 0 TO 199 STEP 1 'number of items to add listview2.Add(i, Slot i) 'adds items to sort to list NEXT 'next item i = 0 FOR i = 0 TO 199 STEP 1 'number of items e = 0 listview1.MoveTo(i) 'goto item a = listview1.Item.Text 'get text PRINT a d = listview1.Key 'get key PRINT old key, d listview1.Item.Delete 'delete item (the cut part of cut and paste) e = Round(Rnd(200)) ' make sure old key doesNOT equal NEW Key PRINT e, the randomimzed number IF e = 200 THEN e = 199 listview2.Add(n d, n a,, e) 'adds cut items after randomly chosen item listview3.Add(n d, n a) PRINT new key, e NEXT 'next item down FOR i = 0 TO 199 STEP 1 'number of items listview2.MoveTo(i) listview2.Item.Delete NEXT ValueBox1.value = listview1.Count END JB SKaggs Hi, Let say you want to populate an array with 0-199 randomly (please note that I write this directly, so check carefully the syntax) dim myArray as integer[200] dim A as integer dim i as integer FOR i=0 to 199 A=int(Rnd(200-i)) ' I think we could use a Swap instruction ' instead of the 2 instructions below myArray[i]=A myArray[A]=i NEXT That's all If these numbers was the keys of the initial Listview you just have to populate the second Listview in the new order Hope this help Dominique Simonart Well, never write directly like that!! I make some mistake in my sample, here is a new one: DIM myArray AS Integer[200] DIM A AS Integer DIM i AS Integer 'initialize the array FOR i=0 TO 199 myArray[i]=i NEXT 'Randomize the order of the array FOR i = 199 TO 0 STEP -1 A = Int(Rnd(i + 1)) SWAP myArray[i], myArray[A] NEXT -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- View this message in context: http://www.nabble.com/A-random-sort-of-listview-tp22919766p22922075.html Sent from the gambas-user mailing list archive at Nabble.com. -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now!