Sign in to follow this  
Followers 0
Mikeman27294

[SOLVED] - Problems with Dropdown and $CBS_DROPDOWN

4 posts in this topic

#1 ·  Posted (edited)

Hey everyone, I am trying to make a combo box with which the user cannot edit the contents, like the dropdown from the image below.

Posted Image

The problem is though, that I have tried $CBS_DROPDOWN and that makes no change. Infact, no styles are making any changes to my dropdown box. I have ensured that I have attached the correct include file (ComboConstants.au3) and I get no errors.

I recently installed the most recent release of AutoIT, and I am unsure as to whether this is when the problem started (I rarely use combo boxes) but I am quite sure that it worked properly in one of my older scripts.

Can anybody help?

Thanks.

Edited by Mikeman27294

Share this post


Link to post
Share on other sites



I used this BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DISABLENOSCROLL) as the style of a combo in a project I was working on. It disabled the edit functioning of the combo, but didn't disable the control itself. I can't remember where I found out about this, because the description for that style doesn't say anything about it disabling the control that way.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Mikeman27294,

You need to use the $CBS_DROPDOWNLIST style - like this: :)

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "One|Two|Three|Four|Five")

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

I agree the description in the Help file is not the best - but that is how MicroSoft describe it! ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Sorry BrewManNH, that didn't give me the style I wanted. However, Melba23's suggestion of $CBS_DROPDOWNLIST (Rather than $CBS_DROPDOWN) is ecactly what I am looking for.

Thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • jloyzaga
      By jloyzaga
      I'm trying to read an excel spreadsheet(SWW_TestFlow, Worksheet=Controller) and creating a dropdown list from all the cell values within a specific column("G").   
      I would like to have the dropdown behave in such a way as to allow multiple selections and for all those selections to be written to a file.
      I attached a file I started with to experiment with gui and controls etc but got totally lost.......
      Can somebody help me?
      Joe
      multi-new.au3
    • Cormin
      By Cormin
      I've never worked with an array or dropdown menu before and I can't seem to wrap it around my head this morning.  Maybe I just need more coffee but I'm trying to populate a GUI dropdown menu with section names of a .ini file.  Here is what I have for this part but I don't know where to go from here.  The msgbox thing was only testing it but I kinda got stuck here.
       
      local $aSectionnames = IniReadSectionNames(@DesktopDir & "\Scripts\BatteryConfig.ini") if Not @error Then For $i = 1 to $aSectionnames[0] MsgBox($MB_SYSTEMMODAL, "Test", $aSectionnames[$i]) Next EndIf  
      Here is my very basic dropdown menu I want to populate
       
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 413, 213, 192, 124) $Combo1 = GUICtrlCreateCombo("Combo1", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Button1", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
       
      Thanks!
    • oddlogic
      By oddlogic
      I was working with an intranet site today and there is a huge combo box that you can click on where it says "All", underneath 'Model' (Capture.png). After selecting a model, there are numerous lines to choose from that do other things, which I can work with perfectly well. I have to deal with other pages similar to this one, but on this particular page the only "firing" event is the choice of the dropdown menu. 
      Here is the source for that particular field:  (The id we care about is "cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel")
      <table cellspacing="0" class="rgMasterTable" id="cphBody_rgdModelDrawing_ctl00" style="width:100%;table-layout:auto;empty-cells:show;"> <colgroup> <col /> <col /> <col /> <col /> <col style="width:45px" /> <col style="width:30px" /> </colgroup> <thead> <tr> <th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl01&#39;,&#39;&#39;)">Model</a></th><th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl02&#39;,&#39;&#39;)">Drawing</a></th><th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl03&#39;,&#39;&#39;)">Station Number</a></th><th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl04&#39;,&#39;&#39;)">Sort Order</a></th><th scope="col" class="rgHeader">&nbsp;</th><th scope="col" class="rgHeader">&nbsp;</th> </tr><tr class="rgFilterRow"> <td style="white-space:nowrap;"> <div id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel" class="RadComboBox RadComboBox_Default" style="width:200px;"> <table summary="combobox" style="border-width:0;border-collapse:collapse;table-layout:fixed;width:100%"> <tr class="rcbReadOnly"> <td style="margin-top:-1px;margin-bottom:-1px;width:100%;" class="rcbInputCell rcbInputCellLeft"><input name="ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl02$rcbModel" type="text" class="rcbInput" id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel_Input" value="All" style="display: block;" readonly="readonly" /></td> <td style="margin-top:-1px;margin-bottom:-1px;" class="rcbArrowCell rcbArrowCellRight"><a id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel_Arrow" style="overflow: hidden;display: block;position: relative;outline: none;">select</a></td> </tr> </table> <div class="rcbSlide" style="z-index:6000;"><div id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel_DropDown" class="RadComboBoxDropDown RadComboBoxDropDown_Default " style="float:left;display:none;"><div class="rcbScroll rcbWidth" style="height:200px;width:100%;"><ul class="rcbList" style="list-style:none;margin:0;padding:0;zoom:1;"><li class="rcbItem ">All</li><li class="rcbItem ">019-208-17-3Y</li><li class="rcbItem ">019-208-17-6Y</li><li class="rcbItem ">124-ATR-3/0-L10</li><li class="rcbItem ">124-ATR-3/0-L10M</li><li class="rcbItem ">124-ATR-3/0-L10S</li><li class="rcbItem ">124-ATR-3/0-L13</li><li class="rcbItem ">124-ATR-3/0-L15</li><li class="rcbItem ">124-ATR-3/0-L15M</li><li class="rcbItem ">124-ATR-3/0-L15S</li><li class="rcbItem ">124-ATR-3/0-L18</li><li class="rcbItem ">124-ATR-3/0-L20</li><li class="rcbItem ">124-ATR-3/0-L25</li><li class="rcbItem ">124-ATR-3/0-L30</li><li class="rcbItem ">124-ATR-4/0-L10</li><li class="rcbItem ">124-ATR-4/0-L13</li> .....there are thousands of these parts, listed like this. then at the end of the li tag list.... <script type="text/javascript"> function ModelIndexChanged(sender, args) { var tableView = $find("cphBody_rgdModelDrawing_ctl00"); tableView.filter("ModelDrawing_ModelID", args.get_item().get_value(), "EqualTo"); } </script>  
      I am able to read and write to the dropdown using either _IEGetFormCollection (by index because the page always has the same input indices) or _IEGetObjectById, and then using _IEFormElementSetValue. What I cannot seem to do is to use the "child" method whereby one would address the list object by using _IEFormGetCollection. That returns an error code of either 7 or 2 (it's been a long day. I forget which)
      The problem with writing to the dropdown with setValue is that the form doesn't fire after you change the list box. In fact, it won't even fire if a user clicks on it, then hits return. It is only by changing the value manually and then changing it again that you can get the part number that you want to display as it should. 
      How should one go about selecting the dropdown value that would allow the page to fire as it should? 
       

      ;this works but doesn't fire - I use formCollection because there are other things that I have to use fields for in this document and the indices don't change Local $oForm = _IEFormGetCollection($oIE, 0) $modelTextBox = _IEFormElementGetCollection($oForm, 7) _IEFormElementSetValue($modelTextBox, $chargerPartNumber)  
    • rm4453
      By rm4453
      I can't seem to figure out how to select  Category and Sub-Category with autoit from a Dropdown in IE.
      I am building this for a private site so I will be unable to give you a link to it, however I have found a form online that is almost exactly the same as the one I am using... Here is the link to it: https://www.ksl.com/index.php?nid=1126
      I need to somehow select a Category and Sub-Category... the site I will be using it on has quite an extensive list for Categories and Sub-Categories so I will need to be able to make sure it is working periodically and posting to the correct categories... "Am building an auto blogger type of software for private use Pls let me know if this is against forum rules!"
          In advanced Thank You for all of your help!
      "P.S. This is part of the code I have figured out so far... (You will have to login to see the form I am talking about...)
      ;Set category! $cat = _IEGetObjById($ie, "cat") ;Set subcategory! $subcat = _IEGetObjByID($ie, "subcat") ;Time to submit the form! $oButtons = _IETagnameGetCollection($ie, "input") For $oButton in $oButtons If String($oButton.value) = "Submit" Then _IEAction($oButton, "click") MsgBox("Success", "Button Clicked", "Next Step!") ExitLoop Else MsgBox("Failed", "The Button " & $oButton & "Does Not Have The Value", "Try Again!") EndIf Next  
    • Joep86
      By Joep86
      Hi, 
      I just started recently with AutoIT and I am trying to make two dropdownlists where the selectable values of the second dropdownlist will be depending on what is selected on the first one.
      For example: 
      Dropdown 1                 Dropdown 2                   
      xxx                =>             01-15    ("01" , "02" ,"03" , ...)                    
      yyy                =>             a - f       ("a" , "b" ,"c" ,"d" ,"e" ,"f" ) 
      zzz                =>             "new", "old", "spare"
       
      I started with this code that I've found in this Forum:
      #include <GUIConstantsEx.au3>
      ; Here is the array
      Global $aArray[6] = ["SORT", "PCM", "UNIF", "KKE", "GMS", "CDY"]
      ; And here we get the elements into a list
      $sList = ""
      For $i = 0 To UBound($aArray) - 1
          $sList &= "|" & $aArray[$i]
      Next
      ; Create a GUI
      #include <GUIConstantsEx.au3>
      $hGUI = GUICreate("DropDown", 500, 500)
      ; Create the combo
      $hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20)
      ; And fill it
      GUICtrlSetData($hCombo, $sList)
      GUISetState()
      While 1
          Switch GUIGetMsg()
              Case $GUI_EVENT_CLOSE
                  Exit
          EndSwitch
       WEnd
       
       
      Any idea how to start on this one...
      thanks upfront