News:

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

ComboBox

Started by Klod, November 07, 2005, 04:41:16 AM

Previous topic - Next topic

Klod

I have been experimenting with in memory dialogs.
As base I used the example from the Masm distro, Nested.asm.


main proc

    LOCAL lpArgs:DWORD
    invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT, 32
    mov lpArgs, eax

    push hIcon
    pop [eax]

    Dialog "Beam Calculator","MS Sans Serif",10, \         ; caption,font,pointsize
            WS_OVERLAPPED or WS_SYSMENU or DS_CENTER, \     ; style
            8, \                                            ; control count
            50,50,150,80, \                                 ; x y co-ordinates
            1024                                            ; memory buffer size

    DlgButton "Calculate",WS_TABSTOP,112,4,30,10,IDOK
    DlgButton "Cancel",WS_TABSTOP,112,15,30,10,IDCANCEL
    DlgStatic 'Enter Span in inches',SS_CENTER,13,35,140,9,100
    DlgStatic 'Wood Species',SS_CENTER,10,10,80,25,500
    DlgIcon   500,5,5,50
    DlgCombo  CBS_DROPDOWNLIST OR CB_ADDSTRING ,30,20,40,20,501
    DlgCombo  CBS_DROPDOWNLIST OR CB_ADDSTRING ,10,35,40,25,502
    DlgCombo  CBS_DROPDOWNLIST ,10,55,40,25,503
    CallModalDialog hInstance,0,dlgproc,ADDR lpArgs

    invoke GlobalFree, lpArgs
    ret

main endp


First question:
Why does the first combobox not display as dropdown like the next two??

Second question:
How do I fill the combo box??, since the following doesn't work?
    invoke SendMessage,501,CB_ADDSTRING,0,Offset szStr1
    invoke SendMessage,502,CB_ADDSTRING,0,SADD("Aspen")
    invoke SendMessage,502,CB_ADDSTRING,0,SADD("Oak")
    invoke SendMessage,503,CB_ADDSTRING,0,SADD("Fir")
    invoke SendMessage,503,CB_SETCURSEL,1,0


What I am doeing wrong?

Third question:
how would I go about if I would like to change size, position and caption etc  for in memory dialog controls at run time?

Your help willbe greatly appreciated

hutch--

Klod,

You should get the handle for the combo box to load data into it. Here is one way,, use GetDlgItem() and get the combo box handle first then use SendMessage() to load info into the combo box. There is another technique but I cannot think of it at the moment.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

czDrillard

Another method is SendDlgItemMessage then you don't need handle to control only handle to dialog box and control identifier.

best regards,

czDrillard

Klod

thanks for your replies, I will try each as sooon as I'm back at my computer.
QuoteAnother method is SendDlgItemMessage then you don't need handle to control only handle to dialog box and control identifier.

best regards,

czDrillard

I have tried SendDlgItemMessage without success, but I think I used the ID as parameter in the wrong place