
Omega
Members-
Posts
11 -
Joined
-
Last visited
Everything posted by Omega
-
I need to use MouseWheel so it simulates X times Down Key or Up Key in specific moments in my code. I mean I want WheelDown to jump 5 lines down and after that 6 times down, is there a way I can do this? Thanks for the help!
-
Can someone please try this code?, it is supposed to give me more than just "0|2" in the message box. I think that if I initialize a variable as a string, I can't assign it number values, unless they are inserted as a string, am I right? So when I do $c = $b where $b = 0, it is just ignoring it? Thanks for the help. $a = 0 $b = 0 $c = "" For $a = 0 to 2 For $i = 0 to 4 $b = 0 Select Case $c = "" $c = $b Case $c <> "" And $i = 0 $c = $c & "|" & $a & "|" & $b Case Else $c = $c & "|" & $b EndSelect Next Next $c = $c & "|" & ($a - 1) MsgBox(0, "What the Hell", $c)
-
I would like to know if there is a way to change the position of a combobox created with _GUICtrlComboBox_Create, I did this in my script by saving values of comboboxes, deleting and creating new ones with the saved values, but that is too much unnecessary code, when I just have to move them 21 pixels up. Any help is much appreciated! #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <ToolbarConstants.au3> #include <ListViewConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <ComboConstants.au3> #include <ButtonConstants.au3> #include <GuiConstants.au3> #Include <GuiImageList.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiTreeView.au3> #include <GuiToolbar.au3> #include <GuiComboBox.au3> #Include <GuiComboBoxEx.au3> Local $Limit = 99 Local $TreeView_1_Item_1[$Limit + 1] Local $TreeView_2_Item_2[$Limit + 1] Local $ComboBox_1[$Limit + 1][5] Local $Item[$Limit + 1] Local $Number_Width = 40 Local $Set_Width = 160 Local $Rarity_Width = 90 Local $Version_Width = 90 Local $Owned_Width = 60 Local $ForTrade_Width = 60 Local $SortBy_Width = 105 Local $PosX_[5] $Main = GuiCreate("SmartBot v1", 1024, 500, 125, 250, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetFont(8.5, 400, 0, "Comic Sans MS") GUISetIcon("shell32.dll", 14) $MainTab = GUICtrlCreateTab(0, 30, 1024, 480) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) #region Tab_1 $Tab_Item_1 = GUICtrlCreateTabItem("Buying Mode") #region TreeView $Label_1 = GUICtrlCreateLabel("SETS", 5, 60, 56, 12) GUICtrlSetResizing( -1, $GUI_DOCKALL ) $TreeView_1 = GUICtrlCreateTreeView(5, 75, 185, 380, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE ) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH) #region Sets $b = 1 While $b < 15 $TreeView_1_Item_1[$b - 1] = GUICtrlCreateTreeViewItem($b, $TreeView_1) _GUICtrlTreeView_SetIcon($TreeView_1, $TreeView_1_Item_1[$b - 1], "shell32.dll", $B) $b = $b + 1 WEnd #endregion #endregion treeview #region Button_1 and Button2 $Button_Add_1 = GUICtrlCreateButton("Add >>", 196, 250, 75, 25) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKSIZE) $Button_Delete_1 = GUICtrlCreateButton("<< Delete", 196, 280, 75, 25) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKSIZE) #endregion #region ListView $Pre_ListView_1 = GUICtrlCreateListView( "N°", 275, 75, 610, 380, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) $ListView_1 = GUICtrlGetHandle($Pre_ListView_1) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) _GUICtrlListView_SetExtendedListViewStyle($ListView_1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($ListView_1, 0, $Number_Width) $hImage_1 = _GUIImageList_Create(20, 20, 5, 3) $b = 1 While $b < 15 _GUIImageList_AddIcon($hImage_1, "shell32.dll", $B) $b = $b + 1 WEnd _GUICtrlListView_SetImageList($ListView_1, $hImage_1, 1) $ListView_Col_Set_1 = _GUICtrlListView_AddColumn($ListView_1, "Selected Sets", $Set_Width) $ListView_Col_Rarity_1 = _GUICtrlListView_AddColumn($ListView_1, "Rarity", $Rarity_Width) $ListView_Col_Version_1 = _GUICtrlListView_AddColumn($ListView_1, "Version", $Version_Width) $ListView_Col_Owned_1 = _GUICtrlListView_AddColumn($ListView_1, "Owned", $Owned_Width) $ListView_Col_ForTrade_1 = _GUICtrlListView_AddColumn($ListView_1, "For Trade", $ForTrade_Width) $ListView_Col_SortBy_1 = _GUICtrlListView_AddColumn($ListView_1, "Sort By", $SortBy_Width) #endregion ListView #region GUICtrlCreateLabel("HOLA", 225, 75, 56, 12, -1, $WS_EX_MDICHILD) #endregion #endregion #region ToolBar $hToolbar = _GUICtrlToolbar_Create($Main,BitOR($TBSTYLE_TOOLTIPS,$TBSTYLE_FLAT)) _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR) _GUICtrlToolbar_AddButton($hToolbar, 1000, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, 1001, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, 1002, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, 1003, $STD_PROPERTIES) #endregion #region MenuBar $MenuItem_1 = GUICtrlCreateMenu("&File") $MenuItem_1_File_1 = GUICtrlCreateMenuItem("Open", $MenuItem_1) $MenuItem_2 = GUICtrlCreateMenu("&Option") #endregion GUICtrlSetState($Tab_Item_1,$GUI_SHOW) GUISetState(@SW_SHOW, $Main) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $Main Then ExitLoop EndIf Case $msg[0] = $Button_Add_1 $SearchItem_1 = 0 While 1 If _GUICtrlTreeView_GetSelected($TreeView_1, $TreeView_1_Item_1[$SearchItem_1]) = True Or $SearchItem_1 = $Limit Then ExitLoop EndIf $SearchItem_1 = $SearchItem_1 + 1 WEnd Dim $Info[5] For $i = 0 to 4 $Info[$i] = 0 Next If $SearchItem_1 = $Limit Then MsgBox(0, "Message", "You Can't Add More Sets") Else _GUICtrlListView_AddItem($ListView_1, _GUICtrlListView_GetItemCount($ListView_1) + 1, $SearchItem_1) _GUICtrlListView_AddSubItem($ListView_1, _GUICtrlListView_GetItemCount($ListView_1) - 1, _GUICtrlTreeView_GetText($TreeView_1, $TreeView_1_Item_1[$SearchItem_1]), 1) Create_ComboBoxes((-2 + (_GUICtrlListView_GetItemCount($ListView_1) * 21)), _GUICtrlListView_GetItemCount($ListView_1), $Info) GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_DISABLED), -1, $Main) MsgBox(4144, "Message", "Set Added Successfully") GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX), -1, $Main) EndIf GUICtrlSetPos($ComboBox_1[3][0], 230, 150) Case $msg[0] = $Button_Delete_1 $SearchItem_1 = 0 While 1 If _GUICtrlListView_GetItemSelected($ListView_1, $SearchItem_1) = True or $SearchItem_1 = $Limit Then ExitLoop EndIf $SearchItem_1 = $SearchItem_1 + 1 WEnd If $SearchItem_1 = $Limit Then MsgBox(0, "Message", "You Haven't Choosed a Set to Delete") Else For $i = 0 To 4 _GUICtrlComboBox_Destroy($ComboBox_1[$SearchItem_1 + 1][$i]) Next _GUICtrlListView_DeleteItem($ListView_1, $SearchItem_1) For $i = $SearchItem_1 To _GUICtrlListView_GetItemCount($ListView_1) - 1 _GUICtrlListView_SetItem($ListView_1, $i + 1, $i) For $j = 0 To 4 $Info[$j] = _GUICtrlComboBox_GetCurSel($ComboBox_1[$i + 2][$j]) _GUICtrlComboBox_Destroy($ComboBox_1[$i + 2][$j]) Next Create_ComboBoxes((-2 + (($i + 1) * 21)), $i + 1, $Info) Next GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_DISABLED), -1, $Main) MsgBox(4144, "Message", "Set Deleted") GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX), -1, $Main) EndIf Case $msg[0] = $ListView_1 MsgBox(4144, "Message", "Lista") EndSelect WEnd Func Create_ComboBoxes_2($PosX, $PosY, $Section, $Index_1, $Index_2, $Width, $Information) $a = 1 $Data = "" $ComboText = "" For $i = 1 to 5 $Data = $i $ComboText = $ComboText & $Data & "|" $a = $a + 1 Next $ComboBox_1[$Index_1][$Index_2] = _GUICtrlComboBox_Create($ListView_1, StringTrimRight($ComboText, 1), $PosX, $PosY, $Width, 10, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL)) If $Information = 0 Then _GUICtrlComboBox_SetCurSel($ComboBox_1[$Index_1][$Index_2], 0) Else _GUICtrlComboBox_SetCurSel($ComboBox_1[$Index_1][$Index_2], $Information) EndIf GUICtrlDelete($ComboBox_1[$Index_1][$Index_2]) EndFunc Func Create_ComboBoxes($PosY, $Index_1, $Info) $PosX = $Number_Width + $Set_Width $PosX_[0] = $PosX Create_ComboBoxes_2($PosX, $PosY, "Rarity", $Index_1, 0, $Rarity_Width, $Info[0]) $PosX = $PosX + $Rarity_Width $PosX_[1] = $PosX Create_ComboBoxes_2($PosX, $PosY, "Version", $Index_1, 1, $Version_Width, $Info[1]) $PosX = $PosX + $Version_Width $PosX_[2] = $PosX Create_ComboBoxes_2($PosX, $PosY, "Owned", $Index_1, 2, $Owned_Width, $Info[2]) $PosX = $PosX + $Owned_Width $PosX_[3] = $PosX Create_ComboBoxes_2($PosX, $PosY, "ForTrade", $Index_1, 3, $ForTrade_Width, $Info[3]) $PosX = $PosX + $ForTrade_Width $PosX_[4] = $PosX Create_ComboBoxes_2($PosX, $PosY, "SortBy", $Index_1, 4, $SortBy_Width, $Info[4]) EndFunc
-
change the font of a single listview item
Omega replied to lemony's topic in AutoIt GUI Help and Support
Indeed, I didnt know about the new release thanks you... It works fine now, although I will need some time to understand the code -
change the font of a single listview item
Omega replied to lemony's topic in AutoIt GUI Help and Support
Why do I get these errors when I run rasim's script? C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Test.au3(6,28) : ERROR: $FW_BOLD previously declared as a 'Const' Global Const $FW_BOLD = 700 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Test.au3(49,53) : WARNING: $CDDS_PREPAINT: possibly used before declaration. If $iDrawStage = $CDDS_PREPAINT Then ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Test.au3(49,85) : WARNING: $CDRF_NOTIFYITEMDRAW: possibly used before declaration. If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Test.au3(58,49) : WARNING: $CDRF_NEWFONT: possibly used before declaration. Return $CDRF_NEWFONT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Test.au3(49,53) : ERROR: $CDDS_PREPAINT: undeclared global variable. If $iDrawStage = $CDDS_PREPAINT Then ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Test.au3(8,56) : ERROR: _WinAPI_CreateFont(): undefined function. Global $Font = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Test.au3 - 3 error(s), 3 warning(s) -
Create a ComboBox inside the cell of a List
Omega replied to Omega's topic in AutoIt GUI Help and Support
Lol, I completely forgot that adjusting the ImageList size could do the trick; that worked fine for me, but maybe it won't work for other people who don't use images, is there some other way to accomplish the same? Sorry, I am not understanding the part in which I have to create the ComboBoxes with 0+_GUIListView...()*21. -
Create a ComboBox inside the cell of a List
Omega replied to Omega's topic in AutoIt GUI Help and Support
Well, in my very short experience working on my script I found out that GUICtrlCreateListViewItem returns a Control ID, however I created the items with _GUICtrlListView_AddItem and _GUICtrlListView_AddSubItem, what Martin suggested actually worked fine: This is how the code is now. But I am having problems to make ListView Cells bigger so the ComboBoxes do not overlap over the other, please try running my script and adding elements, you will understand me better. #include <GuiConstants.au3> #Include <GuiImageList.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiTreeView.au3> #include <GuiToolbar.au3> #include <GuiComboBox.au3> #Include <GuiComboBoxEx.au3> Local $Limit = 99 Local $TreeView_1_Item_1[$Limit + 1] Local $TreeView_2_Item_2[$Limit + 1] Local $ComboBox_1[$Limit + 1][5] Local $Item[$Limit + 1] Local $Number_Width = 40 Local $Set_Width = 160 Local $Rarity_Width = 90 Local $Version_Width = 90 Local $Owned_Width = 60 Local $ForTrade_Width = 60 Local $SortBy_Width = 105 Local $PosX_[5] $Main = GuiCreate("SmartBot v1", 1024, 500, 125, 250, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetFont(8.5) GUISetIcon("shell32.dll", 14) $MainTab = GUICtrlCreateTab(0, 30, 1024, 480) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) #region Tab_1 $Tab_Item_1 = GUICtrlCreateTabItem("Buying Mode") #region TreeView $Label_1 = GUICtrlCreateLabel("SETS", 5, 60, 56, 12) GUICtrlSetResizing( -1, $GUI_DOCKALL ) $TreeView_1 = GUICtrlCreateTreeView(5, 75, 185, 380, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE ) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH) #region Sets $b = 1 While $b < 15 $TreeView_1_Item_1[$b - 1] = GUICtrlCreateTreeViewItem($b, $TreeView_1) _GUICtrlTreeView_SetIcon($TreeView_1, $TreeView_1_Item_1[$b - 1], "shell32.dll", $B) $b = $b + 1 WEnd #endregion #endregion treeview #region Button_1 and Button2 $Button_Add_1 = GUICtrlCreateButton("Add >>", 196, 250, 75, 25) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKSIZE) $Button_Delete_1 = GUICtrlCreateButton("<< Delete", 196, 280, 75, 25) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKSIZE) #endregion #region ListView $Pre_ListView_1 = GUICtrlCreateListView( "N°", 275, 75, 610, 380, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) $ListView_1 = GUICtrlGetHandle($Pre_ListView_1) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) _GUICtrlListView_SetExtendedListViewStyle($ListView_1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($ListView_1, 0, $Number_Width) $hImage_1 = _GUIImageList_Create(16, 16, 5, 3) $b = 1 While $b < 15 _GUIImageList_AddIcon($hImage_1, "shell32.dll", $B) $b = $b + 1 WEnd _GUICtrlListView_SetImageList($ListView_1, $hImage_1, 1) $ListView_Col_Set_1 = _GUICtrlListView_AddColumn($ListView_1, "Selected Sets", $Set_Width) $ListView_Col_Rarity_1 = _GUICtrlListView_AddColumn($ListView_1, "Rarity", $Rarity_Width) $ListView_Col_Version_1 = _GUICtrlListView_AddColumn($ListView_1, "Version", $Version_Width) $ListView_Col_Owned_1 = _GUICtrlListView_AddColumn($ListView_1, "Owned", $Owned_Width) $ListView_Col_ForTrade_1 = _GUICtrlListView_AddColumn($ListView_1, "For Trade", $ForTrade_Width) $ListView_Col_SortBy_1 = _GUICtrlListView_AddColumn($ListView_1, "Sort By", $SortBy_Width) #endregion ListView #region GUICtrlCreateLabel("HOLA", 225, 75, 56, 12, -1, $WS_EX_MDICHILD) #endregion #endregion #region ToolBar $hToolbar = _GUICtrlToolbar_Create($Main,BitOR($TBSTYLE_TOOLTIPS,$TBSTYLE_FLAT)) _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR) _GUICtrlToolbar_AddButton($hToolbar, 1000, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, 1001, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, 1002, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, 1003, $STD_PROPERTIES) #endregion #region MenuBar $MenuItem_1 = GUICtrlCreateMenu("&File") $MenuItem_1_File_1 = GUICtrlCreateMenuItem("Open", $MenuItem_1) $MenuItem_2 = GUICtrlCreateMenu("&Option") #endregion GUICtrlSetState($Tab_Item_1,$GUI_SHOW) GUISetState(@SW_SHOW, $Main) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $Main Then ExitLoop EndIf Case $msg[0] = $Button_Add_1 $SearchItem_1 = 0 While 1 If _GUICtrlTreeView_GetSelected($TreeView_1, $TreeView_1_Item_1[$SearchItem_1]) = True Or $SearchItem_1 = $Limit Then ExitLoop EndIf $SearchItem_1 = $SearchItem_1 + 1 WEnd Dim $Info[5] For $i = 0 to 4 $Info[$i] = 0 Next If $SearchItem_1 = $Limit Then MsgBox(0, "Message", "You Can't Add More Sets") Else _GUICtrlListView_AddItem($ListView_1, _GUICtrlListView_GetItemCount($ListView_1) + 1, $SearchItem_1) _GUICtrlListView_AddSubItem($ListView_1, _GUICtrlListView_GetItemCount($ListView_1) - 1, _GUICtrlTreeView_GetText($TreeView_1, $TreeView_1_Item_1[$SearchItem_1]), 1) Create_ComboBoxes((-2 + (_GUICtrlListView_GetItemCount($ListView_1) * 17)), _GUICtrlListView_GetItemCount($ListView_1), $Info) GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_DISABLED), -1, $Main) MsgBox(4144, "Message", "Set Added Successfully") GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX), -1, $Main) EndIf GUICtrlSetPos($ComboBox_1[3][0], 230, 150) Case $msg[0] = $Button_Delete_1 $SearchItem_1 = 0 While 1 If _GUICtrlListView_GetItemSelected($ListView_1, $SearchItem_1) = True or $SearchItem_1 = $Limit Then ExitLoop EndIf $SearchItem_1 = $SearchItem_1 + 1 WEnd If $SearchItem_1 = $Limit Then MsgBox(0, "Message", "You Haven't Choosed a Set to Delete") Else For $i = 0 To 4 _GUICtrlComboBox_Destroy($ComboBox_1[$SearchItem_1 + 1][$i]) Next _GUICtrlListView_DeleteItem($ListView_1, $SearchItem_1) For $i = $SearchItem_1 To _GUICtrlListView_GetItemCount($ListView_1) - 1 _GUICtrlListView_SetItem($ListView_1, $i + 1, $i) For $j = 0 To 4 $Info[$j] = _GUICtrlComboBox_GetCurSel($ComboBox_1[$i + 2][$j]) _GUICtrlComboBox_Destroy($ComboBox_1[$i + 2][$j]) Next Create_ComboBoxes((-2 + (($i + 1) * 17)), $i + 1, $Info) Next GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_DISABLED), -1, $Main) MsgBox(4144, "Message", "Set Deleted") GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX), -1, $Main) EndIf Case $msg[0] = $ListView_1 MsgBox(4144, "Message", "Lista") EndSelect WEnd Func Create_ComboBoxes_2($PosX, $PosY, $Section, $Index_1, $Index_2, $Width, $Information) $a = 1 $Data = "" $ComboText = "" For $i = 1 to 5 $Data = $i $ComboText = $ComboText & $Data & "|" $a = $a + 1 Next $ComboBox_1[$Index_1][$Index_2] = _GUICtrlComboBox_Create($ListView_1, StringTrimRight($ComboText, 1), $PosX, $PosY, $Width, 10, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL)) If $Information = 0 Then _GUICtrlComboBox_SetCurSel($ComboBox_1[$Index_1][$Index_2], 0) Else _GUICtrlComboBox_SetCurSel($ComboBox_1[$Index_1][$Index_2], $Information) EndIf GUICtrlDelete($ComboBox_1[$Index_1][$Index_2]) EndFunc Func Create_ComboBoxes($PosY, $Index_1, $Info) $PosX = $Number_Width + $Set_Width $PosX_[0] = $PosX Create_ComboBoxes_2($PosX, $PosY, "Rarity", $Index_1, 0, $Rarity_Width, $Info[0]) $PosX = $PosX + $Rarity_Width $PosX_[1] = $PosX Create_ComboBoxes_2($PosX, $PosY, "Version", $Index_1, 1, $Version_Width, $Info[1]) $PosX = $PosX + $Version_Width $PosX_[2] = $PosX Create_ComboBoxes_2($PosX, $PosY, "Owned", $Index_1, 2, $Owned_Width, $Info[2]) $PosX = $PosX + $Owned_Width $PosX_[3] = $PosX Create_ComboBoxes_2($PosX, $PosY, "ForTrade", $Index_1, 3, $ForTrade_Width, $Info[3]) $PosX = $PosX + $ForTrade_Width $PosX_[4] = $PosX Create_ComboBoxes_2($PosX, $PosY, "SortBy", $Index_1, 4, $SortBy_Width, $Info[4]) EndFunc By the way, how can you change the position of X and Y in a combobox created with _GUICtrlComboBox_Create? I had to do it manually, maybe adding some innecessary code -
Create a ComboBox inside the cell of a List
Omega replied to Omega's topic in AutoIt GUI Help and Support
Thanks for the help, it actually helped me, I am starting to use GUI's so I am not sure to understand the difference between Handle and Control ID, what is the difference or where can I find the difference between them, Id like a good explanation of them, so I can fully understand how _GUIxxx and GUIxxx works. -
Create a ComboBox inside the cell of a List
Omega replied to Omega's topic in AutoIt GUI Help and Support
I already saw Eltorro example, but I cannot test his script since I think the latest autoit changed some settings like include files and global constants + it is too much code to understand (I will do take another look though). Hmmm. I used _GUICtrlListView_Create instead of GUICtrlCreateListView to be able to use icons, when using GUICtrlCreateListView I dunno how to use icons. Thanks for your answer. EDIT: Typo -
Hi, I have been doing some script to manually add items from a treeview to a list, after an item is added to the list, columns 3, 4 and 5 should be composed by ComboBoxes so the user can choose the options for each chosen item, but I dunno if I can add ComboBoxes inside a List Cell. I have also thought that I could simulate it by simply overlapping a ComboBox into the List Area, but it won't Focus. I'd really appreciate any help in this issue, thanks to all who will help Another thing I do not understand is why the second button ($Delete) is not resizing correctly if it has the same style as $Add My Script so far is: #include <GuiConstants.au3> #Include <GuiImageList.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiTreeView.au3> #include <GuiToolbar.au3> #include <GuiComboBox.au3> Local $Limit = 99 Local $TreeItem_Action[$Limit + 1] $Main = GuiCreate("SmartBot v1", 900, 500, 200, 250, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetIcon("shell32.dll", 14) $Tab1 = GUICtrlCreateTab(0, 30, 900, 480) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) #region Tab1 $Tab1 = GUICtrlCreateTabItem("Buying Mode") #region TreeView $Label1 = GUICtrlCreateLabel("Sets", 5, 60, 56, 12) GUICtrlSetResizing( -1, $GUI_DOCKALL ) $TreeView = GUICtrlCreateTreeView(5, 75, 185, 380, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE ) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH) #region Sets $b = 1 While $b < 15 $TreeItem_Action[$b - 1] = GUICtrlCreateTreeViewItem($b, $TreeView) _GUICtrlTreeView_SetIcon($TreeView, $TreeItem_Action[$b - 1], "shell32.dll", $B) $b = $b + 1 WEnd #endregion #endregion treeview #region Button1 and Button2 $Add = GUICtrlCreateButton("Add >>", 196, 250, 75, 25) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE) $Delete = GUICtrlCreateButton("<< Delete", 196, 280, 75, 25) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE) #endregion #region ListView $ListView = _GUICtrlListView_Create($Main, "N°", 275, 75, 605, 380, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP) _GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($ListView, 0, 40) $hImage = _GUIImageList_Create(16, 16, 5, 3) $b = 1 While $b < 15 _GUIImageList_AddIcon($hImage, "shell32.dll", $B) $b = $b + 1 WEnd _GUICtrlListView_SetImageList($ListView, $hImage, 1) $listcolset = _GUICtrlListView_AddColumn($ListView, "Selected Sets", 160) $listcolrarity = _GUICtrlListView_AddColumn($ListView, "Rarity", 90) $listcolversion = _GUICtrlListView_AddColumn($ListView, "Version", 90) $listcolowned = _GUICtrlListView_AddColumn($ListView, "Owned", 60) $listcolfortrade = _GUICtrlListView_AddColumn($ListView, "For Trade", 60) $listcolsortby = _GUICtrlListView_AddColumn($ListView, "Sort By", 105) #endregion ListView #region ToolBar $hToolbar = _GUICtrlToolbar_Create($Main, BitOR($TBSTYLE_TOOLTIPS,$TBSTYLE_FLAT)) _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, 1000, $STD_FILENEW) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, 1002, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, 1002, $STD_HELP) _GUICtrlToolbar_AddButtonSep($hToolbar) #endregion #region MenuBar $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem_File1 = GUICtrlCreateMenuItem("Open", $MenuItem1) $MenuItem_File2 = GUICtrlCreateMenuItem("Save", $MenuItem1) $MenuItem_File2 = GUICtrlCreateMenuItem("Close", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Credits") $MenuItem_File1 = GUICtrlCreateMenuItem("About", $MenuItem2) #endregion #region ComboTest $ComboBox1 = GUICtrlCreateCombo("", 500, 200, 50, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_NOINTEGRALHEIGHT), BitOR($WS_EX_TOPMOST, $WS_EX_APPWINDOW)) GUICtrlSetResizing( -1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH) GUICtrlSetData(-1,"item2|item3","item3") #endregion #endregion GUICtrlCreateTabItem("") GUICtrlSetState($Tab1,$GUI_SHOW) ;~ GUICtrlSetState($ComboBox1,$GUI_SHOW) GUISetState(@SW_SHOW, $Main) While 1 $Msg = GUIGetMsg(1) Select Case $Msg[0] = $GUI_EVENT_CLOSE If $Msg[1] = $Main Then ExitLoop EndIf Case $Msg[0] = $Add $Search = 0 While 1 If _GUICtrlTreeView_GetSelected($TreeView, $TreeItem_Action[$Search]) = True Or $Search = $Limit Then ExitLoop EndIf $Search = $Search + 1 WEnd If $Search = $Limit Then MsgBox(0, "Message", "You Can't Add More Sets") Else _GUICtrlListView_AddItem($ListView, _GUICtrlListView_GetItemCount($ListView) + 1, $Search) _GUICtrlListView_AddSubItem($ListView, _GUICtrlListView_GetItemCount($ListView) - 1, _GUICtrlTreeView_GetText($TreeView, $TreeItem_Action[$Search]), 1) GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_DISABLED), -1, $Main) MsgBox(4144, "Message", "Set Added Successfully") GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX), -1, $Main) EndIf Case $Msg[0] = $Delete $Search = 0 While 1 If _GUICtrlListView_GetItemSelected($ListView, $Search) = True or $Search = $Limit Then ExitLoop EndIf $Search = $Search + 1 WEnd If $Search = $Limit Then MsgBox(0, "Message", "You Haven't Choosed a Set to Delete") Else _GUICtrlListView_DeleteItem($ListView, $Search) For $i = $Search To _GUICtrlListView_GetItemCount($ListView) - 1 _GUICtrlListView_SetItem($ListView, $i + 1, $i) Next GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_DISABLED), -1, $Main) MsgBox(4144, "Message", "Set Deleted") GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX), -1, $Main) EndIf EndSelect WEnd
-
I have found autoit very helpfull in my tasks, however I would like to interact in some way with variables, for example: I use autoit to do some clicking loops, sometimes I require that it clicks 30 times in a certain position, wait and then click 30 times again, but that number of times changes every day. I need to do exactly the same for 30 different tasks, everyone of them with different clicks, so I need some kind of program that when I initialize I can introduce values (for each task) telling autoit how many times it has to click for each different task. I've heard that I can do it with Delphi(how?) , but Id like other opinions too, thanks for the help