Jump to content

incepator

Active Members
  • Posts

    242
  • Joined

  • Last visited

Everything posted by incepator

  1. I solved! A rather dubious solution but it works well, I'm happy now If someone makes an elegant function for that, I would appreciate it. #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> AutoItSetOption("GuiOnEventMode", 1) $Form1 = GUICreate("Form1", 420, 234, 425, 205) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $ListView1 = GUICtrlCreateListView("#|text", 8, 8, 394, 206) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100) Global $varrr = 1 For $z = 0 To 5 $item_name_default = GUICtrlCreateListViewItem($z & "|a" & $z, $ListView1) GUICtrlSetBkColor(-1, 0xFFFFFF) $menu = GUICtrlCreateContextMenu($item_name_default) GUICtrlCreateMenuItem("Start", $menu) GUICtrlSetOnEvent(-1, "_Start") GUICtrlCreateMenuItem("Stop", $menu) GUICtrlSetOnEvent(-1, "_Stop") GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateMenuItem("Delete", $menu) GUICtrlSetOnEvent(-1, "_Delete") Next GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func _Start() $iCurrent_Param = _GUICtrlListView_GetItemParam($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1)) GUICtrlSetBkColor($iCurrent_Param, 0xBDF4B5) GUICtrlSetState($iCurrent_Param + 2, $GUI_DISABLE) GUICtrlSetState($iCurrent_Param + 3, $GUI_ENABLE) GUICtrlSetState($iCurrent_Param + 4, $GUI_DISABLE) EndFunc ;==>_Start Func _stop() $iCurrent_Param = _GUICtrlListView_GetItemParam($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1)) GUICtrlSetBkColor($iCurrent_Param, 0xFFFFFF) GUICtrlSetState($iCurrent_Param + 2, $GUI_ENABLE) GUICtrlSetState($iCurrent_Param + 3, $GUI_DISABLE) GUICtrlSetState($iCurrent_Param + 4, $GUI_ENABLE) EndFunc ;==>_stop Func _delete() _GUICtrlListView_DeleteItemsSelected($ListView1) EndFunc ;==>_delete Func _Exit() Exit EndFunc ;==>_Exit
  2. That's exactly the problem. When I delete an item, the index changes, but I do not know how I can save it correctly. I'm working for 5 hours on this code, I can not find a solution. I'll try again... thank you.
  3. Update: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> AutoItSetOption("GuiOnEventMode", 1) $Form1 = GUICreate("Form1", 420, 234, 425, 205) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $ListView1 = GUICtrlCreateListView("#|text", 8, 8, 394, 206) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100) Global $array_start[400] Global $array_stop[400] Global $array_delete[400] For $z = 0 To 5 $item_name_default = GUICtrlCreateListViewItem($z & "|a" & $z, $ListView1) GUICtrlSetBkColor(-1, 0xFFFFFF) $menu = GUICtrlCreateContextMenu($item_name_default) $array_start[$z] = GUICtrlCreateMenuItem("Start", $menu) GUICtrlSetOnEvent(-1, "_Start") $array_stop[$z] = GUICtrlCreateMenuItem("Stop", $menu) GUICtrlSetOnEvent(-1, "_Stop") GUICtrlSetState(-1, $GUI_DISABLE) $array_delete[$z] = GUICtrlCreateMenuItem("Delete", $menu) GUICtrlSetOnEvent(-1, "_Delete") Next GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func _Start() $iCurrent_Param = _GUICtrlListView_GetItemParam($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1)) GUICtrlSetBkColor($iCurrent_Param, 0xBDF4B5) ConsoleWrite("START: " & $array_start[_GUICtrlListView_GetSelectedIndices($ListView1)] & " - " & "STOP: " & $array_stop[_GUICtrlListView_GetSelectedIndices($ListView1)] & " - " & "DELETE: " & $array_delete[_GUICtrlListView_GetSelectedIndices($ListView1)] & @CRLF) GUICtrlSetState($array_start[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_DISABLE) GUICtrlSetState($array_delete[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_DISABLE) GUICtrlSetState($array_stop[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_ENABLE) EndFunc ;==>_Start Func _stop() $iCurrent_Param = _GUICtrlListView_GetItemParam($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1)) GUICtrlSetBkColor($iCurrent_Param, 0xFFFFFF) ConsoleWrite("START: " & $array_start[_GUICtrlListView_GetSelectedIndices($ListView1)] & " - " & "STOP: " & $array_stop[_GUICtrlListView_GetSelectedIndices($ListView1)] & " - " & "DELETE: " & $array_delete[_GUICtrlListView_GetSelectedIndices($ListView1)] & @CRLF) GUICtrlSetState($array_stop[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_DISABLE) GUICtrlSetState($array_delete[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_ENABLE) GUICtrlSetState($array_start[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_ENABLE) EndFunc ;==>_stop Func _delete() _GUICtrlListView_DeleteItemsSelected($ListView1) EndFunc ;==>_delete Func _Exit() Exit EndFunc ;==>_Exit In the console you can see the ID difference
  4. Look, do this: Click "Start" on line 2. Then click on "Delete" on row 1. Then press "Start" again. The problem is that if you delete a row above, the script does not work properly.
  5. I've already seen this, but it's not what I'm looking for ... Thank you.
  6. #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> AutoItSetOption("GuiOnEventMode", 1) $Form1 = GUICreate("Form1", 420, 234, 425, 205) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $ListView1 = GUICtrlCreateListView("#|text", 8, 8, 394, 206) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100) Global $array_start[400] Global $array_stop[400] For $z = 0 To 3 $item_name_default = GUICtrlCreateListViewItem("1|5512", $ListView1) GUICtrlSetBkColor(-1, 0xFFFFFF) $menu = GUICtrlCreateContextMenu($item_name_default) $array_start[$z] = GUICtrlCreateMenuItem("Start", $menu) GUICtrlSetOnEvent(-1, "_Start") $array_stop[$z] = GUICtrlCreateMenuItem("Stop", $menu) GUICtrlSetOnEvent(-1, "_Stop") GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateMenuItem("Delete", $menu) GUICtrlSetOnEvent(-1, "_Delete") Next GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func _Start() $iCurrent_Param = _GUICtrlListView_GetItemParam($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1)) GUICtrlSetBkColor($iCurrent_Param, 0xBDF4B5) GUICtrlSetState($array_start[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_DISABLE) GUICtrlSetState($array_stop[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_ENABLE) EndFunc ;==>_Start Func _stop() $iCurrent_Param = _GUICtrlListView_GetItemParam($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1)) GUICtrlSetBkColor($iCurrent_Param, 0xFFFFFF) GUICtrlSetState($array_stop[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_DISABLE) GUICtrlSetState($array_start[_GUICtrlListView_GetSelectedIndices($ListView1)], $GUI_ENABLE) EndFunc ;==>_stop Func _delete() _GUICtrlListView_DeleteItemsSelected($ListView1) EndFunc ;==>_delete Func _Exit() Exit EndFunc ;==>_Exit Hello, I have a little problem, I would be grateful if someone can help me see what's wrong. I did this script, apparently works fine, but if I press Delete on an item, then the Start and Stop function does not work properly. It's a matter of logic in managing variables, I understand that, but I'm lost in this code ... Thank you !
  7. With the new version of autoit not working, can anyone make an update? Thanks!
  8. little things make the difference GUICtrlSetBkColor(-1, 0xffffff) Thanks for helping! I appreciate!
  9. Yes Jos, Yes, I really need to use that background purple. I have a project I'm working on now, but this little problem has blocked me for 2 days, I really do not find a stable solution. I tried to put a label under that picture, but it still does not work.
  10. Hmmm... is there any solution? the picture is blurred.
  11. Hello, I have a little problem if someone can help me solve this. I have the GUICtrlCreatePic function and one image (.bmp) The problem is that if I set the GUISetBkColor in my GUI, then the clarity of the picture disappears. I do not understand what to do. If you can help me wait for your opinions, thank you! Code: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUISetBkColor(0x8080FF) $Pic1 = GUICtrlCreatePic("asd.bmp", 16, 8, 351, 90) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Please download the image bellow. Thank you! asd.bmp
  12. In new version of autoit..is not working this script.
  13. Hello, Thank you, working fine, but i have a small problem, i have some GUICtrlCreateListViewItem with GUICtrlSetBkColor. Unfortunately this script does not move the color. Func _GUICtrlListView_MoveItems($hListView, $iDirection) Local $aSelected_Indices = _GUICtrlListView_GetSelectedIndices($hListView, 1) If UBound($aSelected_Indices) < 2 Then Return SetError(1, 0, "") If $iDirection <> 1 And $iDirection <> -1 Then Return SetError(2, 0, "") Local $iTotal_Items = _GUICtrlListView_GetItemCount($hListView) Local $iTotal_Columns = _GUICtrlListView_GetColumnCount($hListView) Local $iUbound = UBound($aSelected_Indices) - 1, $iNum = 1, $iStep = 1 Local $iCurrent_Index, $iUpDown_Index, $sCurrent_ItemText, $sUpDown_ItemText Local $iCurrent_Index, $iCurrent_CheckedState, $iUpDown_CheckedState Local $iImage_Current_Index, $iImage_UpDown_Index If ($iDirection = -1 And $aSelected_Indices[1] = 0) Or _ ($iDirection = 1 And $aSelected_Indices[$iUbound] = $iTotal_Items - 1) Then Return SetError(3, 0, "") ControlListView($hListView, "", "", "SelectClear") If $iDirection = 1 Then $iNum = $iUbound $iUbound = 1 $iStep = -1 EndIf For $i = $iNum To $iUbound Step $iStep $iCurrent_Index = $aSelected_Indices[$i] $iUpDown_Index = $aSelected_Indices[$i] + 1 If $iDirection = -1 Then $iUpDown_Index = $aSelected_Indices[$i] - 1 $iCurrent_CheckedState = _GUICtrlListView_GetItemChecked($hListView, $iCurrent_Index) $iUpDown_CheckedState = _GUICtrlListView_GetItemChecked($hListView, $iUpDown_Index) _GUICtrlListView_SetItemSelected($hListView, $iUpDown_Index) For $j = 0 To $iTotal_Columns - 1 $sCurrent_ItemText = _GUICtrlListView_GetItemText($hListView, $iCurrent_Index, $j) $sUpDown_ItemText = _GUICtrlListView_GetItemText($hListView, $iUpDown_Index, $j) If _GUICtrlListView_GetImageList($hListView, 1) <> 0 Then $iImage_Current_Index = _GUICtrlListView_GetItemImage($hListView, $iCurrent_Index, $j) $iImage_UpDown_Index = _GUICtrlListView_GetItemImage($hListView, $iUpDown_Index, $j) _GUICtrlListView_SetItemImage($hListView, $iCurrent_Index, $iImage_UpDown_Index, $j) _GUICtrlListView_SetItemImage($hListView, $iUpDown_Index, $iImage_Current_Index, $j) EndIf _GUICtrlListView_SetItemText($hListView, $iUpDown_Index, $sCurrent_ItemText, $j) _GUICtrlListView_SetItemText($hListView, $iCurrent_Index, $sUpDown_ItemText, $j) #cs If StringInStr($sCurrent_ItemText, "comment") Then GUICtrlSetBkColor($iUpDown_Index, 0xB15bEA) ElseIf StringInStr($sCurrent_ItemText, "loop") Then GUICtrlSetBkColor($iUpDown_Index, 0xB15bEA) EndIf #ce Next _GUICtrlListView_SetItemChecked($hListView, $iUpDown_Index, $iCurrent_CheckedState) _GUICtrlListView_SetItemChecked($hListView, $iCurrent_Index, $iUpDown_CheckedState) _GUICtrlListView_SetItemSelected($hListView, $iUpDown_Index, 0) Next For $i = 1 To UBound($aSelected_Indices) - 1 $iUpDown_Index = $aSelected_Indices[$i] + 1 If $iDirection = -1 Then $iUpDown_Index = $aSelected_Indices[$i] - 1 _GUICtrlListView_SetItemSelected($hListView, $iUpDown_Index) Next Return 1 EndFunc ;==>_GUICtrlListView_MoveItems
  14. Yes, this is very good for me. Thank you very much,
  15. Yes, i know that , but i need another one button "Add Item", when i want to add a new item... Probably, when I press this button, need to be calculated actual position of table and using again the function _GUICtrlListView_SetItemGroupID
  16. Ok @Danyfirex thank you. Forget the example above, I've attached a sample example at the bottom. When press the button "Add Group" I want to add a new group ( _GUICtrlListView_InsertGroup), not a list view ( GUICtrlCreateListViewItem). #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> $act_group = 0 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 263, 173, 384, 268) $Button1 = GUICtrlCreateButton("Add Group", 8, 8, 75, 25) $Button2 = GUICtrlCreateButton("Add item", 88, 8, 75, 25) $ListView1 = GUICtrlCreateListView("Data", 8, 40, 250, 126) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 200) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $act_group = $act_group + 1 GUICtrlCreateListViewItem("Group " & $act_group, $ListView1) Case $Button2 GUICtrlCreateListViewItem("Item", $ListView1) EndSwitch WEnd
  17. @Jos May the force be with me. I have tried in many ways, but I get lost in that equation. Thanks for the reply, I'll be waiting...
  18. Please help me...i need for this example.
  19. Hello friends, I need a little help to finish this code. Although it seems simple, I messed up. I just want to add when I want, groups and items using two separate buttons. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> $z2 = 0 $act_group = 0 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 263, 173, 384, 268) $Button1 = GUICtrlCreateButton("Add Group", 8, 8, 75, 25) $Button2 = GUICtrlCreateButton("Add item", 88, 8, 75, 25) $ListView1 = GUICtrlCreateListView("data", 8, 40, 250, 126) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 200) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _GUICtrlListView_EnableGroupView($ListView1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $act_group = $act_group +1 GUICtrlCreateListViewItem("Wait for new item...", $ListView1) GUICtrlSetState($Button1, $GUI_DISABLE) _GUICtrlListView_InsertGroup($ListView1, -1, $act_group, "Group "&$act_group) _GUICtrlListView_SetItemGroupID($ListView1, 0, $act_group) Case $Button2 If _GUICtrlListView_GetItemCount($ListView1) = 0 Then GUICtrlCreateListViewItem(_GUICtrlListView_GetItemCount($ListView1) + 1, $ListView1) _GUICtrlListView_InsertGroup($ListView1, -1, 1, "Group 1") _GUICtrlListView_SetItemGroupID($ListView1, 0, 1) ElseIf _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetItemCount($ListView1) - 1) = "Wait for new item..." Then _GUICtrlListView_SetItem($ListView1, "1", _GUICtrlListView_GetItemCount($ListView1) - 1) Else $z2 = $z2 + 1 GUICtrlCreateListViewItem(_GUICtrlListView_GetItemCount($ListView1) + 1, $ListView1) For $z = 1 To _GUICtrlListView_GetItemCount($ListView1) + 1 _GUICtrlListView_SetItemGroupID($ListView1, $z2, 1) Next EndIf GUICtrlSetState($Button1, $GUI_ENABLE) EndSwitch WEnd ;_GUICtrlListView_SetGroupInfo($ListView1, 1, "New Group 1", 1, $LVGS_COLLAPSIBLE) ;_GUICtrlListView_SetGroupInfo($ListView1, 2, "New Group 2", 1, $LVGS_COLLAPSIBLE); <--- Not applied Thank you.
  20. I created an image and a video clip to explain better what I need, I am interested only in the interface, not functionality. I want a simple example that I can start to develop this function. The function must be drag and drop a list in another list, in this form. What i need: Video: Image: Thank you!
  21. I am interested only the blue box interface, drag and drop from one side to the other, how can I create an item of that kind? That blue box and rounded corners there is a sector in which you can write something. New video exemple: Thank you!
  22. OK thanks. Sorry for the duplicate, now it is deleted the second thread. I searched on the forum something similar and I not find. Anyway I think this can be done using GDIPlus functions.
  23. Hello, What type of item is this (for exemple loop or alert)? Is not any TreeView and ListView from autoit gui. I can make a similar element? I need add an item to another in this form.Images: I attached a few seconds of video with a kind of element, exist a similar example in autoit? https://vid.me/ec4T Thank you!
  24. The idea is to add an item to another...
  25. I know that! I refer to those fields blue, how can I do this in autoit? eg loop window, and then alert window that can add one to the other.
×
×
  • Create New...