Jump to content

Combo initialization problem


cappy2112
 Share

Recommended Posts

I've got two combos- both get initialized in the same for loop, with the "Bank1"

all the way up to "Bank32"

I want one combo to start at Bank1, the other to start at Bank32.

After intializing both combos, I call

GUICtrlSetData($Combo_StartingBank, "Bank1", "Bank1")

GUICtrlSetData($Combo_EndingBank, "Bank32", "Bank32")

The contents for Combo_StartingBank is "Bank1"... "Bank32". All is ok.

The contents for Combo_EndingBank is "Bank3"... "Bank34". How did the contents get modified?

In both cases, they both contain 32 items.

Edited by cappy2112
Link to comment
Share on other sites

  • Moderators

Well without the code, you have us doing a guessing game. Nothing with what your provided can anyone tell you what you did (Without guessing).

So a guess:

Dim $ComboInfo1, $ComboInfo2

For $i = 1 To 32
    $ComboInfo1 = $ComboInfo1 & 'Bank' & $i & '|'
Next

For $x = 33 To 64
    $ComboInfo2 = $ComboInfo2 & 'Bank' & $x & '|'
Next

GUICtrlSetData($Combo_StartingBank, $ComboInfo1, "Bank1")
GUICtrlSetData($Combo_EndingBank, $ComboInfo2, "Bank33")

EDIT

Decided to provide an example because, the height of the combo box may be your issue, and again I'm guessing.

#include <guiconstants.au3>

Dim $ComboInfo1, $ComboInfo2
GUICreate('', 200, 100)
$Combo_StartingBank = GUICtrlCreateCombo('', 10, 10, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)
$Combo_EndingBank = GUICtrlCreateCombo('', 10, 30, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)

For $i = 1 To 32
    $ComboInfo1 = $ComboInfo1 & 'Bank' & $i & '|'
Next

For $x = 33 To 64
    $ComboInfo2 = $ComboInfo2 & 'Bank' & $x & '|'
Next

GUICtrlSetData($Combo_StartingBank, $ComboInfo1, "Bank1")
GUICtrlSetData($Combo_EndingBank, $ComboInfo2, "Bank33")

GUISetState()

While 1
    Sleep(10)
WEnd
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Well without the code, you have us doing a guessing game. Nothing with what your provided can anyone tell you what you did (Without guessing).

So a guess:

Dim $ComboInfo1, $ComboInfo2

For $i = 1 To 32
    $ComboInfo1 = $ComboInfo1 & 'Bank' & $i & '|'
Next

For $x = 33 To 64
    $ComboInfo2 = $ComboInfo2 & 'Bank' & $x & '|'
Next

GUICtrlSetData($Combo_StartingBank, $ComboInfo1, "Bank1")
GUICtrlSetData($Combo_EndingBank, $ComboInfo2, "Bank33")

EDIT

Decided to provide an example because, the height of the combo box may be your issue, and again I'm guessing.

#include <guiconstants.au3>

Dim $ComboInfo1, $ComboInfo2
GUICreate('', 200, 100)
$Combo_StartingBank = GUICtrlCreateCombo('', 10, 10, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)
$Combo_EndingBank = GUICtrlCreateCombo('', 10, 30, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)

For $i = 1 To 32
    $ComboInfo1 = $ComboInfo1 & 'Bank' & $i & '|'
Next

For $x = 33 To 64
    $ComboInfo2 = $ComboInfo2 & 'Bank' & $x & '|'
Next

GUICtrlSetData($Combo_StartingBank, $ComboInfo1, "Bank1")
GUICtrlSetData($Combo_EndingBank, $ComboInfo2, "Bank33")

GUISetState()

While 1
    Sleep(10)
WEnd
This is pretty much what I'm doing, except the second for loop is from 1-32 also.

I will try post my code tonight, when I get home from work.

Both combos should contain the same constants, bit one should bave Bank1 for the default, the other should have Bank32 for the default.

The GuiCtrlSetData() calls seem to be causing a problem on my system.

THanks!

Link to comment
Share on other sites

  • Moderators

Like this maybe?

#include <guiconstants.au3>

Dim $ComboInfo1, $ComboInfo2
GUICreate('', 200, 100)
$Combo_StartingBank = GUICtrlCreateCombo('', 10, 10, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)
$Combo_EndingBank = GUICtrlCreateCombo('', 10, 30, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)

