Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #6792 > unrolled thread

Sort function in combobox

Started byLu <lu2k@hotmail.com>
First post2014-04-17 23:54 -0700
Last post2014-04-22 23:39 +0200
Articles 11 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Sort function in combobox Lu <lu2k@hotmail.com> - 2014-04-17 23:54 -0700
    Re: Sort function in combobox D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2014-04-18 12:18 +0200
      Re: Sort function in combobox Lu <lu2k@hotmail.com> - 2014-04-21 23:37 -0700
        Re: Sort function in combobox D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2014-04-22 09:49 +0200
          Re: Sort function in combobox Lu <lu2k@hotmail.com> - 2014-04-22 04:01 -0700
            Re: Sort function in combobox Johan Nel <johan.nel@xsinet.co.za> - 2014-04-22 04:18 -0700
              Re: Sort function in combobox Lu <lu2k@hotmail.com> - 2014-04-22 05:19 -0700
                Re: Sort function in combobox Johan Nel <johan.nel@xsinet.co.za> - 2014-04-22 05:54 -0700
                  Re: Sort function in combobox Lu <lu2k@hotmail.com> - 2014-04-22 07:11 -0700
    Re: Sort function in combobox Johan Nel <johan.nel@xsinet.co.za> - 2014-04-22 03:00 -0700
    Re: Sort function in combobox "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2014-04-22 23:39 +0200

#6792 — Sort function in combobox

FromLu <lu2k@hotmail.com>
Date2014-04-17 23:54 -0700
SubjectSort function in combobox
Message-ID<1a6a6bc9-5978-4f09-b613-211752b7a6ef@googlegroups.com>
Hi VO experts,

The Sort function in the WED of the combobox does not work properly with this data. The problem is, I need the autocomplete function in the combobox so I have to turn on the sort function. When I set sort=false the data from the stored procedure are correct sorted but the autocomplete function works only for the first character. The combobox typ is a "drop down list"

