Hypertrophy Posted June 18, 2009 Author Posted June 18, 2009 I don't know what the "notes code" is. Case $GUI_EVENT_PRIMARYDOWN $aMouse_Pos = MouseGetPos() $sel = -1 For $n = 0 To $lastdragIP GUISwitch($hInput_GUI[$n]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop If $aCursorInfo[4] = $Input[$n] Then $sel = $n ExitLoop EndIf Next If $sel = -1 Then ContinueLoop $aInputGUI_Pos = WinGetPos($hInput_GUI[$sel]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$sel], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd
martin Posted June 18, 2009 Posted June 18, 2009 Case $GUI_EVENT_PRIMARYDOWN $aMouse_Pos = MouseGetPos() $sel = -1 For $n = 0 To $lastdragIP GUISwitch($hInput_GUI[$n]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop If $aCursorInfo[4] = $Input[$n] Then $sel = $n ExitLoop EndIf Next If $sel = -1 Then ContinueLoop $aInputGUI_Pos = WinGetPos($hInput_GUI[$sel]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$sel], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd I think this is what you want. expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include <GUIMENU.au3> Global $idDelete[6], $idSave[6], $idInfo[6] For $i = 0 To 5 $idDelete[$i] = 1000 + $i $idSave[$i] = 1010 + $i $idInfo[$i] = 1020 + $i Next Global $wProcOld Global $lastdragIP = -1 Dim $hInput_GUI[50], $Input[50], $wProcsOld[6], $InputMenu[6], $hMenu[6], $idDelete[6], $idSave[6], $ifInfo[6] Dim $button $gui = GUICreate("", 400, 400) $button = GUICtrlCreateButton("", 50, 50, 50, 20) GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") $toDelete = 0 $iW = -1 Global $totCreated = 0 While 1 $msg = GUIGetMsg(1) $iW = -1 For $i = 0 To 5 If $msg[1] = $hInput_GUI[$i] Then $iW = $i If $msg[0] = $GUI_EVENT_PRIMARYDOWN Then $sel = -1 GUISwitch($hInput_GUI[$iW]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop $aMouse_Pos = MouseGetPos() $aInputGUI_Pos = WinGetPos($hInput_GUI[$iW]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$iW], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd EndIf ExitLoop EndIf Next If $iW >= 0 Or $msg[1] = $gui Then Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $button If $totCreated < 6 Then For $i = 0 To 5 If $hInput_GUI[$i] = 0 Then createNextdragIP($i) $totCreated += 1 ExitLoop EndIf Next Else MsgBox(262144, "MAX Reached", "You are omnly allowed 6 Edits!") EndIf EndSwitch EndIf WEnd DllCallbackFree($wProcHandle) Func createNextdragIP($nw) $start = WinGetPos($gui) $hInput_GUI[$nw] = GUICreate("No. " & $nw + 1, 120, 22, 300 + 25 * $nw, 300 + 25 * $nw, BitOR($WS_POPUP, $WS_SIZEBOX), $WS_EX_TOOLWINDOW) $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $hMenu = _GUICtrlMenu_CreatePopup() $InputMenu[$nw] = $hMenu _GUICtrlMenu_AddMenuItem($hMenu, "Delete", $idDelete[$nw]) _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave[$nw]) _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo[$nw]) ConsoleWrite("90" & @CRLF) GUISetState() $wProcsOld[$nw] = _WinAPI_SetWindowLong(GUICtrlGetHandle($Input[$nw]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) EndFunc ;==>createNextdragIP Func _WindowProc($hWnd, $msg, $wParam, $lParam) Local $wProcOld For $i = 0 To UBound($Input) - 1 If GUICtrlGetHandle($Input[$i]) = $hWnd Then Switch $msg Case $WM_CONTEXTMENU _GUICtrlMenu_TrackPopupMenu($InputMenu[$i], $wParam) Return 0 Case $WM_COMMAND Switch $wParam Case $idDelete[$i] ConsoleWrite("delete" & @CRLF) GUIDelete($hInput_GUI[$i]) $hInput_GUI[$i] = 0 $totCreated -= 1 Case $idSave[$i] ConsoleWrite("-> Save" & @LF) Case $idInfo[$i] ConsoleWrite("-> Info" & @LF) EndSwitch EndSwitch $wProcOld = $wProcsOld[$i] ExitLoop EndIf Next Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _ "hwnd", $hWnd, "uint", $msg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc ;==>_WindowProc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Hypertrophy Posted June 20, 2009 Author Posted June 20, 2009 (edited) Great that did it. Thank you for all your help martin. There is one problem though that I think is caused by this line: If $iW >= 0 Or $msg[1] = $IcoGui Then the line above is placed right before my Switch $msg[0] statement and then my loop code. The problem is that I have moveable objects that are no longer moving, but when I take that line out (and the EndIf that goes with it), the problem disappears. ?? Edited June 20, 2009 by coder09
martin Posted June 20, 2009 Posted June 20, 2009 Great that did it. Thank you for all your help martin. There is one problem though that I think is caused by this line: If $iW >= 0 Or $msg[1] = $IcoGui Then the line above is placed right before my Switch $msg[0] statement and then my loop code. The problem is that I have moveable objects that are no longer moving, but when I take that line out (and the EndIf that goes with it), the problem disappears. ?? I don't understand what you mean by "I have moveable objects that are no longer moving". Do you mean that you can't drag the edits? Does the problem show with the code I posted? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Hypertrophy Posted June 20, 2009 Author Posted June 20, 2009 no i have other moveable object in my main code. ex moveable pictures, etc. and they aren't moving with that line there. I'm trying to understand exactly what that line means so maybe I can edit it to where its not blocking some functions?
martin Posted June 20, 2009 Posted June 20, 2009 no i have other moveable object in my main code. ex moveable pictures, etc. and they aren't moving with that line there. I'm trying to understand exactly what that line means so maybe I can edit it to where its not blocking some functions? It looks to me like that line is probably a mistake anyway. I think it was probably intended to avoid processing $msg[0] if the message was to drag an edit in which case $iW is greater than -1. So I don't think it will do any harm leave the if/then out as you already have done, but you need to make sure you check which window a message comes from if the control ID from different windows could be the same such as $GUI_EVENT_*. It should also work if you used If $iW >= 0 then Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Hypertrophy Posted June 20, 2009 Author Posted June 20, 2009 Yes you're right, just leaving it out everything still works. Thank you.
Hypertrophy Posted June 22, 2009 Author Posted June 22, 2009 martin, how would i delete all the edits at the same time? would it be something like this?: Func DeleteAll() For $i = 0 To 5 GUIDelete($hInput_GUI[$i]) Next $hInput_GUI[$i] = 0 EndFunc ;==>DeleteAllNotes
martin Posted June 23, 2009 Posted June 23, 2009 martin, how would i delete all the edits at the same time? would it be something like this?: Func DeleteAll() For $i = 0 To 5 GUIDelete($hInput_GUI[$i]) Next $hInput_GUI[$i] = 0 EndFunc ;==>DeleteAllNotes For $i = 0 To 5 GUIDelete($hInput_GUI[$i]) $hInput_GUI[$i] = 0 $totCreated -= 1 Next Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now