For $i = 1 To 32
    $ComboInfo1 = $ComboInfo1 & 'Bank' & $i & '|'
Next

For $x = 32 To 1 Step - 1
    $ComboInfo2 = $ComboInfo2 & 'Bank' & $x & '|'
Next

GUICtrlSetData($Combo_StartingBank, $ComboInfo1, "Bank1")
GUICtrlSetData($Combo_EndingBank, $ComboInfo2, "Bank32")

GUISetState()

While 1
    Sleep(10)
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Like this maybe?

#include <guiconstants.au3>
OK, heres what I have

$Combo_StartingBank = GUICtrlCreateCombo("", 0, 0, 0, 0, $CBS_DROPDOWNLIST)

$Combo_StartingBankLeft = $GroupLeft + 45

GUICtrlSetPos($Combo_StartingBank, $Combo_StartingBankLeft, $GroupTop + 145, 65, 70)

$Combo_EndingBank = GUICtrlCreateCombo("", 0, 0, 0, 0, $CBS_DROPDOWNLIST)

GUICtrlSetPos($Combo_EndingBank, $Combo_StartingBankLeft + 125, $GroupTop + 145, 65, 70)

InitializeComboBoxes($Combo_StartingBank, $Combo_EndingBank, 32)

_GUICtrlComboSetMinVisible ($Combo_StartingBank, 32)

_GUICtrlComboSetMinVisible ($Combo_EndingBank, 32)

GUICtrlSetData($Combo_StartingBank, "Bank1", "Bank1")

GUICtrlSetData($Combo_EndingBank, "Bank32", "Bank32")

Here is InitializeComboBoxes()

Func InitializeComboBoxes($Combo1, $Combo2, $MaxItem)

Local $CurrIdx

For $CurrIndex = 0 To $MaxItem

GUICtrlSetData($Combo1, "Bank" & String($CurrIndex + 1) & "|")

GUICtrlSetData($Combo2, "Bank" & String($CurrIndex + 1) & "|")

Next

Link to comment
Share on other sites

Like this maybe?

#include <guiconstants.au3>

Dim $ComboInfo1, $ComboInfo2
GUICreate('', 200, 100)
$Combo_StartingBank = GUICtrlCreateCombo('', 10, 10, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)
$Combo_EndingBank = GUICtrlCreateCombo('', 10, 30, 180, $GUI_DOCKHEIGHT, $CBS_DROPDOWNLIST)

For $i = 1 To 32
    $ComboInfo1 = $ComboInfo1 & 'Bank' & $i & '|'
Next

For $x = 32 To 1 Step - 1
    $ComboInfo2 = $ComboInfo2 & 'Bank' & $x & '|'
Next

GUICtrlSetData($Combo_StartingBank, $ComboInfo1, "Bank1")
GUICtrlSetData($Combo_EndingBank, $ComboInfo2, "Bank32")

GUISetState()

While 1
    Sleep(10)
WEnd
Ok. Here's how I got it to work, after I saw how you were using GuiGetCtrlData()

Man are these API's wierd

$Combo_StartingBank = GUICtrlCreateCombo("", 0, 0, 0, 0, $CBS_DROPDOWNLIST)

$Combo_StartingBankLeft = $GroupLeft + 45

GUICtrlSetPos($Combo_StartingBank, $Combo_StartingBankLeft, $GroupTop + 145, 65, 70)

$Combo_EndingBank = GUICtrlCreateCombo("", 0, 0, 0, 0, $CBS_DROPDOWNLIST)

GUICtrlSetPos($Combo_EndingBank, $Combo_StartingBankLeft + 125, $GroupTop + 145, 65, 70)

$ComboInitStr = InitializeComboBoxes($ComboInitStr, 32)

_GUICtrlComboSetMinVisible ($Combo_StartingBank, 32) ; needed to allocate > 30 items in a combo

_GUICtrlComboSetMinVisible ($Combo_EndingBank, 32) ; needed to allocate > 30 items in a combo

GUICtrlSetData($Combo_StartingBank, $ComboInitStr, "Bank1")

GUICtrlSetData($Combo_EndingBank, $ComboInitStr, "Bank32")

Func InitializeComboBoxes($InitStr, $MaxItem)

Local $CurrIdx

$InitStr=""

For $CurrIndex = 1 To $MaxItem

$InitStr = $InitStr & "Bank" & String($CurrIndex) & "|"

Next

Return( $InitStr )

EndFunc ;==>InitializeComboBoxes

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...