Jump to content

Read Only Combo is not working...


Recommended Posts

I have tried using both $CBS_DROPDOWN & $CBS_DROPDOWNLIST and neither of them stop editing withing the Combo.

Here is my code as plain as it can get without losing any integrity.

#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$ScreenX = @DesktopWidth / 2
$ScreenY = @DesktopHeight / 1.5
Local $Array[5][4] = [ _
["Pick A", 4, 10, 10], _
["Pick B", 7, 10, 10], _
["Pick C", 11, 10, 10], _
["Pick D", 20, 10, 10], _
["Pick Your Nose", 100, 10, 10]]
 
Window()
Func Window()
$My_GUI = GUICreate("", $ScreenX, $ScreenY, 0, 0)
GUISetBkColor(0x880000)
$BtnA = GUICtrlCreateButton("", $ScreenX / 2, $ScreenY - 122, 170)
$BtnB = GUICtrlCreateButton("", $ScreenX / 4, $ScreenY - 98, 172)
$BtnC = GUICtrlCreateButton("", $ScreenX / 2, $ScreenY - 98, 170)
$Btn1 = GUICtrlCreateButton("", $ScreenX - 153, $ScreenY - 122, 153, 18)
$Btn2 = GUICtrlCreateButton("", $ScreenX - 170, $ScreenY - 122, 18, 105, $BS_MULTILINE)
$Btn3 = GUICtrlCreateButton("", $ScreenX - 18, $ScreenY - 105, 18, 105, $BS_MULTILINE)
$Btn4= GUICtrlCreateButton("", $ScreenX - 170, $ScreenY - 18, 152, 18)
$Btn5 = GUICtrlCreateButton("", $ScreenX - 153, $ScreenY - 105, 136, 44)
$Btn6 = GUICtrlCreateButton("", $ScreenX - 153, $ScreenY - 61, 136, 44)
$ComboA = GUICtrlCreateCombo("", $ScreenX / 4, $ScreenY - 120, 170, $CBS_DROPDOWN)
GUICtrlSetData($ComboA, $Array[0][0] & "|" & $Array[1][0] & "|" & $Array[2][0] & "|" & $Array[3][0] & "|" & $Array[4][0], $Array[0][0])
 
$Input1 = GUICtrlCreateInput("Input Control", $ScreenX / 4, $ScreenY - 70, $ScreenX / 2, 60, $ES_READONLY)
GUISetState(@SW_SHOW)
 
While 1
 
  $msg = GUIGetMsg()
 
  Select
 
  Case $msg = $GUI_EVENT_CLOSE
   Exit
 
  EndSelect
 
WEnd
EndFunc

:):mellow:

Link to comment
Share on other sites

Incorrect number of parameters in function call. - The height was set to $CBS_DROPDOWN :mellow:

Also your controls are overlapping: I suggest you avoid that.

.

#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$ScreenX = @DesktopWidth / 2
$ScreenY = @DesktopHeight / 1.5
Local $Array[5][4] = [ _
["Pick A", 4, 10, 10], _
["Pick B", 7, 10, 10], _
["Pick C", 11, 10, 10], _
["Pick D", 20, 10, 10], _
["Pick Your Nose", 100, 10, 10]]
 
Window()
Func Window()
$My_GUI = GUICreate("", $ScreenX, $ScreenY, 0, 0)
GUISetBkColor(0x880000)
$BtnA = GUICtrlCreateButton("", $ScreenX / 2, $ScreenY - 122, 170)
$BtnB = GUICtrlCreateButton("", $ScreenX / 4, $ScreenY - 98, 172)
$BtnC = GUICtrlCreateButton("", $ScreenX / 2, $ScreenY - 98, 170)
$Btn1 = GUICtrlCreateButton("", $ScreenX - 153, $ScreenY - 122, 153, 18)
$Btn2 = GUICtrlCreateButton("", $ScreenX - 170, $ScreenY - 122, 18, 105, $BS_MULTILINE)
$Btn3 = GUICtrlCreateButton("", $ScreenX - 18, $ScreenY - 105, 18, 105, $BS_MULTILINE)
$Btn4= GUICtrlCreateButton("", $ScreenX - 170, $ScreenY - 18, 152, 18)
$Btn5 = GUICtrlCreateButton("", $ScreenX - 153, $ScreenY - 105, 136, 44)
$Btn6 = GUICtrlCreateButton("", $ScreenX - 153, $ScreenY - 61, 136, 44)
; >>>>>>>
$ComboA = GUICtrlCreateCombo("", $ScreenX / 3, $ScreenY - 180, 170, Default, $CBS_DROPDOWNLIST) ; You forgot the height parameter
GUICtrlSetData($ComboA, $Array[0][0] & "|" & $Array[1][0] & "|" & $Array[2][0] & "|" & $Array[3][0] & "|" & $Array[4][0])
 
$Input1 = GUICtrlCreateInput("Input Control", $ScreenX / 4, $ScreenY - 70, $ScreenX / 2, 60, $ES_READONLY)
 
GUISetState(@SW_SHOW)
 
While 1
 
  $msg = GUIGetMsg()
 
  Select
 
  Case $msg = $GUI_EVENT_CLOSE
   Exit
 
  EndSelect
 
WEnd
EndFunc

You should use Use $CBS_DROPDOWNLIST for a read only combo.

Edited by czardas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...