Hi

I load my strings from resource. I have this in rc file:

1 "Classic Rock"
2 "Country"
3 "Dance"
.
.

When i add sort for this combo, this string ID's are changed (not string ID's but indexes for combo box). Is there a way to avoid this behaviour. I want this string ID's to be the same as item indexes in this combo.

thanks

stanks
Posted on 2002-12-13 13:18:49 by stanks
Stanks, inside a combobox each item recieves an "id" wich
represents the position of an item. Since changing the sort
order of a combobox would also change the positions. You
cannot change this beahviour.

Maybe there is some kind of "tag" you can use instead tho.
But I have never heard of such a thing related to comboboxes.
The only thing I know that would work, is when you add a
number infront of the name for each item.
Ex:.
1 "1.Classic Rock"
2 "2.Country"
3 "3.Dance"
.
Posted on 2002-12-13 13:42:22 by natas
CB_SETITEMDATA
CB_GETITEMDATA

Regards,
Lingo
Posted on 2002-12-13 17:42:44 by lingo12
lingo12, ahh so thats the way you "tag" em. Nice! ( ;) ) Youre a pretty
"resourcefull" guy(from the responses you give in this and other posts).
Dont suppose you have a webpage? Always, looking for some knowledge. ( ;) )
Posted on 2002-12-13 18:49:42 by natas
I have some code with regards to reading string resource.



rsrcstring proc
mov edx,ID
dec edx
shl edx,4
mov ID,edx
or cntID,-1
invoke SendMessage,hEdit,EM_REPLACESEL,0,OFFSET stringheader
stringloop:
inc cntID
sub esi,2
movzx ecx, WORD PTR [ebx]
or ecx,ecx
jz Nostring
add ebx,2
lea edi, buffer2
unicode_:
mov ax,WORD PTR [ebx]
mov BYTE PTR[edi],al
add ebx,2
inc edi
sub esi,2
dec ecx
jnz unicode_
mov BYTE PTR[edi],0
mov edx,ID
add edx,cntID
invoke wsprintf,OFFSET filename,OFFSET stringformat,edx,OFFSET buffer2
invoke SendMessage,hEdit,EM_REPLACESEL,0,OFFSET filename
jmp testsize
Nostring:
add ebx,2
testsize:
or esi,esi
jnz stringloop
invoke SendMessage,hEdit,EM_REPLACESEL,0,OFFSET resend
ret
rsrcstring endp


PS ebx=pointer of resource, esi=sizeof the string resource,ID = ID of the string resource
Posted on 2002-12-13 22:16:14 by roticv