News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ComboBox problem

Started by RuiLoureiro, October 22, 2010, 06:30:18 PM

Previous topic - Next topic

Coma

RuiLoureiro,

some general words about the dialog procedure.
A Dialog Procure is similar a Window Procedure, but some parts are different.
In a Dialog procedure you should always return TRUE if you proceed a message, except for WM_INITDIALOG.
If a message in a Dialog procedure needs a special return value call SetWindowLong (DWL_MSGRESULT) to set the desired return value.
Call SetWindowLong immediately before returning TRUE.
A Dialog provides basic keyboard functionality, i.e. arrow keys and also the return key.
Unfortunately the return key is not supported in the iWhy member of the NMCBEENDEDIT structure.
You should read the documentation carefully.

Back to the ComBoxEx dialog procedure problem:
As a hint you could try the WM_GETDLGCODE message to enable this 'Return key feature'.
It is your task to find out how to implement that, my support ends here !

As an alternative, until you find the solution, you can reserve space in the main window for temporary used controls (using SW_HIDE and SW_SHOW).

You see things are not so easy like expected.
Also realize that the new inserted item is lost if you closed the dialog.
So further coding is necessary to keep the new inserted item.


Anyway, i modify your source code and attach the working dialog example.
In this modified source code the new item is inserted if you dropdown the list (using the CBENF_DROPDOWN notification).
If you click elsewhere it is discarded.



Coma
Coma Homepage 20:00-23:00 GMT+2 --- http://ge2001.dyndns.org:44792

RuiLoureiro

Coma,
            Thanks for your help & support
           
Quote
Unfortunately the return key is not supported in the iWhy member of the NMCBEENDEDIT structure.
            I removed it and it works as i expected
            Using the CBENF_DROPDOWN notification is another good solution

            I did this:
            ;mov     eax, CBENF_DROPDOWN;CBENF_RETURN        ; if <Return> insert new item
            ;cmp     [ebx+20+CBEMAXSTRLEN], eax
            ;jne     WP_Return1
            When we press return the new item is inserted.
            It works, so my problem is solved
           
Quote
Also realize that the new inserted item is lost if you closed the dialog.
So further coding is necessary to keep the new inserted item.
            I know that. I have a buffer to keep all initial and inserted items.
            The strings are inserted from that buffer. No problems here.
            I also remove all strings with spaces. Spaces are not inserted.

Many thanks
RuiLoureiro