flat assembler
Message board for the users of flat assembler.

Index > Windows > Auto-Select entries in Combo-Box

Author
Thread Post new topic Reply to topic
kasake36



Joined: 28 Mar 2006
Posts: 68
kasake36 08 May 2006, 11:29
Hello! I have a problem with auto-selecting entries in a combo-box. The thing is: the user does some input into the combo-box, which sends an CBN_EDITCHANGE Message after each input. I catch this message and first get the input, then i try to find if the combo-box-list holds item with equivalent beginning (CB_FINDSTRING). If yes, then this item with the equivalent beginning should be selected.

That works so far, BUT: After the item with the equivalent beginning has been selected, i too want to set the selection-cursor of course! Meaning, that if the user wrote 4 characters, all characters behind 4 should be selected. There is the CB_SETEDITSEL message exactly for this purpose, and it even returns TRUE but the text doesn't get selected. Instead the cursor is set to the end of the string.

I tried to use SetFocus before i fire CB_SETEDITSEL, but didn't work (of course Wink. Here's the part of my program + the definition of MAKELPARAM, which is used as lparam by CB_SETEDITSEL. Thanks for all help!

Code:
        invoke  GetDlgItemText,[hwnddlg],\  ; Get the input
                IDCB_AUGE,auge,40h
        invoke  SendMessage,[hauge],\    ; Find matching cb-item
                CB_FINDSTRING,0,auge        
        cmp     eax,CB_ERR
        je      processedauf
        invoke  SendMessage,[hauge],\       ; select matching cb-item
                CB_SETCURSEL,eax,0
        mov     word[map.wLow],0
        mov     word[map.wHigh],3
        invoke  SendMessage,[hauge],\
                CB_SETEDITSEL,0,map
        cmp     eax,TRUE
        jne     processedauf
    

Code:
struct MAKELPARAM
    wLow           rb  2
    wHigh          rb  2
ends
    


P.S.: shoorick if you read that - such a feature (auto-select) would be great in the shoolib me believes. I'm not using your lib yet cause i'm still working on the old application, but am looking forward!
Post 08 May 2006, 11:29
View user's profile Send private message Reply with quote
SDragon



Joined: 13 Sep 2005
Posts: 19
Location: Siberia
SDragon 08 May 2006, 14:21
Quote:
invoke SendMessage,[hauge],CB_SETEDITSEL,0,map

should be:
Quote:
invoke SendMessage,[hauge],CB_SETEDITSEL,0,[map]


Or, better, use shl instruction to make the LPARAM value from low and hi index.
Post 08 May 2006, 14:21
View user's profile Send private message Reply with quote
kasake36



Joined: 28 Mar 2006
Posts: 68
kasake36 08 May 2006, 14:27
Damn me, just that simple: instead of delivering a pointer to the MAKELPARAM-structure, you have to push the contents of MAKELPARAM when sending the CB_SETEDITSEL-message.

So the program now looks like this:
Code:
        invoke  GetDlgItemText,[hwnddlg],\  ; Get input
                IDCB_AUGE,auge,40h
        invoke  SendMessage,[hauge],\       ; Current cursor pos
                CB_GETEDITSEL,map,map+2
        invoke  SendMessage,[hauge],\       ; similar string in cb-list?
                CB_FINDSTRING,0,auge       
        cmp     eax,CB_ERR
        je      processedauf
        invoke  SendMessage,[hauge],\       ; select similar string
                CB_SETCURSEL,eax,0
        mov     word[map.wHigh],-1          ; set the end-position of the sel
        invoke  SendMessage,[hauge],\
                CB_SETEDITSEL,0,[map]
    
Post 08 May 2006, 14:27
View user's profile Send private message Reply with quote
kasake36



Joined: 28 Mar 2006
Posts: 68
kasake36 09 May 2006, 09:33
Thanks SDragon. I couldn't see your post yesterday when i was posting the answer. There was much traffic i remember...
Post 09 May 2006, 09:33
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.