AustrianOak Posted August 5, 2008 Author Share Posted August 5, 2008 I'm a dumbass with this. I still dont get it... How does that have to do with my problem? Link to comment Share on other sites More sharing options...
rasim Posted August 6, 2008 Share Posted August 6, 2008 I'm a dumbass with this. I still dont get it...How does that have to do with my problem?Sorry, but we giving many examples for you. Nobody will not do your work for you. Link to comment Share on other sites More sharing options...
AustrianOak Posted August 6, 2008 Author Share Posted August 6, 2008 made these changes and still no luck. expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <GuiMenu.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> Global $LineCount = 1, $LineLen = 0 Global $lastdragIP = -1 Dim $hInput_GUI[50], $Input[6] Global Enum $idOpen = 1000, $idSave, $idInfo $hGUI = GUICreate("Test", 300, 200) $button = GUICtrlCreateButton("", 50, 50, 50, 20) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($Input), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button If $lastdragIP < 5 Then $lastdragIP += 1 createNextdragIP($lastdragIP) EndIf 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 EndSwitch If _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input)) > $LineCount Then $LineCount = _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input)) $aPos = ControlGetPos($hGUI, "", $input) GUICtrlSetPos($input, $aPos[0], $aPos[1], $aPos[2], $aPos[3] + 15) ElseIf _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input)) < $LineCount Then $LineCount = _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input)) $aPos = ControlGetPos($hGUI, "", $input) GUICtrlSetPos($input, $aPos[0], $aPos[1], $aPos[2], $aPos[3] - 15) EndIf WEnd GUIDelete($hGui) DllCallbackFree($wProcHandle) Func createNextdragIP($nw) $start = WinGetPos($hgui) $hInput_GUI[$nw] = GUICreate("", 120, 22, 100, 100, $WS_POPUP, $WS_EX_TOOLWINDOW) $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN)) $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Delete", $idOpen) _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave) _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo) GUISetState() EndFunc Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF) Local $iCode = BitShift($wParam, 16) Switch $iCode Case $EN_UPDATE Local $iLen = _GUICtrlEdit_LineLength($iIDFrom) Local $aInputPos = ControlGetPos($hWnd, "", $iIDFrom) Local $aWinPos = WinGetPos($hWnd) If ($aInputPos[2] / $iLen) < 6.5 Then WinMove($hWnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + 10, $aWinPos[3]) GUICtrlSetPos($iIDFrom, $aInputPos[0], $aInputPos[1], $aInputPos[2] + 10, $aInputPos[3]) ElseIf ($aInputPos[2] / $iLen) > 6.5 Then WinMove($hWnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] - 10, $aWinPos[3]) GUICtrlSetPos($iIDFrom, $aInputPos[0], $aInputPos[1], $aInputPos[2] - 10, $aInputPos[3]) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _WindowProc($hWnd, $Msg, $wParam, $lParam) Switch $hWnd Case GUICtrlGetHandle($Input) Switch $Msg Case $WM_CONTEXTMENU _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) Return 0 Case $WM_COMMAND Switch $wParam Case $idOpen GUICtrlDelete($Input) Case $idSave ConsoleWrite("-> Save" & @LF) Case $idInfo ConsoleWrite("-> Info" & @LF) EndSwitch EndSwitch EndSwitch Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _ "hwnd", $hWnd, "uint", $Msg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc Link to comment Share on other sites More sharing options...
AustrianOak Posted August 6, 2008 Author Share Posted August 6, 2008 And I'm not trying to get you to tell me to answer. I'm trying to solve this myself but I have no idea what PsaltyDS meant by a local variable input... Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 6, 2008 Share Posted August 6, 2008 And I'm not trying to get you to tell me to answer. I'm trying to solve this myself but I have no idea what PsaltyDS meant by a local variable input...Then you should have at least cleaned it up enough so it would pass syntax check: Running AU3Check (1.54.13.0) from:C:\Program Files\AutoIt3C:\temp\Test.au3(117,40) : WARNING: $hMenu: possibly used before declaration. _GUICtrlMenu_TrackPopupMenu($hMenu, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^What I meant was the variables are declared inside functions, so they are local to those functions. You were then trying to access those same variables in another function, where it doesn't exist. The second attempt cleaned up $nw, but $hMenu is still the same. This could be fixed by just putting "Global $hMenu" near the top of your script, but you still have a pretty strange GUI, and I don't understand at all what it's supposed to do. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
AustrianOak Posted August 6, 2008 Author Share Posted August 6, 2008 ok so I understand what you're saying now and made the change of putting Global $hMenu at the top with my other globals and there still is no custom context menu... hmm.. Link to comment Share on other sites More sharing options...
AustrianOak Posted August 6, 2008 Author Share Posted August 6, 2008 (edited) is the problem because i should be creating the popup() outside of the function? Edited August 6, 2008 by IWantIt Link to comment Share on other sites More sharing options...
AustrianOak Posted August 7, 2008 Author Share Posted August 7, 2008 Should I create the popup menu outside the function? When I added Global $hMenu the custom context menu did not appear. Link to comment Share on other sites More sharing options...
AustrianOak Posted August 9, 2008 Author Share Posted August 9, 2008 bump Link to comment Share on other sites More sharing options...
DirtDBaK Posted August 9, 2008 Share Posted August 9, 2008 By the way I think we should expand the menus to have colors and Icons like Holger did ... What do you guys think? [center][/center] Link to comment Share on other sites More sharing options...
AustrianOak Posted August 9, 2008 Author Share Posted August 9, 2008 Sounds like a great idea to me...anything to furtherly customize this menu can be great. Link to comment Share on other sites More sharing options...
AustrianOak Posted August 10, 2008 Author Share Posted August 10, 2008 (edited) Still need help with my problem a few posts back Edit: When you said adding Global $hMenu would fix my problem it didn't. The custom context menu still doesn't show... Edited August 10, 2008 by IWantIt Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 11, 2008 Share Posted August 11, 2008 (edited) Still need help with my problem a few posts backEdit: When you said adding Global $hMenu would fix my problem it didn't. The custom context menu still doesn't show...Let me clarify: This could be fixed by just putting "Global $hMenu" near the top of your script, ... "This" only meant the syntax check failure, which should have been corrected before posting it.The operative part is this: ...but you still have a pretty strange GUI, and I don't understand at all what it's supposed to do. This has not changed, so I can't help you. Edited August 11, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
AustrianOak Posted August 11, 2008 Author Share Posted August 11, 2008 Me having a strange GUI shouldnt matter. Its not strange at all, its simple. All there is to it is you click a button which makes a draggable input. Then you can click the button and it will make ANOTHER draggable input. You can move all of them around anywhere. What I need to do is to be able to right click on any of them and have the custom menu pop-up. Pretty simple I think. Tell me if I didn't explain it well enough. Link to comment Share on other sites More sharing options...
BrettF Posted August 11, 2008 Share Posted August 11, 2008 Mate, some advice. Stop shooting the other that try to help you. The only way you're going to get help, is if you are nice, courteous, and except the examples being given. Also, you've got to put an ounce of effort in. That way we can see you are at least attempting to take on board what we are showing you. And one other thing, no one will do it for you, and serve it on a silver platter... Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
AustrianOak Posted August 11, 2008 Author Share Posted August 11, 2008 Tell me how my last post wasnt nice. Seriously, point out something that i said that could offend anyone. Link to comment Share on other sites More sharing options...
BrettF Posted August 12, 2008 Share Posted August 12, 2008 I will not enter into any argument. But since you asked, 2 posts which stick out...I'm a dumbass with this. I still dont get it...How does that have to do with my problem?What was the point of that?Edit: And who would want default menu entries? Let's try to stay far away form that otherwise this great example is useless. Whoever wants default menu entries can stay with the system context menu.Many examples are done specifically for the OP's needs... Many examples I would do, would be done just for them. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
AustrianOak Posted September 4, 2008 Author Share Posted September 4, 2008 Bump Link to comment Share on other sites More sharing options...
BrettF Posted September 4, 2008 Share Posted September 4, 2008 Missing things. Your current code for starters... What have you tried during your break? Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
AustrianOak Posted September 5, 2008 Author Share Posted September 5, 2008 This: expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <GUIMenu.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <EditConstants.au3> #include <WinAPI.au3> Dim $hInput_GUI[6], $Input[6] Global $lastdragIP = -1 Global Enum $idOpen = 1000, $idSave, $idInfo $GUI = GUICreate("Test", 300, 300) $button5 = GUICtrlCreateButton("", 100, 200, 40, 25) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($Input), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button5 If $lastdragIP < 5 Then $lastdragIP += 1 createNextdragIP($lastdragIP) EndIf Case $msg = $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 EndSelect WEnd Func createNextdragIP($nw) $start = WinGetPos($GUI) $hInput_GUI[$nw] = GUICreate("", 120, 22, $start[0]+30, $start[1]+200, $WS_POPUP, $WS_EX_TOOLWINDOW) $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN)) $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Delete", $idOpen) _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave) _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo) GUISetState() WinSetOnTop($hInput_GUI[$nw], "", 1) EndFunc ;==>createNextdragIP Func _WindowProc($hWnd, $Msg, $wParam, $lParam) Switch $hWnd Case GUICtrlGetHandle($Input) Switch $Msg Case $WM_CONTEXTMENU _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) Return 0 Case $WM_COMMAND Switch $wParam Case $idOpen GUICtrlDelete($Input) Case $idSave ConsoleWrite("-> Save" & @LF) Case $idInfo ConsoleWrite("-> Info" & @LF) EndSwitch EndSwitch EndSwitch Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _ "hwnd", $hWnd, "uint", $Msg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc Link to comment Share on other sites More sharing options...
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