Wombat Posted January 5, 2014 Share Posted January 5, 2014 Alright So I've been trying to figure out a way to set a gui so that no matter the resolution it will show its controls correctly. here a sample of what i need: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region GUI $hGUI = GUICreate("Test", 699, 199, Default, Default) $Label1 = GUICtrlCreateLabel("Label1", 245, 73, 36, 17) $Label2 = GUICtrlCreateLabel("Label2", 302, 73, 36, 17) $Label3 = GUICtrlCreateLabel("Label3", 360, 73, 36, 17) $Label4 = GUICtrlCreateLabel("Label4", 417, 73, 36, 17) $Label5 = GUICtrlCreateLabel("Label5", 246, 109, 36, 17) $Label6 = GUICtrlCreateLabel("Label6", 303, 109, 36, 17) $Label7 = GUICtrlCreateLabel("Label7", 361, 109, 36, 17) $Label8 = GUICtrlCreateLabel("Label8", 418, 109, 36, 17) GUISetState(@SW_SHOW) #EndRegion While 1 sleep(10) WEnd I need to achive something similar without setting explicit LEFT and TOP values for the controls. The finished script will have a different gui size & placement, so it can be based on the windows values. It needs to be based on @Desktopwidth and @Desktopheight. Lastly, I've exhausted all of my ideas and couldn't find the right keywords to plug into google to dig for answers. I'll wait patiently for a response, thank you. Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
mLipok Posted January 5, 2014 Share Posted January 5, 2014 (edited) I wonder if you think the same as you me. I once had problems with changing the appearance of the window. Part of the problem solved by: GUICtrlSetResizing(-1, $GUI_DOCKALL) Edited January 5, 2014 by mlipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 5, 2014 Moderators Share Posted January 5, 2014 Wombat,Look at GUICtrlSetResizing or the Opt equivalent - this allows the GUI to be set to whatever size you require and the controls alter size automatically. Here is an example I posted a while ago which also maintains the same aspect ratio: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Set resize mode for controls Opt("GUIResizeMode", $GUI_DOCKAUTO) $hGUI = GUICreate("Test", 500, 300, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU)) $cButton_1 = GUICtrlCreateButton("Test 1", 10, 10, 80, 30) $cButton_2 = GUICtrlCreateButton("Test 2", 10, 50, 80, 30) GUISetState() GUIRegisterMsg($WM_SIZING, "_WM_SIZING") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZING($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $wParam If $hWnd = $hGUI Then Local $iNew_H, $iNew_W Local $sRect = DllStructCreate("Int[4]", $lParam) Local $iLeft = DllStructGetData($sRect, 1, 1) Local $iTop = DllStructGetData($sRect, 1, 2) Local $iRight = DllStructGetData($sRect, 1, 3) Local $iBottom = DllStructGetData($sRect, 1, 4) ; Keep the same aspect ratio Switch $wParam ; drag side or corner Case 1, 2 ; $WMSZ_LEFT, $WMSZ_RIGHT $iNew_H = Int(($iRight - $iLeft) * 300 / 500) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $iNew_H, 4) Case Else $iNew_W = Int(($iBottom - $iTop) * 500 / 300) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $iNew_W, 3) EndSwitch EndIf EndFuncYou can even get the font to adjust size as well by using a message handler - but you will have to wait until tomorrow if you want an example of that as I will have to strip it out of another script. M23 Wombat and SupaNewb 2 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Wombat Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) That's deffinitely soudning like the answer to my question. I haven't implemented it but I am going to research the functiona dn its capabilities immediately after this post, thank you both. Here's what I'm working on: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> $WS_EX_NOACTIVATE = 0x08000000 $MA_NOACTIVATE = 3 $MA_NOACTIVATEANDEAT = 4 HotKeySet("{ESC}", "On_Exit") Opt("GUIOnEventMode", 1) Global $left=@DesktopWidth/2 Global $aKeys[57] = ["Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "Backspace", _ "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "\", _ "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", " ENTER ", _ "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", " shift ", _ "!@#", " ≡", " Alt ", " SPACE ", " : ) ", " ... ", " Ctrl "] Global $bKeys[19] = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", _ "{", "}", ":", Chr(34), "<", ">", "?"] ; Create "keyboard" GUI $hGUI = GUICreate("Test", @DesktopWidth, 267, -1, @DesktopHeight-267, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) GUISetBkColor(0, $hGUI) WinSetTrans("Test", "", 175) #region 1st Row $r1b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[0], $left-325, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[1], $left-275, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[2], $left-225, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[3], $left-175, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[4], $left-125, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[5], $left-75, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[6], $left-25, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[7], $left+25, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[8], $left+75, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[9], $left+125, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[10], $left+175, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b12Button=GUICtrlCreateLabel(@CRLF & $aKeys[11], $left+225, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b13Button=GUICtrlCreateLabel(@CRLF & $aKeys[12], $left+275, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r1b14Button=GUICtrlCreateLabel(@CRLF & $aKeys[13], $left+325, 13, Default, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") #endregion #region 2nd Row $r2b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[14], $left-275, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[15], $left-225, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[16], $left-175, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[17], $left-125, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[18], $left-75, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[19], $left-25, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[20], $left+25, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[21], $left+75, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[22], $left+125, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[23], $left+175, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[24], $left+225, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b12Button=GUICtrlCreateLabel(@CRLF & $aKeys[25], $left+275, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r2b14Button=GUICtrlCreateLabel(@CRLF & $aKeys[26], $left+325, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") #endregion #region 3rd Row $r3b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[27], $left-275, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[28], $left-225, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[29], $left-175, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[30], $left-125, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[31], $left-75, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[32], $left-25, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[33], $left+25, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[34], $left+75, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[35], $left+125, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[36], $left+175, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[37], $left+225, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r3b12Button=GUICtrlCreateLabel(@CRLF & $aKeys[38], $left+275, 113, Default, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") #endregion #region 4th Row $r4b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[39], $left-225, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[40], $left-175, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[41], $left-125, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[42], $left-75, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[43], $left-25, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[44], $left+25, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[45], $left+75, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[46], $left+125, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[47], $left+175, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[48], $left+225, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r4b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[49], $left+275, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") #endregion #region Final Row $r5b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[50], $left-275, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r5b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[51], $left-225, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r5b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[52], $left-175, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r5b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[53], $left-125, 213, 293, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r5b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[54], $left+175, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r5b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[55], $left+225, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) GUICtrlSetOnEvent(-1, "_test") $r5b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[56], $left+275, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333344) #endregion GUISetState() Run("notepad.exe") While 1 Sleep(10) WEnd Func _test() EndFunc Func On_Exit() ProcessClose("notepad.exe") Exit EndFunc It's an on screen keyboard that will resemble the Metro style OSK of Win8, I'm making it to be used with with my pc controller, as it's bluetooth and hand held so I can sit on my couch and use the controller as a mouse & keyboard efficiently. It's NOT being made to be used with games, but to provide a relaxing netflix, hulu, etc experience. My next step is to create a manner of highlighting the selected key... I'm thinking a child window withjust the border and transparent that will move around the parent window according to coordinates maybe....? Edited January 5, 2014 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
mLipok Posted January 5, 2014 Share Posted January 5, 2014 (edited) Part of the problem solved by The rest of the not yet been resolved. I will try to return to this problem, and if you let it introduce these issues also in this thread, and if I manage to solve them yourself it'll try to describe what was causing the problems with which I was contending. EDIT: Provisionally, however, I'll wait, for example, talked about Melb23. Edited January 5, 2014 by mlipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Wombat Posted January 6, 2014 Author Share Posted January 6, 2014 This is my code so far: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <Array.au3> #include <_IsPressed360.au3> $WS_EX_NOACTIVATE = 0x08000000 $MA_NOACTIVATE = 3 $MA_NOACTIVATEANDEAT = 4 HotKeySet("{ESC}", "On_Exit") Opt("GUIOnEventMode", 1) Global Const $hDll = DllOpen("xinput9_1_0.dll") Global $iAdown = 0, $iBdown = 0, $iYDown = 0 Global $iLeftJoyDown = 0 Global $iLeftDown = 0, $iRightDown = 0, $iUpDown = 0, $iDownDown = 0 Global $iRightJoyRightDown = 0, $iRightJoyLeftDown = 0, $iRightJoyDown = 0, $iRightJoyUpDown = 0, $iRightJoyDownDown = 0 Global $left=@DesktopWidth/2 Global $aKeys[57] = ["Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "Backspace", _ "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "\", _ "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", " ENTER ", _ "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", " shift ", _ "!@#", " ≡", " Alt ", " SPACE ", " : ) ", " ... ", " Ctrl "] Global $bKeys[19] = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", _ "{", "}", ":", Chr(34), "<", ">", "?"] ; Create "keyboard" GUI $hGUI = GUICreate("Test", @DesktopWidth, 269, -1, @DesktopHeight-269, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) GUISetBkColor(0, $hGUI) GUISetCursor(16, 1, $hGUI) WinSetTrans("Test", "", 222) _WinAPI_ShowCursor(False) #region 1st Row $r1b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[0], $left-325, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[1], $left-275, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[2], $left-225, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[3], $left-175, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[4], $left-125, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[5], $left-75, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[6], $left-25, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[7], $left+25, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[8], $left+75, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[9], $left+125, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[10], $left+175, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b12Button=GUICtrlCreateLabel(@CRLF & $aKeys[11], $left+225, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b13Button=GUICtrlCreateLabel(@CRLF & $aKeys[12], $left+275, 13, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r1b14Button=GUICtrlCreateLabel(@CRLF & $aKeys[13], $left+325, 13, Default, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) #endregion #region 2nd Row $r2b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[14], $left-275, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[15], $left-225, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[16], $left-175, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[17], $left-125, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[18], $left-75, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[19], $left-25, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[20], $left+25, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[21], $left+75, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[22], $left+125, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[23], $left+175, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[24], $left+225, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b12Button=GUICtrlCreateLabel(@CRLF & $aKeys[25], $left+275, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r2b14Button=GUICtrlCreateLabel(@CRLF & $aKeys[26], $left+325, 63, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) #endregion #region 3rd Row $r3b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[27], $left-275, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[28], $left-225, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[29], $left-175, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[30], $left-125, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[31], $left-75, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[32], $left-25, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[33], $left+25, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[34], $left+75, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[35], $left+125, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[36], $left+175, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[37], $left+225, 113, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r3b12Button=GUICtrlCreateLabel(@CRLF & $aKeys[38], $left+275, 113, Default, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) #endregion #region 4th Row $r4b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[39], $left-225, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[40], $left-175, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[41], $left-125, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[42], $left-75, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[43], $left-25, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[44], $left+25, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[45], $left+75, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b8Button=GUICtrlCreateLabel(@CRLF & $aKeys[46], $left+125, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b9Button=GUICtrlCreateLabel(@CRLF & $aKeys[47], $left+175, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b10Button=GUICtrlCreateLabel(@CRLF & $aKeys[48], $left+225, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r4b11Button=GUICtrlCreateLabel(@CRLF & $aKeys[49], $left+275, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) #endregion #region Final Row $r5b1Button=GUICtrlCreateLabel(@CRLF & $aKeys[50], $left-275, 163, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r5b2Button=GUICtrlCreateLabel(@CRLF & $aKeys[51], $left-225, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r5b3Button=GUICtrlCreateLabel(@CRLF & $aKeys[52], $left-175, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r5b4Button=GUICtrlCreateLabel(@CRLF & $aKeys[53], $left-125, 213, 293, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r5b5Button=GUICtrlCreateLabel(@CRLF & $aKeys[54], $left+175, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r5b6Button=GUICtrlCreateLabel(@CRLF & $aKeys[55], $left+225, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) $r5b7Button=GUICtrlCreateLabel(@CRLF & $aKeys[56], $left+275, 213, 43, 43, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) GUICtrlSetBkColor(-1, 0x333333) #endregion GUISetState() Run("notepad.exe") While 1 Sleep(10) WEnd Func _highlight() If WinExists("highlight", "")=0 Then Local $ctrlData=ControlGetPos("Test", "", $r1b1Button) Local $ctrlText=ControlGetText("Test", "", $r1b1Button) $cGUI=GUICreate("highlight", $ctrlData[2], $ctrlData[3], $ctrlData[0]+2, $ctrlData[1]+2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xf55c00, "highlight") $hLabel=GUICtrlCreateLabel($ctrlText, 0, 0, $ctrlData[2], $ctrlData[3], $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) _WinAPI_ShowCursor(False) WinSetTrans("highlight", "", 225) WinSetOnTop("highlight", "", 1) GUISetState() _Do() Else _Do() EndIf EndFunc Func _Do() EndFunc Func On_Exit() ProcessClose("notepad.exe") DllClose($hDll) Exit EndFunc and this is for backup for when I get to work expandcollapse popup#include-once #Region _IsPressed360 ; #FUNCTION# ==================================================================================================================== ; Name...........: _IsPressed360 ; Description ...: Checks if key on Xbox360 controller has been pressed ; Syntax.........: _IsPressed360($iKey[, $vDLL = 'user32.dll']) ; Parameters ....: $iKey - Key to check for ; $vDLL - Handle to dll or default to user32.dll ; Return values .: True - 1 ; False - 0 ; Author ........: Djarlo Westmaas (with the help of scripts made by Oxin8, ezzetabi and Jon) ; Modified.......: ; Remarks .......: If calling this function repeatidly, you should open 'xinput9_1_0.dll' and pass in handle. ; Make sure to close at end of script ; If requesting state of one of the Joysticks or triggers its press value will be returned as @extended ; -32768 Y ; 1 Up ; 2 Down ; 4 Left ; 8 Right ; 16 Start ; 32 Back ; 64 LeftJoyStick ; 128 RightJoyStick ; 256 LB ; 512 RB ; 4096 A ; 8192 B ; 16384 X ; 32768 LeftTrigger (@extended 0 - 255) ; 65536 RightTrigger (@extended 0 - 255) ; 131072 LeftJoyStick-X (@extended -32768 - 32767) ; 262144 LeftJoyStick-Y (@extended -32768 - 32767) ; 524288 RightJoyStick-X (@extended -32768 - 32767) ; 1048576 RightJoyStick-Y (@extended -32768 - 32767) ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/133663-udf-ispressed360au3-xbox360-controller/ ; Example .......: Yes ; =============================================================================================================================== Func _IsPressed360($iKey, $vDLL = 'xinput9_1_0.dll') Local $hStruct, $iValue = 0 $hStruct = DllStructCreate("dword;short;ubyte;ubyte;short;short;short;short") If DllCall($vDLL, "long", "XInputGetState", "long", 0, "ptr", DllStructGetPtr($hStruct)) = 0 Then Return SetError(5, 0, False) If @error Then Return SetError(@error, @extended, False) Select Case $iKey < 16385 Return Number(BitAND($iKey, DllStructGetData($hStruct, 2)) <> 0) Case $iKey = 32768 $iValue = DllStructGetData($hStruct, 3) If $iValue > 10 Then Return SetError(0, $iValue, 1) Case $iKey = 65536 $iValue = DllStructGetData($hStruct, 4) If $iValue > 10 Then Return SetError(0, $iValue, 1) Case $iKey = 131072 $iValue = DllStructGetData($hStruct, 5) If $iValue > 10000 Or $iValue < -10000 Then Return SetError(0, $iValue, 1) Case $iKey = 262144 $iValue = DllStructGetData($hStruct, 6) If $iValue > 10000 Or $iValue < -10000 Then Return SetError(0, $iValue, 1) Case $iKey = 524288 $iValue = DllStructGetData($hStruct, 7) If $iValue > 10000 Or $iValue < -10000 Then Return SetError(0, $iValue, 1) Case $iKey = 1048576 $iValue = DllStructGetData($hStruct, 8) If $iValue > 10000 Or $iValue < -10000 Then Return SetError(0, $iValue, 1) EndSelect Return SetError(0, $iValue, 0) EndFunc ;==>_IsPressed360 #EndRegion _IsPressed360 again, this is NOT for gaming, I have Xpadder for mapping controls, this is for creating an efficient way to use the xbox360 controller as a mouse+keyboard as part of my home theater set up. I would like to know if anyone knows how I can find the value for the guide(center) button, all across the internet its infamouse for being an uncontrollable brat... In this ancient thread: '?do=embed' frameborder='0' data-embedContent>> using the example, with some cleaning, the guide button returns a value of 1024 but it says it is the "A" button... If anyone can solve this it's the autoit community (<--- my personal opinion) If this is riding too close to breaking the terms and conditions on game manipulation, I'll concentrate my questions solely on the gui and try to handle the controller integration on my own. But what i'm moving towards is a verry custom home theater set up after taxes and this software and the controller are the central pieces. anyways, with my current code, will I need to hand write the coords of each control or is there a way to detect the control under the child gui?, any critiques or tips on improving my code is always welcome. ... until tomorrow, g'night ladies and gents Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2014 Moderators Share Posted January 6, 2014 Wombat, If this is riding too close to breaking the terms and conditions on game manipulationYou are in the clear as far as that goes - but I am concerned by the existence of a virtual keyboard. As your code is very incomplete, what role will that play in this script? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Wombat Posted January 6, 2014 Author Share Posted January 6, 2014 (edited) Wombat, You are in the clear as far as that goes - but I am concerned by the existence of a virtual keyboard. As your code is very incomplete, what role will that play in this script? M23 It will extend the controllers ability to enter data, and function as an important piece in the central concept I'm working on. I'm building a custom pc to use as a Steam Machine, it will be dual boot 1tb to Windows and 1tb to SteamOS. Until Valve works through their many bugs in the new OS I will be using Windows as a "Fog Machine" to power my home entertainment system. I do not want just another pc sitting in my living room that I need another mouse+keyboard for or have to move the dongle back and forth or even worse have to buy a switch for it. So instead I'm going to put together software that will make it as efficient and accessible as possible from a controller in said living room. To do this the controller must be able to: (a) Be able to control the mouse and move it fluidly around the screen without much effort. - This will be accomplished by two combined means; (a1) Setting up a joystick to move the mouse around with smart speed (the farther you push the joystick to the edge the faster the mouse will move) (a2) Setting a bumper(or bumpers) so that there are specified "HotSpots" on the screen (possibly the four corners of the screen and/or maybe move the mouse to the controls usually highlighted by "tabbing" through a window to reach its controls)( b ) Be able to quickly and efficiently enter text, format text, and alter text solely using the controller. - This will be accomplished by a virtual keyboard; (b1) Creating a virtual keyboard that does NOT interrupt the task at hand but that sits on top of all other windows when active. (b2) Implementing extended functionality via settings, word prediction, spell check, and text formatting. (b3) Designing a highly responsive, low cpu payload, and fast interface.(c ) Be able to quickly access and navigate the OS without issue or henderance. - This will be accomplished by creating a central app that works as a HUB for all actions possible with the controller; (c1) Create an intuitive design that is easily understandable and navigable to any user. (c2) Implement custom settings and preferences which can be quickly and easily edited and implemented without change to the base code. (c3) Remove the requirement for heavy navigation of the OS and use the HUB as a central station where almost any application can be ran, or task can be completed. Edited January 6, 2014 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2014 Moderators Share Posted January 6, 2014 Wombat,So just to be sure, a cursor of some sort driven by the controller will select keys from the VKB for use elsewhere - you are not scanning an actual keyboard at all? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Wombat Posted January 6, 2014 Author Share Posted January 6, 2014 No physical keyboard, the VKB will have a "cursor" that moves over the keys "highlighting" them to show what will be entered when another button is pressed. So when they click anywhere where text can be entered the VKB will appear. if you bind the function "_highlight" to a key and activate it you'll see the child gui appear which is the "cursor". Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2014 Moderators Share Posted January 6, 2014 Womba,Thank you for that clarification. Now that is settled, here is the code I mentioned to get the font size to match the GUI size: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Set resize mode for controls Opt("GUIResizeMode", $GUI_DOCKAUTO) $hGUI = GUICreate("Test", 400, 200, 100, 100, BitOR($WS_SIZEBOX, $WS_SYSMENU)) $cButton_1 = GUICtrlCreateButton("Test 1", 10, 10, 80, 30) $cButton_2 = GUICtrlCreateButton("Test 2", 10, 50, 80, 30) ; Once all the controls have been created use this to get the final ControlID $iLast_Control = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState() GUIRegisterMsg($WM_SIZING, "_WM_SIZING") GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZING($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $wParam If $hWnd = $hGUI Then Local $iNew_H, $iNew_W Local $sRect = DllStructCreate("Int[4]", $lParam) Local $iLeft = DllStructGetData($sRect, 1, 1) Local $iTop = DllStructGetData($sRect, 1, 2) Local $iRight = DllStructGetData($sRect, 1, 3) Local $iBottom = DllStructGetData($sRect, 1, 4) ; Keep the same aspect ratio Switch $wParam ; drag side or corner Case 1, 2 ; $WMSZ_LEFT, $WMSZ_RIGHT $iNew_H = Int(($iRight - $iLeft) * 200 / 400) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $iNew_H, 4) Case Else $iNew_W = Int(($iBottom - $iTop) * 400 / 200) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $iNew_W, 3) EndSwitch EndIf EndFunc Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam If $hWnd = $hGUI Then ; Calculate required font size Local $aGUI_Size = WinGetClientSize($hGUI) Local $iFontSize = Int(2 * (.25 + (8 * $aGUI_Size[0] / 500))) / 2 ; A basic c ; Reset font size for all controls on main GUI For $i = 0 To $iLast_Control ; And this makes sure that we cover them all <<<<<<<<<<<<<<<< GUICtrlSetFont($i, $iFontSize) Next EndIf EndFunc ;==>_WM_SIZEM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Wombat Posted January 6, 2014 Author Share Posted January 6, 2014 Womba, Thank you for that clarification. Now that is settled, here is the code I mentioned to get the font size to match the GUI size: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Set resize mode for controls Opt("GUIResizeMode", $GUI_DOCKAUTO) $hGUI = GUICreate("Test", 400, 200, 100, 100, BitOR($WS_SIZEBOX, $WS_SYSMENU)) $cButton_1 = GUICtrlCreateButton("Test 1", 10, 10, 80, 30) $cButton_2 = GUICtrlCreateButton("Test 2", 10, 50, 80, 30) ; Once all the controls have been created use this to get the final ControlID $iLast_Control = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState() GUIRegisterMsg($WM_SIZING, "_WM_SIZING") GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZING($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $wParam If $hWnd = $hGUI Then Local $iNew_H, $iNew_W Local $sRect = DllStructCreate("Int[4]", $lParam) Local $iLeft = DllStructGetData($sRect, 1, 1) Local $iTop = DllStructGetData($sRect, 1, 2) Local $iRight = DllStructGetData($sRect, 1, 3) Local $iBottom = DllStructGetData($sRect, 1, 4) ; Keep the same aspect ratio Switch $wParam ; drag side or corner Case 1, 2 ; $WMSZ_LEFT, $WMSZ_RIGHT $iNew_H = Int(($iRight - $iLeft) * 200 / 400) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $iNew_H, 4) Case Else $iNew_W = Int(($iBottom - $iTop) * 400 / 200) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $iNew_W, 3) EndSwitch EndIf EndFunc Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam If $hWnd = $hGUI Then ; Calculate required font size Local $aGUI_Size = WinGetClientSize($hGUI) Local $iFontSize = Int(2 * (.25 + (8 * $aGUI_Size[0] / 500))) / 2 ; A basic c ; Reset font size for all controls on main GUI For $i = 0 To $iLast_Control ; And this makes sure that we cover them all <<<<<<<<<<<<<<<< GUICtrlSetFont($i, $iFontSize) Next EndIf EndFunc ;==>_WM_SIZE M23 That is actually very impressive Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 6, 2014 Moderators Share Posted January 6, 2014 Wombat,I must admit I am quite pround of that bit of code. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Wombat Posted January 6, 2014 Author Share Posted January 6, 2014 (edited) So what would be the best way to implement the highlight function? The child GUI is nice but I would have to compile all the coordinates of the buttons and then check the position of the child gui against the buttons coords... is there a better way/more efficient way? Edit: So I'm thinking i could collect the control coords with something like this: For $i = 1 to 57 $ButtonCoords=ControlGetPos($hGUI, "", $aKeys[$i]) _ArrayAdd($XBC, $ButtonCoords[0]) _ArrayAdd($YBC, $ButtonCoords[1]) Next but $aKeys[57] does not contain the control but instead the text of the controls.... so I'm lost Edit: maybe something like this: Func WinListChildren($hWnd, ByRef $avArr) If UBound($avArr, 0) <> 2 Then Local $avTmp[10][2] = [[0]] $avArr = $avTmp EndIf Local $hChild = _WinAPI_GetWindow($hWnd, $GW_CHILD) While $hChild If $avArr[0][0]+1 > UBound($avArr, 1)-1 Then ReDim $avArr[$avArr[0][0]+10][2] $avArr[$avArr[0][0]+1][0] = $hChild $avArr[$avArr[0][0]+1][1] = _WinAPI_GetWindowText($hChild) $avArr[0][0] += 1 WinListChildren($hChild, $avArr) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd ReDim $avArr[$avArr[0][0]+1][2] EndFunc Edited January 7, 2014 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Wombat Posted January 8, 2014 Author Share Posted January 8, 2014 OK so here's an update: I was able to retreive the id, and text of the controls in the gui. I then split them into two seperate array's with the follwoing functions: Func WinListChildren($hWnd, ByRef $avArr) If UBound($avArr, 0) <> 2 Then Local $avTmp[10][2] = [[0]] $avArr = $avTmp EndIf Local $hChild = _WinAPI_GetWindow($hWnd, $GW_CHILD) While $hChild If $avArr[0][0] + 1 > UBound($avArr, 1) - 1 Then ReDim $avArr[$avArr[0][0] + 10][2] $avArr[$avArr[0][0] + 1][0] = $hChild $avArr[$avArr[0][0] + 1][1] = _WinAPI_GetWindowText($hChild) $avArr[0][0] += 1 WinListChildren($hChild, $avArr) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd ReDim $avArr[$avArr[0][0] + 1][2] EndFunc ;==>WinListChildren Func _SplitChildren() Global $ChildID[UBound($avChildren)], $ChildText[UBound($avChildren)] For $i = 0 To UBound($avChildren) -1 $ChildID[$i] = $avChildren[$i][0] $ChildText[$i] = $avChildren[$i][1] Next EndFunc I don't like that the split function declares a global variable but I was unable to get it to function correctly without doing so... Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Wombat Posted January 8, 2014 Author Share Posted January 8, 2014 So I'm now stuck, I need to get the coords of the controls and compare the child gui's coords with an array of the control coords and react accordingly. From there the child GUI would compare it's x&y with the available x&y's and move to the appropriate coordinates. Is this a less than optimal way of achieving a highlight function? Is there a better way? Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Wombat Posted January 18, 2014 Author Share Posted January 18, 2014 No takers? Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... 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