sentry07 1 Posted October 11, 2010 I would like to create a control in my GUI that acts like a joystick. My code so far: expandcollapse popup;Sony VISCA Camera Controller #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=D:\My Dropbox\AutoIT Scripts\Sony VISCA Controller\Form1.kxf $Form1 = GUICreate("Form1", 477, 398) $Group1 = GUICtrlCreateGroup(" Camera Configuration ", 8, 8, 460, 105) $Label1 = GUICtrlCreateLabel("Camera IP", 24, 32, 53, 17) $cmbIPAddr = GUICtrlCreateCombo("", 24, 49, 161, 25) $inpPort = GUICtrlCreateInput("", 200, 49, 81, 21) $cmbModel = GUICtrlCreateCombo("", 296, 49, 153, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "BRC-300|BRC-330") $Label2 = GUICtrlCreateLabel("Camera Port", 200, 32, 62, 17) $Label3 = GUICtrlCreateLabel("Camera Model", 296, 32, 72, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Connect", 295, 80, 75, 25, $WS_GROUP) GUICtrlSetState(-1, $GUI_DISABLE) $Button2 = GUICtrlCreateButton("Disconnect", 375, 80, 75, 25, $WS_GROUP) GUICtrlSetState(-1, $GUI_DISABLE) $sldPanTilt = GUICtrlCreateSlider(8, 360, 150, 29) GUICtrlSetLimit(-1, 15, 0) $sldZoom = GUICtrlCreateSlider(160, 360, 150, 29) GUICtrlSetLimit(-1, 7, 0) $Label4 = GUICtrlCreateLabel("Pan/Tilt Speed", 16, 344, 76, 17) $Label5 = GUICtrlCreateLabel("Zoom Speed", 168, 344, 65, 17) $sldPanCtrl = GUICtrlCreatePic("", 158, 144, 161, 161, BitOR($SS_NOTIFY,$SS_SUNKEN,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS)) $sldZoomCtrl = GUICtrlCreateSlider(328, 144, 33, 161, BitOR($TBS_VERT,$TBS_TOP,$TBS_LEFT,$TBS_BOTH,$TBS_NOTICKS,$TBS_ENABLESELRANGE)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sldPanCtrl MsgBox(0,'Hey','Hey Pan Control changed.') Case $sldZoomCtrl MsgBox(0,'Hey','Hey Zoom Control changed.') EndSwitch WEnd So, the $sldPanControl I just made a Pic element because I could make an empty clickable element. I'm sure it will have to change or something. Basically I'd like to create a handle in the center of that box and when it's clicked, _MouseTrap to the boundaries of the box and report back to a function the relative position from the center. Sounds hard. I'm not sure what kind of GUI control I'd even start with. I guess it would act like the AutoIT Window Info finder tool only confined to the control that it is in. Is that the correct direction for me to start? Share this post Link to post Share on other sites
DynamoBen 0 Posted July 8, 2011 Did you ever finish this project? If so do you mind posting code? Share this post Link to post Share on other sites
bart96 0 Posted November 30, 2020 For anyone who is interested in this topic, I created a first version of a ptz / visca over ip application which can be controlled via a PlayStation or Xbox controller: https://github.com/bart96/PTZ-Visca-Playstation-Controller To get a PlayStation controller up and running I used the ScpToolkit drivers: https://github.com/nefarius/ScpToolkit/releases/tag/v1.6.238.16010 Share this post Link to post Share on other sites