TehWhale Posted October 18, 2008 Share Posted October 18, 2008 So, I have created a iPod like GUI, that uses, 4 GUI's, the iPod itself, the screen, the touch scroll, and the touch scroll button. But, I want to be able to drag my iPod, but keep all the windows together. I was woulding if you kind fellers would like to help me. I don't see how exactly I can do this, because it uses a GUIRegisterMsg, but heres the code if you would like to give it a try. After I get past this step, I will add the media player part to it, and then release it in example scripts if it is good. I posted a picture just to entice you expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <misc.au3> ;~ $iPodMainColor = "12632256" ;Silver ;~ $iPodBkColor = 0xFFFFFF ;White $iPodMainColor = 0x000000 ;Black $iPodBkColor = 0xFF0000 ;Red $Main = GUICreate("TehWhale's iPod", 250, 500, -1, -1, $WS_POPUP) _GuiRoundCorners($Main, 0, 0, 20, 20) GUISetBkColor($iPodMainColor) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState(@SW_SHOW, $Main) $MainPos = WinGetPos($Main) $TouchScrollCenterPos = $MainPos[1]+250 $TouchScroll = GUICreate("", 200, 200, -1, $TouchScrollCenterPos, $WS_POPUP, -1, $Main) _GuiRoundCorners($TouchScroll, 0, 0, 200, 200) GUISetBkColor($iPodBkColor, $TouchScroll) GUISetState(@SW_SHOW, $TouchScroll) $Screen = GUICreate("", 200, 150, -1, $MainPos[1]+30, $WS_POPUP, -1, $Main) _GuiRoundCorners($Screen, 0, 0, 20, 20) GUISetBkColor($iPodBkColor, $Screen) GUISetState(@SW_SHOW, $Screen) $TouchPos = WinGetPos($TouchScroll) $CenterButton = GUICreate("", 75, 75, -1, $TouchScrollCenterPos+60, $WS_POPUP, -1, $Main) _GuiRoundCorners($CenterButton, 0, 0, 75, 75) GUISetBkColor($iPodMainColor, $CenterButton) GUISetState(@SW_SHOW, $CenterButton) while 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3); thanks gafrost Local $XS_pos, $XS_ret, $XS_ret2 $XS_pos = WinGetPos($h_win) $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3) If $XS_ret[0] Then $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1) EndIf EndFunc ;==>_GuiRoundCorners Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) Local $iProc $iProc = DllCall("user32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $Msg, "wparam", $wParam, "lparam", $lParam) $iProc = $iProc[0] If $iProc = $HTCLIENT Then Return $HTCAPTION Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
Minikori Posted October 18, 2008 Share Posted October 18, 2008 You wanna update your code to the actual script so I can run it and see what happens? It would be easier to fix that way. I don't mean the media player and everything, but the variables that aren't declared. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
TehWhale Posted October 18, 2008 Author Share Posted October 18, 2008 You wanna update your code to the actual script so I can run it and see what happens? It would be easier to fix that way. I don't mean the media player and everything, but the variables that aren't declared.Umm, yes, they are? I am using it fine, look at my version in my sig. It works fine. That is the actual script. Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 18, 2008 Share Posted October 18, 2008 I don't get any errors about undeclared variables. I just ran it and I do see the windows move separately but other than that it looks fine. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Minikori Posted October 18, 2008 Share Posted October 18, 2008 Umm, yes, they are? I am using it fine, look at my version in my sig. It works fine. That is the actual script.Oh never mind, didn't copy all the code, my bad. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
TehWhale Posted October 18, 2008 Author Share Posted October 18, 2008 So do either of you have a solution? Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 18, 2008 Share Posted October 18, 2008 This is a code snippet from the radar demo. I hope you can use it. Func _Move() _Draw() $tpos = WinGetPos($hwnd) WinMove($childhwnd, "", $tpos[0] + ($width - 500) / 2, $tpos[1] + $height + 30) Return "GUI_RUNDEFMSG" EndFunc ;==>_Move Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Minikori Posted October 18, 2008 Share Posted October 18, 2008 A bit more complex and also only moves inside windows once you let go of the main: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <misc.au3> ;~ $iPodMainColor = "12632256" ;Silver ;~ $iPodBkColor = 0xFFFFFF ;White $iPodMainColor = 0x000000 ;Black $iPodBkColor = 0xFF0000 ;Red $MainPosLast = 0 $Main = GUICreate("TehWhale's iPod", 250, 500, -1, -1, $WS_POPUP) _GuiRoundCorners($Main, 0, 0, 20, 20) GUISetBkColor($iPodMainColor) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState(@SW_SHOW, $Main) $MainPos = WinGetPos($Main) $MainPosLast = WinGetPos($Main) $TouchScrollCenterPos = $MainPos[1]+250 $TouchScroll = GUICreate("", 200, 200, -1, $TouchScrollCenterPos, $WS_POPUP, -1, $Main) _GuiRoundCorners($TouchScroll, 0, 0, 200, 200) GUISetBkColor($iPodBkColor, $TouchScroll) GUISetState(@SW_SHOW, $TouchScroll) $Screen = GUICreate("", 200, 150, -1, $MainPos[1]+30, $WS_POPUP, -1, $Main) _GuiRoundCorners($Screen, 0, 0, 20, 20) GUISetBkColor($iPodBkColor, $Screen) GUISetState(@SW_SHOW, $Screen) $TouchPos = WinGetPos($TouchScroll) $CenterButton = GUICreate("", 75, 75, -1, $TouchScrollCenterPos+60, $WS_POPUP, -1, $Main) _GuiRoundCorners($CenterButton, 0, 0, 75, 75) GUISetBkColor($iPodMainColor, $CenterButton) GUISetState(@SW_SHOW, $CenterButton) while 1 $msg = GUIGetMsg() $MainPos = WinGetPos($Main) $TouchScrollCenterPos = WinGetPos($TouchScroll) $ScreenPos = WinGetPos($Screen) $CenterButtonPos = WinGetPos($CenterButton) $ToMoveX = $MainPos[0] - $MainPosLast[0] $ToMoveY = $MainPos[1] - $MainPosLast[1] WinMove($TouchScroll, "", $TouchScrollCenterPos[0] + $ToMoveX, $TouchScrollCenterPos[1] + $ToMoveY) WinMove($Screen, "", $ScreenPos[0] + $ToMoveX, $ScreenPos[1] + $ToMoveY) WinMove($CenterButton, "", $CenterButtonPos[0] + $ToMoveX, $CenterButtonPos[1] + $ToMoveY) $MainPosLast = $MainPos Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3); thanks gafrost Local $XS_pos, $XS_ret, $XS_ret2 $XS_pos = WinGetPos($h_win) $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3) If $XS_ret[0] Then $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1) EndIf EndFunc ;==>_GuiRoundCorners Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) Local $iProc $iProc = DllCall("user32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $Msg, "wparam", $wParam, "lparam", $lParam) $iProc = $iProc[0] If $iProc = $HTCLIENT Then Return $HTCAPTION Return $GUI_RUNDEFMSG EndFunc For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
TehWhale Posted October 18, 2008 Author Share Posted October 18, 2008 (edited) Minikori, I Like that! I like the feature of moving the iPod then snapping to it!! Thanks!! Or if I didn't want that feature I could have it poll when it moves. Edited October 18, 2008 by TehWhale Link to comment Share on other sites More sharing options...
Minikori Posted October 18, 2008 Share Posted October 18, 2008 Minikori, I Like that! I like the feature of moving the iPod then snapping to it!! Thanks!!Or if I didn't want that feature I could have it poll when it moves. My code is just a concept, you should definitely improve on it. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
TehWhale Posted October 18, 2008 Author Share Posted October 18, 2008 (edited) My code is just a concept, you should definitely improve on it.I can't find it now, I saw a script awhile ago that if you clicked the titlebar, where it usually stops the script, it keeps going, and now I can't find it. >.<Grr, my head is getting tired of searching. I can't find it! Edited October 18, 2008 by TehWhale Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 18, 2008 Share Posted October 18, 2008 I can't find it now, I saw a script awhile ago that if you clicked the titlebar, where it usually stops the script, it keeps going, and now I can't find it. >.<Grr, my head is getting tired of searching. I can't find it!That was probably: Gui Drag Without pause the script .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
TehWhale Posted October 18, 2008 Author Share Posted October 18, 2008 (edited) That was probably: Gui Drag Without pause the scriptYes, wow! That's it! I searched for: "Gui drag stop", "gui drag stops", "gui drag pause", "gui drag pauses", "move gui stops script" etc. Thanks Wait, that wasn't what I was looking for. I need it to be a real GUI, not that kind of stuff, I may be able to modify it thought, lets hope.EDIT: Edited that script, and does not work. This script is far from perfect, but if I could somehow only WM register the first GUI then it would be fine. Edited October 18, 2008 by TehWhale Link to comment Share on other sites More sharing options...
TehWhale Posted October 18, 2008 Author Share Posted October 18, 2008 Look what I have now! expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <misc.au3> ;~ $iPodMainColor = "12632256" ;Silver ;~ $iPodBkColor = 0xFFFFFF ;White $iPodMainColor = 0x000000 ;Black $iPodBkColor = 0xFF0000 ;Red $MainPosLast = 0 $Main = GUICreate("TehWhale's iPod", 250, 500, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, WinGetHandle("")) TraySetIcon("iPod.ico") TraySetToolTip("iPod") _GuiRoundCorners($Main, 0, 0, 20, 20) GUISetBkColor($iPodMainColor) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState(@SW_SHOW, $Main) $MainPos = WinGetPos($Main) $MainPosLast = WinGetPos($Main) $TouchScrollCenterPos = $MainPos[1] + 250 $TouchScroll = GUICreate("", 200, 200, -1, $TouchScrollCenterPos, $WS_POPUP, $WS_EX_TOPMOST, $Main) $Menu = GUICtrlCreateLabel("MENU", 84, 10) $Forward = GUICtrlCreateLabel("|<<", 10, 92) $Back = GUICtrlCreateLabel(">>|", 175, 92) _GuiRoundCorners($TouchScroll, 0, 0, 200, 200) $PlayPause = GUICtrlCreateLabel("> | |", 94, 175) GUISetBkColor($iPodBkColor, $TouchScroll) GUISetState(@SW_SHOW, $TouchScroll) $Screen = GUICreate("", 200, 150, -1, $MainPos[1] + 30, $WS_POPUP, $WS_EX_TOPMOST, $Main) _GuiRoundCorners($Screen, 0, 0, 20, 20) GUISetBkColor($iPodBkColor, $Screen) GUISetState(@SW_SHOW, $Screen) $TouchPos = WinGetPos($TouchScroll) $CenterButton = GUICreate("", 75, 75, -1, $TouchScrollCenterPos + 60, $WS_POPUP, $WS_EX_TOPMOST, $TouchScroll) _GuiRoundCorners($CenterButton, 0, 0, 75, 75) GUISetBkColor($iPodMainColor, $CenterButton) GUISetState(@SW_SHOW, $CenterButton) While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case -3 Exit EndSwitch $MainPos = WinGetPos($Main) $TouchScrollCenterPos = WinGetPos($TouchScroll) $ScreenPos = WinGetPos($Screen) $CenterButtonPos = WinGetPos($CenterButton) $ToMoveX = $MainPos[0] - $MainPosLast[0] $ToMoveY = $MainPos[1] - $MainPosLast[1] WinMove($TouchScroll, "", $TouchScrollCenterPos[0] + $ToMoveX, $TouchScrollCenterPos[1] + $ToMoveY) WinMove($Screen, "", $ScreenPos[0] + $ToMoveX, $ScreenPos[1] + $ToMoveY) WinMove($CenterButton, "", $CenterButtonPos[0] + $ToMoveX, $CenterButtonPos[1] + $ToMoveY) $MainPosLast = $MainPos WEnd Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3); thanks gafrost Local $XS_pos, $XS_ret, $XS_ret2 $XS_pos = WinGetPos($h_win) $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3) If $XS_ret[0] Then $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1) EndIf EndFunc ;==>_GuiRoundCorners Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) If $hWnd = $Main Then Local $iProc $iProc = DllCall("user32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $Msg, "wparam", $wParam, "lparam", $lParam) $iProc = $iProc[0] If $iProc = $HTCLIENT Then Return $HTCAPTION Return $GUI_RUNDEFMSG EndIf EndFunc ;==>WM_NCHITTEST 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