The number of data is about 1110 and begins e.g. with ( * + [ ? or A-Z.

Thanks for any hints.
Lu

[toc] | [next] | [standalone]


#6794

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2014-04-18 12:18 +0200
Message-ID<0lu1l9d6p1tq5bk3gj4ll3kt5udtenrro4@4ax.com>
In reply to#6792
On Thu, 17 Apr 2014 23:54:28 -0700 (PDT), Lu <lu2k@hotmail.com> wrote:

Hello Lu,
>
>The Sort function in the WED of the combobox does not work properly with this data.
> The problem is, I need the autocomplete function in the combobox so I have to turn on the sort function.
> When I set sort=false the data from the stored procedure are correct sorted
> but the autocomplete function works only for the first character. The combobox typ is a "drop down list"
>
I have for example somewhere in my program a Drop down list combobox
which uses a dbserver with Fillusing on  'Displayfield' Countryname
and returnfield Countrycode. Sort = true. Then I can type multiple
characters until I reach the country I want.

The sorted list looks fine. What exactly is wrong on your sorting? 

If there's a special kind of sorting required, I think you can also
create yourself a correctly sorted array and use that as Fill using. 

Dick

[toc] | [prev] | [next] | [standalone]


#6798

FromLu <lu2k@hotmail.com>
Date2014-04-21 23:37 -0700
Message-ID<ba174ef5-f637-4bb3-8cc6-c5bc8319fd2b@googlegroups.com>
In reply to#6794
Hi Dick,

Thank you for your answer. I realized that the sorting in the array and in the combobox is not the same. I also tried to fill the combobox with a data server from the stored procedure, but it is the same. 
Is it possible that the Fillusing method change the sorting??

Lu 

[toc] | [prev] | [next] | [standalone]


#6799

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2014-04-22 09:49 +0200
Message-ID<rm7cl95tt0lpi7fd8qik59q82eut9c5ab6@4ax.com>
In reply to#6798
On Mon, 21 Apr 2014 23:37:04 -0700 (PDT), Lu <lu2k@hotmail.com> wrote:

Hello Lu,

>Thank you for your answer. I realized that the sorting in the array and in the combobox is not the same. 
>I also tried to fill the combobox with a data server from the stored procedure, but it is the same. 
>Is it possible that the Fillusing method change the sorting??
>

Below the Fillusing and AddItem methods from the SDK so you can see
what it does. As said, I don't see the behaviour you describe in my
code. You should probably try it with one of the VO samples and see
how it works there and then see what you're doing differently?

Dick

METHOD FillUsing(aContents, symField1, symField2) CLASS ListBox
	LOCAL wArrLen AS DWORD
	LOCAL wElemLen AS DWORD
	LOCAL wIndex AS DWORD
	LOCAL uElement AS USUAL
	LOCAL uDisplayValue AS USUAL
	LOCAL uDefValue AS USUAL
	LOCAL wPosition AS DWORD

	IF IsInstanceOfUsual(aContents, #DataServer) .AND.
IsMethod(aContents, #GetLookUpTable)
		aContents := Send(aContents, #GetLookUpTable,
Min(0x7FFF, IVarGet(aContents, #RecCount)), symField1, symField2)
	ELSEIF IsArray(aContents)
		IF !IsNil(symField1) .OR. !IsNil(symField2)
 WCError{#FillUsing,#ListBox,__WCSTypeError,symField1,2}:@@Throw()
		ENDIF
	ELSE
 WCError{#FillUsing,#ListBox,__WCSTypeError,aContents,1}:@@Throw()
	ENDIF

	SELF:Clear()
	SELF:aDisplayValues := {}
	SELF:aRetValues := {}

	IF (wArrLen := ALen(aContents)) > 0
		FOR wIndex := 1 UPTO wArrLen
			uElement := aContents[wIndex]
			IF IsArray(uElement)
				wElemLen := ALen(uElement)
				IF wElemLen = 2
					uDisplayValue := uElement[1]
					uDefValue := uElement[2]
				ELSEIF wElemLen = 1
					uDisplayValue := uElement[1]
					uDefValue := uElement[1]
				ELSE
 WCError{#FillUsing,#ListBox,__WCSTypeError,aContents,1}:@@Throw()
				ENDIF
			ELSE
				uDisplayValue := uElement
				uDefValue := uElement
			ENDIF
			IF !IsString(uDisplayValue)
				uDisplayValue :=
AsString(uDisplayValue)
			ENDIF
			IF IsInstanceOf(SELF, #COMBOBOXEX)
				wPosition :=
SELF:AddItem(uDisplayValue)
			ELSE
				wPosition :=
SUPER:AddItem(uDisplayValue)
			ENDIF
			IF (wPosition != 0)
				IF wPosition > ALen(aDisplayValues)
					AAdd(aDisplayValues,
uDisplayValue)
					AAdd(aRetValues, uDefValue)
				ELSE
					ASize(aDisplayValues,
ALen(aDisplayValues) + 1)
					ASize(aRetValues,
ALen(aRetValues) + 1)
					AIns(aDisplayValues,
wPosition)
					AIns(aRetValues, wPosition)
					aDisplayValues[wPosition] :=
uDisplayValue
					aRetValues[wPosition] :=
uDefValue
				ENDIF
			ENDIF
		NEXT
	ENDIF

	RETURN SELF

METHOD AddItem(cItem, nItemNumber, uRetValue) CLASS ListBox
	LOCAL dwPosition AS DWORD
	IF (dwPosition := SUPER:AddItem(cItem, nItemNumber)) != 0
		SELF:__AddItem(cItem, uRetValue, dwPosition)
	ENDIF

	RETURN dwPosition

[toc] | [prev] | [next] | [standalone]


#6802

FromLu <lu2k@hotmail.com>
Date2014-04-22 04:01 -0700
Message-ID<05e028e2-9a21-4d0e-af03-7f1216f2dac7@googlegroups.com>
In reply to#6799
Thank you for your quick answer!

The method Fillusing is ok, the problem is the sorting of the combobox with this data. I often use this type of combobox, but never with this type of data:
I have a small example of the data (I could not change them :-))

self:oDCcmbVKT:FillUsing({;
{"(+v+,*)",1},{"(Di,Fr,v+)",2},{"(Di,So,v+)",3},{"(Di,v+)",4},;
{"(Di,v+,+)",5},{"(Do,Fr,v+)",6},{"(Do,Fr,v+,So)",7},{"(Do,v+,+), l",8},;
{"+(+v+)",9},{"+(v+)",10},{"+,v+(Sa)",11},{"+v+",12},{"[Fr;v+]",13},;
{"[Sa;v+]",14},{"[v+;Sa]",15},{"Di,Fr(v+)",16},{"Fr(v+)",17},{"Fr,v+",18},;
"Fr,v+(Sa)",19},{"Fr[v+]",20},{"Mo,Di,Mi(v+)",21},{"Mo-Do;+[v+]",22},{"n+(v+)",23} })	 					 

The order of the combobox is following:
(+v+,*)
(Di...)
Fr,..
Mo-Do
[Fr..]
[Sa..]
[v+..]
+(+v+)
+....
Di,Fr...
Fr(...)
Mo,Di...
n+

The correct order should be:
(...)
+..
[..]
Di....
Fr..

[toc] | [prev] | [next] | [standalone]


#6803

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-04-22 04:18 -0700
Message-ID<fd1f8078-1a5b-42c4-888c-b0f6a4cca4f9@googlegroups.com>
In reply to#6802
Lu,

Your sort order is different to the ASCII values e.g. A..z comes before [] etc.

You will need to set auto-sort off and provide your own already sorted list to the combobox otherwise it will not work.

Regards,

Johan.

On Tuesday, April 22, 2014 1:01:00 PM UTC+2, Lu wrote:
> Thank you for your quick answer!
> 
> 
> 
> The method Fillusing is ok, the problem is the sorting of the combobox with this data. I often use this type of combobox, but never with this type of data:
> 
> I have a small example of the data (I could not change them :-))
> 
> 
> 
> self:oDCcmbVKT:FillUsing({;
> 
> {"(+v+,*)",1},{"(Di,Fr,v+)",2},{"(Di,So,v+)",3},{"(Di,v+)",4},;
> 
> {"(Di,v+,+)",5},{"(Do,Fr,v+)",6},{"(Do,Fr,v+,So)",7},{"(Do,v+,+), l",8},;
> 
> {"+(+v+)",9},{"+(v+)",10},{"+,v+(Sa)",11},{"+v+",12},{"[Fr;v+]",13},;
> 
> {"[Sa;v+]",14},{"[v+;Sa]",15},{"Di,Fr(v+)",16},{"Fr(v+)",17},{"Fr,v+",18},;
> 
> "Fr,v+(Sa)",19},{"Fr[v+]",20},{"Mo,Di,Mi(v+)",21},{"Mo-Do;+[v+]",22},{"n+(v+)",23} })	 					 
> 
> 
> 
> The order of the combobox is following:
> 
> (+v+,*)
> 
> (Di...)
> 
> Fr,..
> 
> Mo-Do
> 
> [Fr..]
> 
> [Sa..]
> 
> [v+..]
> 
> +(+v+)
> 
> +....
> 
> Di,Fr...
> 
> Fr(...)
> 
> Mo,Di...
> 
> n+
> 
> 
> 
> The correct order should be:
> 
> (...)
> 
> +..
> 
> [..]
> 
> Di....
> 
> Fr..

[toc] | [prev] | [next] | [standalone]


#6805

FromLu <lu2k@hotmail.com>
Date2014-04-22 05:19 -0700
Message-ID<cc780e37-a45d-4099-a1e9-0bcd38dde801@googlegroups.com>
In reply to#6803
Hi Johann,

Thanks for your input. I do not care whether the A...z comes before []. The items should be sorted and not mixed, like (...), A-z,[...], +..., A-z.

The user need the auto-complete feature, so I can not turn it off.

Lu

[toc] | [prev] | [next] | [standalone]


#6806

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-04-22 05:54 -0700
Message-ID<d236252f-753e-4db2-8530-23a64775e654@googlegroups.com>
In reply to#6805
Lu,

Change the Type from Dropdown List to Dropdown.  And set it to be sorted.

Regards,

Johan.

On Tuesday, April 22, 2014 2:19:28 PM UTC+2, Lu wrote:
> Hi Johann,
> 
> 
> 
> Thanks for your input. I do not care whether the A...z comes before []. The items should be sorted and not mixed, like (...), A-z,[...], +..., A-z.
> 
> 
> 
> The user need the auto-complete feature, so I can not turn it off.
> 
> 
> 
> Lu

[toc] | [prev] | [next] | [standalone]


#6807

FromLu <lu2k@hotmail.com>
Date2014-04-22 07:11 -0700
Message-ID<0670e278-d0c3-4dee-a55c-e0490ad3759f@googlegroups.com>
In reply to#6806
Johan,

Thanks for your tip but there is no difference in the sorting of the combobox, when I change the Typ from Dropdown List to Dropdown and Sort = true.

Another problem is the Dropdown combobox typ that the user can add combobox items which is not allowed in this combobox. The user only needs to select one. 

Could maybe somebody test the sorting of the combobox items and tell me whether the sorting and autocomplete does work correct?

self:oDCcmbVKT:FillUsing({; 
{"(+v+,*)",1},{"(Di,Fr,v+)",2},{"(Di,So,v+)",3},{"(Di,v+)",4},; 
{"(Di,v+,+)",5},{"(Do,Fr,v+)",6},{"(Do,Fr,v+,So)",7},{"(Do,v+,+), l",8},; 
{"+(+v+)",9},{"+(v+)",10},{"+,v+(Sa)",11},{"+v+",12},{"[Fr;v+]",13},; 
{"[Sa;v+]",14},{"[v+;Sa]",15},{"Di,Fr(v+)",16},{"Fr(v+)",17},{"Fr,v+",18},; 
"Fr,v+(Sa)",19},{"Fr[v+]",20},{"Mo,Di,Mi(v+)",21},{"Mo-Do;+[v+]",22},{"n+(v+)",23} })

Lu

[toc] | [prev] | [next] | [standalone]


#6801

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-04-22 03:00 -0700
Message-ID<e51e7e54-24bb-4b74-9aa7-838c6499f853@googlegroups.com>
In reply to#6792
Hi Lu,

>for the first character. The combobox typ is a "drop down list"

Drop down list does not have a auto-complete option.  Change to Type "Drop down" and you should get the behaviour you looking for.

HTH,

Johan Nel
Vulcan VIP
Durban, South Africa.

[toc] | [prev] | [next] | [standalone]


#6809

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2014-04-22 23:39 +0200
Message-ID<bro6arFpcdpU1@mid.individual.net>
In reply to#6792
Hi Lu,

Some time ago I developed together Karl-Heinz a incremental search
routine that probably can fullfill your needs. After each keystroke a subset
with matching items is shown...) Please give me your email adress, in a few
days I'll send you a sample. (my provider does not allow binaries in this
forum)
regards
Urs

PS: Do you speak German?)

"Lu" <lu2k@hotmail.com> schrieb im Newsbeitrag
news:1a6a6bc9-5978-4f09-b613-211752b7a6ef@googlegroups.com...
Hi VO experts,

The Sort function in the WED of the combobox does not work properly with
this data. The problem is, I need the autocomplete function in the combobox
so I have to turn on the sort function. When I set sort=false the data from
the stored procedure are correct sorted but the autocomplete function works
only for the first character. The combobox typ is a "drop down list"

The number of data is about 1110 and begins e.g. with ( * + [ ? or A-Z.

Thanks for any hints.
Lu

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web