#87907 - 2002-09-21 11:14 AM
Re: Kixforms 2.0.5 Released
|
Vig
Starting to like KiXtart
Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
|
Shawn, I have a request.
Is it possible to add a property like removecopies or removeduplicates for listbox/combobox? In case the suggested property name doesn't explain it well enough. I'm asking for a property that will cause listbox/combobox to ignore multiple occurances of the same string.
Example: $array = "1","1","2","2","3","3" $MyBox = Listbox(,,,,) $MyBox.List = $array
The listbox should contain 1 2 3 4 instead of 1 1 2 2 3 3 4 4.
Also, is there a way to have a listbox automatically scroll down when items are added?
Thanks
|
Top
|
|
|
|
#87908 - 2002-09-21 06:07 PM
Re: Kixforms 2.0.5 Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
There doesn't seem to be a ListBox or ComboBox style or property that allows one to have or filter a unique list of items (can you or anybody else find any references ?).
One solution I found revolved around simply purging the array of duplicates before the list was populated. Heres that link:
One solution
Im going to keep looking and thinking about this one though. For the second question - automatically scrolling and selecting items as they are added. Well - for a listbox that is not sorted, you can always set the ListIndex (current selection) to last item in the list.
Assuming you have a ListBox called ListBox1 and a CommandButton called CommanButton1, heres the code for that:
code:
Function CommandButton1_Click() $ListBox1.AddItem(RND(9)) $ListBox1.ListIndex = $ListBox1.ListCount - 1 EndFunction
For a SORTED ListBox - its a whole new story - this was discussed and the problem demonstrated in the 4TH post of this thread :
Topic: Kixforms: Version 2.0.5 Build 33 Heads Up [ 21. September 2002, 18:12: Message edited by: Shawn ]
|
Top
|
|
|
|
#87909 - 2002-09-21 06:18 PM
Re: Kixforms 2.0.5 Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
hmmm .. the more I think about that unqiue item thingy - the more i like. Just because VB and VBA doesn't support it - doesn't mean we can't ... I think this request is "generic" enough to be included as a behavior of the ListBox ... will stick it on todo stack ... trying to think of a good name for this property.
|
Top
|
|
|
|
#87910 - 2002-09-22 06:40 AM
Re: Kixforms 2.0.5 Released
|
Vig
Starting to like KiXtart
Registered: 2001-11-14
Posts: 166
Loc: Saudi Arabia
|
Here is what I'm currently using to remove duplicates from an array. It's written assuming each string in the array begins with 0-9 or A-Z, but can easily encompass the entire ascii table (even shorter if I created all the variables dynamically).
code:
Function StripCopies($striArray) $on = 1 Dim $searArr,$a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p, $q,$r,$s,$t,$u,$v,$w,$x,$y,$z,$0,$1,$2,$3,$4,$5,$6,$7,$8,$9 For Each $add in $StriArray $dyn = SubStr($add,1,1) $nul = Execute('if ubound($$$dyn) = -1 ReDim $$$dyn[0] $$$dyn[Ubound($$$dyn)] = $$add EndIf $$counter = 0 While Ubound($$$dyn)+1 <> $$counter If $$add = $$$dyn[$$counter] $$on = 1 EndIf $$counter = $$counter+1 Loop $$counter = 0 If $$on = 0 ReDim preserve $$$dyn[Ubound($$$dyn)+1] $$$dyn[Ubound($$$dyn)] = $$add EndIf') $on = 0 Next $ProgComp.Value = 0 $ProgSoft.Value = 0 $count = 48 While $count <> 91 $dyna = Chr($count) $nul = Execute('for each $$addto in $$$dyna ReDim preserve $$seararr[Ubound($$seararr)+1] $$seararr[Ubound($$seararr)] = $$addto Next') $count = $count + 1 If $count = 58 $count = $count + 7 EndIf Loop $StripCopies = $SearArr EndFunction
I rewrote an older UDF I posted a few weeks back because it was taking entirely to long to strip the duplicates. In testing the older UDF took about 45 seconds to strip 464 unique strings from the 1220 original, this script cut that down to about 6 seconds. Of course the effectiveness of this script depends on the the original array's contants 1st characters varrying. In other words the function is faster if the first character of the strings in the array are not all the same.
Sorry, not trying to hijack the thread. I just wanted to make sure you didn't think I was asking you to write something for me because I was to lazy to do it myself.
Thanks for the input.
|
Top
|
|
|
|
#87914 - 2002-09-26 06:53 PM
Re: Kixforms 2.0.5 Released
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
anyone notice that the form background is 'missing/transparent' when you run a script while bbchecker is running
|
Top
|
|
|
|
#87916 - 2002-09-26 07:10 PM
Re: Kixforms 2.0.5 Released
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
seems to work fine that way
|
Top
|
|
|
|
#87921 - 2002-09-29 06:18 PM
Re: Kixforms 2.0.5 Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Jooel - your right - both of those features are not there. The TextBox multi-color text thingy will never be there because the TextBox doesn't support that. The RichEdit box would though
The MenuItem thingy will be back in sometime after 2.1 ... not sure when because I was planning on starting RichEdit right after that.
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 373 anonymous users online.
|
|
|