Announcement

Collapse
No announcement yet.

ComboBox ... What am I doing wrong ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ComboBox ... What am I doing wrong ?

    The help suggests that:
    items$() Optional dynamic string array containing the initial items to be displayed in the combo box. If the array is omitted, the combo box will be empty upon creation.

    So here's my code with the array but I can't get anything to appear in the combobox.

    What am I doing wrong ?

    Code:
    #COMPILE EXE
    
    #INCLUDE "win32api.inc"
    
    GLOBAL item$()
    
    FUNCTION PBMAIN()
    REDIM PRESERVE item$(3)
    
    item$(0) = "Item Zero"
    item$(1) = "Item One"
    item$(2) = "Item Two"
    item$(3) = "Item Three"
    
     CALL DialogOne
    
    END FUNCTION
    
    
    SUB DialogOne
    #REGISTER NONE
      DIALOG NEW 0, "ComboBox Test", , , 186, 44, &Hc80800& OR %WS_MINIMIZEBOX, 0 TO D1&
    
      CONTROL ADD LABEL,     D1&,  10, "What am I doing wrong ?"  ,   51,   5,  83,   9, 0
      CONTROL ADD COMBOBOX,  D1&,  20, item$()                    ,   47,  18,  91,  13, 0
    
      DIALOG SHOW MODAL D1&
      MSGBOX item$(3)
    END SUB

  • #2
    The problem is subtle... the height of a combobox must include the drop down portion of the box. Change the height parameter from 13 to, say, 113 and you'll find that it works fine.



    -------------
    Lance
    PowerBASIC Support
    ( mailto:[email protected][email protected]</A> )
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thanks Lance!

      Comment


      • #4
        Request this detail to be included in the documentation.

        ------------------

        Comment


        • #5
          Duely noted... thanks!

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            Actually, upon review, this is documented in the height parameter description for the CONTROL ADD COMBOBOX statement, but it is not overly emphasised.

            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment

            Working...
            X