Sign in to follow this  
Followers 0
Newb

_GUICtrlListBox_GetItemData problem

4 posts in this topic

This is the code of combo box and the related values

#Include <GuiComboBoxEx.au3>
Global $ComboTrain = GUICtrlCreateCombo("", 104, 208, 65, 25,0x3)
GuiCtrlSetData(-1,"25%|50%|75%|100%","100%")
_GUICtrlComboBoxEx_SetItemParam($ComboTrain,0,25)
_GUICtrlComboBoxEx_SetItemParam($ComboTrain,1,50)
_GUICtrlComboBoxEx_SetItemParam($ComboTrain,2,75)
_GUICtrlComboBoxEx_SetItemParam($ComboTrain,3,100)

and this is the code for retrieving the data:

MsgBox(0,"oo",_GUICtrlComboBox_GetCurSel($ComboTrain))
MsgBox(0,"oo",_GUICtrlComboBoxEx_GetItemParam($ComboTrain,2))
MsgBox(0,"oo",_GUICtrlComboBoxEx_GetItemParam($ComboTrain,_GUICtrlComboBox_GetCurSel($ComboTrain)))

Resulting message boxes should show the following:

3

75

100

Right?

but instead it shows me the following:

3

0

0

Why?


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites



Newb,

Often the UDF functions require you to use a control created by the UDF rather then the native AutoIt function.

Try creating the combo with _GUICtrlComboBoxEx_Create as in the example for _GUICtrlComboBoxEx_GetItemParam. :)

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

Newb,

Often the UDF functions require you to use a control created by the UDF rather then the native AutoIt function.

Try creating the combo with _GUICtrlComboBoxEx_Create as in the example for _GUICtrlComboBoxEx_GetItemParam. :P

M23

The horror! :)

I tried your advice as i got what you did mean with creating controls created by udf, but:

My combo box has to be created in a GUICtrlCreateTabItem("Player Info") element. So basically it's going to be created into a tab.

So, at first a did this

_GUICtrlComboBox_Create($MainGUI, "", 88, 177, 113, 25,0x3)

And the Combo Box Drawing was assigned to main gui and the combo box appeared over the tab items :)

Then i realized i had to assign to the Tab Item a variable and draw the combo box over that and the code became:

$TabInfo=GUICtrlCreateTabItem("Player Info")
_GUICtrlComboBox_Create($TabInfo, "", 88, 177, 113, 25,0x3

But... the Combo Boxes disappeared at all....

Example code of my boxes

Global $ComboTrainN =_GUICtrlComboBox_Create($TabB, "", 104, 208, 65, 25,0x3)
 _GUICtrlComboBox_BeginUpdate($Tab)
_GUICtrlComboBox_AddString($Tab, "Alt")
_GUICtrlComboBox_AddString($Tab, "Name")
_GUICtrlComboBox_AddString($Tab, "Surname")
_GUICtrlComboBox_AddString($Tab, "Address")
  _GUICtrlComboBox_EndUpdate($Tab)
_GUICtrlComboBoxEx_SetItemParam($ComboTrainN,0,25)
_GUICtrlComboBoxEx_SetItemParam($ComboTrainN,1,50)
_GUICtrlComboBoxEx_SetItemParam($ComboTrainN,2,75)
_GUICtrlComboBoxEx_SetItemParam($ComboTrainN,3,100)

But the outcome is a non drawed Combo box and an empty tab...

Should i recur to other methods (i have in mind some) or this is possible without big troubles?


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

Newb,

If you want to use non-native controls with tabs, I strongly recommend the Tabs tutorial in the Wiki - it will show you exactly how to get UDF-created controls to work happily with tabs. :)

If you still have problems, post a short version of your script with just the tabs and the combos and I will take a look. :)

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

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