Jump to content

Search the Community

Showing results for tags 'GUI'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. Hello everyone, today I would like to show you how far I have come with the implementation of DarkMode for AutoIT GUIs. Source: https://github.com/ysc3839/win32-darkmode About Win32 Darkmode: Since about 2020 there is a "hidden" / "undocumented" API for Win32 DarkMode. There is also already a program that has implemented this quite well. (Notepad++) Difficulties Unfortunately, the Windows devs are either too lazy or have been stupid with the implementation. So we have to apply all kinds of fixes (as we are already used to) to get the GUIs to actually run completely. Also there are some difficulties as all existing code that could be used is written in c++. I understand that, but only rudimentarily. So if there is someone here who can / would like to help me translate / implement some existing solutions. There are for example: The 'FixDarkScrollBar()' function which I would like to implement, but where I just can't get any further. Also with ChatGPT the code is difficult to 'override' and it doesn't work at all. GPT tells me that the implementation in AutoIT is quite impossible. And the full IatHook.h (https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/IatHook.h) Edit: Sloved witth v0.0.3 Todos / Challenges: * Redrawing of the Menu to Black * Getting the other controls into the right Theme for DarkMode * Setting Text Theme Colder of e.g. Checkboxes, ListViewHeader or Group Text * Getting Darkmode for Date Let me know what you think and where you might have suggestions for improvement or ideas. (Especially if you can help translate c++ into autoit :3) Kind Regards NoNameCode GUIDarkMode_V0.03 - OpenNcThemeData Hook.zip Changelog V.03 * Added HookOpenNcThemeData.dll => Coded by NoNameCode in C++ if someone want the Source pls DM * Added HookOpenNcThemeData_Debug.dll => Same as HookOpenNcThemeData.dll but Creates a OpenNcThemeData.txt with the opened Classes and if the Class got Replaced by Hook * Changed Darkmode_GUISample.au3 > More Data for GUICtrlCreateList and GUICtrlCreateEdit + #include <String.au3> > Added Routine to get AutoIt Install Path by Reg; or if not by @AutoItExe for PIC (logo4.gif) or AVI (SampleAVI.avi) * Changed GUIDarkMode.au3 > Added DllOpen for HookOpenNcThemeData.dll and Added OnAutoItExitRegister for DllClose function > Changed _GUICtrlSetDarkTheme -> Cleand Up Switch by CTRL Class bec. moste of them are not needed anymore through ScrollbarFix via HookOpenNcThemeData.dll Old Stuff:
  2. Here an example to switch in/out full screen with F11 version 0.2 ; https://www.autoitscript.com/forum/topic/210078-full-screen-gui/?do=findComment&comment=1516762 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region (=== GUI generated by GuiBuilderPlus 1.0.0-beta4 ===) Global $hGUI = GUICreate("MyGUI", 400, 350, 760, 365, -1, -1) Global $idFullScreen = GUICtrlCreateDummy() #EndRegion (=== GUI generated by GuiBuilderPlus 1.0.0-beta4 ===) _main() ;------------------------------------------------------------------------------ ; Title...........: _main ; Description.....: run the main program loop ;------------------------------------------------------------------------------ Func _main() GUISetState(@SW_SHOW) Local $aAccelKeys[1][2] = [["{F11}", $idFullScreen]] GUISetAccelerators($aAccelKeys) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idFullScreen _FullScreen() Case Else ; EndSwitch Sleep(10) WEnd EndFunc ;==>_main ;------------------------------------------------------------------------------ Func _FullScreen() Local Static $aWPos, $aGUIStyle = GUIGetStyle($hGUI), $iFullScreen = 0 If $iFullScreen = 0 Then $aWPos = WinGetPos($hGUI) WinMove($hGUI, "", 0, 0, @DesktopWidth, @DesktopHeight) GUISetStyle(BitOR($WS_POPUP, $WS_EX_TOPMOST), -1) $iFullScreen = 1 Else WinMove($hGUI, "", $aWPos[0], $aWPos[1], $aWPos[2], $aWPos[3]) GUISetStyle($aGUIStyle[0], $aGUIStyle[1]) $iFullScreen = 0 EndIf EndFunc ;==>_FullScreen ;------------------------------------------------------------------------------ Please, leave your comments and experiences here. Thanks !
  3. Good morning In terms of AutoIt, what is that? A GUI with an input control? How would that be coded? I have never done anything like this.
  4. 👋 Hey I want to call a function when something changes on an element in my GUI. That should work for a combo box (with $CBS_DROPDOWNLIST) when I select an item and for a text input when I type.
  5. Hi guys, I would like to make a gui borderless viewing a png image with transparent background. pretty much has to be visible only the png image with no background..you have any simple example? Thank's GUICtrlCreatePic still it provides the image with the background...
  6. Hi all, The more projects I work on, the harder it is to find old scripts I created with certain techniques in them. I'd like to leave this here for others to get an idea from and it will be available now by keyword searching in this forum. This project needed an evenly distributed button grid setup on a touch screen with half decent sized buttons and spacing so the user would be less likely to press the key beside it. Here is one quick example to give anyone an idea of a way to handle it. #include <GUIConstants.au3> GUICreate("Button Grid", 1080, 100) ; will create a dialog box that when displayed is centered GUISetState(@SW_SHOW) ; will display an empty dialog box ;--Create and Position Controls Dim $btnActivated[1][2] ;Col 1 is button id, Col 2 is True/False used in 1 example as depressed Dim $btnArray[100][2] ;Col 1 is button id, Col 2 is True/False used in 1 example as depressed $num = 0 $btnActivated[0][0] = GUICtrlCreateButton("Activated", 0, 0, 100, 100) ;x,y,w,h $btnActivated[0][1] = True GUICtrlSetBkColor(-1,0x00ff00) GUICtrlSetColor(-1,0x005500) GUICtrlSetFont(-1,14) For $Y = 0 To 1 For $X = 0 To 7 ConsoleWrite( ($X * 100) + ($X*20) + 120 & @CRLF) If $Y=0 Then $btnArray[$num][0] = GUICtrlCreateButton($num + 1, ($X * 100) + ($X*20) + 120, 0, 100, 40) ;x,y,w,h Else $btnArray[$num][0] = GUICtrlCreateButton($num + 1, ($X * 100) + ($X*20) + 120, ($Y * 40) + $Y*20, 100, 40) ;x,y,w,h EndIf GUICtrlSetBkColor($btnArray[$num][0], 0xFFFFFF) $num += 1 Next Next ;--Set Button Names GUICtrlSetData($btnArray[0][0],"Autoit") GUICtrlSetData($btnArray[1][0],"Is") GUICtrlSetData($btnArray[2][0],"Cool") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $btnActivated[0][0] $btnActivated[0][1] = NOT $btnActivated[0][1] If $btnActivated[0][1] Then GUICtrlSetBkColor($btnActivated[0][0],0x00ff00) GUICtrlSetColor($btnActivated[0][0],0x005500) GUICtrlSetData($btnActivated[0][0],"Activated") GUICtrlSetFont($btnActivated[0][0],14) Else GUICtrlSetBkColor($btnActivated[0][0],0xFF9999) GUICtrlSetColor($btnActivated[0][0],0x550000) GUICtrlSetData($btnActivated[0][0],"DeActivated") GUICtrlSetFont($btnActivated[0][0],13) EndIf Case $btnArray[0][0] If $btnActivated[0][1] Then MsgBox(0,"Notice","Btn1",1) EndIf Case $btnArray[1][0] If $btnActivated[0][1] Then MsgBox(0,"Notice","Btn2",1) EndIf Case $btnArray[2][0] If $btnActivated[0][1] Then MsgBox(0,"Notice","Btn3",1) EndIf EndSwitch WEnd I couldn't find one of my old projects that broke the button array into more columns that included the actual button name in the field. Feel free to share your own or share a more flexible version of this simple example.
  7. I am making some GUI with combobox for the Baudrates communications and I listed 9600, 57600, 115200. I wrote the code to be defaulted to 57600 like this: GUICtrlSetData($comboBox_opticalBaudRate, "9600|57600|115200", "57600") But I wanted the GUI to remember the last item the user picks so the baudrates will NOT be defaulted to 57600. Example, I pick 9600 as my baudrates, then I close the GUI, after opening it, it always prompt 57600 since that is what I did in my code. But I want that if I choose 9600 and close the GUI, opening it again will show 9600 now instead of 57600. Is there a way to do it in GUI setting? Thanks.
  8. Introduction ImGui is a popular library written by ocornut, it can make awesome user interface based on directx. It is being used by many big apps/games. The UI is nice and flexible, easy to use because of frame-by-frame drawing. So I decided to convert the entire ImGui library to AutoIt At first it's just an experiment, i converted some basic draw functions of imgui, compile to a dll, then using DllCall in autoit to call the functions. I was testing to see how much FPS i can get in autoit, and i was expected a low FPS, since autoit is slow. Suprisingly, the FPS turned out to be so high, it works really fast, even when drawing 1000 buttons at the same time. Features More than +270 functions converted from ImGui (compiled dll). Has 90% of the capability of what you can do in C++; Usable ImGuiIO and ImGuiStyle, so you can set whatever configurations you like. Preview Usage #include <WinAPI.au3> #include "ImGui.au3" ; Create a window Local $hwnd = _ImGui_GUICreate("AutoIt ImGui", 1024, 768) _WinAPI_ShowWindow($hwnd) ; Set style color _ImGui_StyleColorsLight() ;~ _ImGui_StyleColorsDark() Local $f_value = 5 While 1 ; when the user click close button on the window, this will return false if Not _ImGui_PeekMsg() Then Exit ; must call _ImGui_BeginFrame() _ImGui_Begin("Another window") _ImGui_Text("Hello there..") If _ImGui_Button("click me") Then $f_value = 5 _ImGui_SliderFloat("slider", $f_value, 2, 20) If _ImGui_IsItemHovered() Then _ImGui_ToolTip("what r u doing?") _ImGui_End() ; must call _ImGui_EndFrame() Wend Remark Most of the functions were converted automatically. I haven't tested all of them yet, if some function doesn't work for you, please tell me. Still missing some features of ImGui, please tell me if you needed any. Run \tools\imgui-au3-setup.au3 to add _ImGui functions to SciTE auto-complete. Source Code Require: DirectX GitHub: imgui-autoit
  9. mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples
  10. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Engr. Ashraful\Videos\koda_1.7.3.0\Forms\ProgramPlayer\FormProgamToOpen.kxf $FormInput = GUICreate("Input", 302, 205, 454, 285) $Resolution = GUICtrlCreateCombo("Resolution", 80, 24, 145, 25) GUICtrlSetData(-1, "1920|VM1920|1366") $ComboProgramType = GUICtrlCreateCombo("Program Type Selection", 80, 64, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Multimedia|Official|Design|Web") $ButtonEnter = GUICtrlCreateButton("Enter", 104, 104, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd please help me to read combo box input and use the value for another function/ work
  11. Hi, I am having a problem properly saving the Width of a resizable Gui. When a user resizes the Gui it gets saved in an ini when the Gui closes to then restore the new Width upon reopening the app. with GUICreate("myGui",300,200,Default,Default,$WS_SIZEBOX) WinGetPos($hGUI) returns 314, and WinGetClientSize($hGUI) returns 298 when its then saved in the ini the gui keeps expanding or shrinking every time its opened by +14 or -2 I figure it has to do with borders etc, but i also guess borders depend on the window theme and whatnot or is user specific, so i can't just do $GuiWidth = $GetGuiWidth[arr] -14 or +2 right? is there a proper way of doing this? Thanks in advance, Aapjuh
  12. Hello all! i'm searching here, cause i do'nt know where else to search.. I'm developing some projects, mainly intended to help Blind users of computers. I'm also blind, so my guis are Ok for Screen readers, but i'm not sure, if they are good also for normal users.. So I¨m searching here for somebody, interested in Autoit, which have no problem to help me a bit with designating my apps. My apps are written in Czech language, so i prefer somebody from Czech republic.. If somebody want to help me, don't hesitate to contact me personaly, contacts and my projects are available on web in my profile. So thank you for potential help and i'm sorry if i missed some forum etiquette rule here. I'm not sure how it works here with searching for interested people and then contact them personaly. Fenzik
  13. I have an edit box that requires a large amount of data to be entered, and it seems that I am hitting the size limit. Is there a way to increase the max amount of text that can be entered? Below is a stripped down example: Global Const $WM_CHAR = 0x0102 Global Const $EM_SETSEL = 0xB1 Global Const $GUI_EVENT_CLOSE = -3 Global Const $GUI_EVENT_MINIMIZE = -4 Global Const $GUI_EVENT_RESTORE = -5 Global Const $GUI_EVENT_MAXIMIZE = -6 Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Edit Control Test", 615, 450, 195, 124) $Edit1 = GUICtrlCreateEdit("", 8, 8, 593, 193) $hEdit1 = GUICtrlGetHandle(-1) $hFunc1 = DllCallbackRegister('_EditHandler1', 'lresult', 'hwnd;uint;wparam;lparam') $pFunc1 = DllCallbackGetPtr($hFunc1) GUICtrlSetData(-1, "enter large amount of data here") $Button1 = GUICtrlCreateButton("Start", 8, 416, 65, 25) $Button2 = GUICtrlCreateButton("Copy to Clipboard", 80, 416, 95, 25) $Edit2 = GUICtrlCreateEdit("", 8, 232, 593, 177) $hEdit2 = GUICtrlGetHandle(-1) $hFunc2 = DllCallbackRegister('_EditHandler2', 'lresult', 'hwnd;uint;wparam;lparam') $pFunc2 = DllCallbackGetPtr($hFunc2) $Label1 = GUICtrlCreateLabel("Output:", 8, 208, 39, 17) $Progress1 = GUICtrlCreateProgress(183, 420, 425, 17) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd
  14. I was looking for a way to embed Windows Media Player into Autoit. I found 2 Windows Media Player UDF's but both of them seem to have used the OCX directly. The problem with using the OCX directly is that the video display size cannot be changed, and it takes the size of the video inherently. @seangriffin created the VLC GUI based on embedding the IE object into the GUI and that seems to work perfectly with Windows Media Player as well and it does not give the resize problem. I built the WMP.au3 around this concept and would like to share it with everybody. Attached is the WMP.au3 and the WMP_Example.au3 where it is used. Feedback is appreciated. This is my first UDF, so please be kind. SudeepJD WMP_Example.au3 WMP.au3
  15. I have provided a portion of my script (seen below) and I wanted to use what the USER will input into my IP address box and input box for TCP port. I set the IP address to use 0.0.0.0 as default and the Port to 502. But I want to let the user change it and when they click the buttons (IP Address and Port), the tooltip will show what the USER entered. How can I use the details that the User will input into my input box and IP address box and let them see what they entered when they click the buttons? Here are the scripts: ;------------------------------------------------------------- #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> #include <Date.au3> #include <TabConstants.au3> #include <GuiTab.au3> Global $Form1 = GUICreate("Security Automation", 490, 339, -1, -1) ;MAIN Tab Global $TAB = GUICtrlCreateTab(0, 0, 489, 337) Global $tab_main = GUICtrlCreateTabItem("Main") $label_Title = GUICtrlCreateLabel("ETP-073 Security", 12, 33, 103, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;-----------------TCP User input information------------------------------------------------------------------------------- $groupBox_TCP = GUICtrlCreateGroup("TCP", 12, 49, 289, 57, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT)) ;TCP IP address Global $IPAddress1 = _GUICtrlIpAddress_Create($Form1, 20, 81, 170, 21) $Label_ipAddress = GUICtrlCreateLabel("Host IP Address", 20, 65, 80, 17) $userInputIP = _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") ;TCP Port $label_tcpPort = GUICtrlCreateLabel("Port", 196, 65, 23, 17) Global $input_tcpPort = GUICtrlCreateInput("502", 196, 81, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $userPort = GUICtrlRead($input_tcpPort) ;TCP Address $label_tcpAddress = GUICtrlCreateLabel("Addr.", 260, 65, 29, 17) Global $input_tcpDevAddress = GUICtrlCreateInput("1", 260, 81, 33, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) ;Buttons Global $btn_userIP = GUICtrlCreateButton("User IP", 308, 297, 81, 25) Global $btn_Port = GUICtrlCreateButton("Port", 404, 297, 75, 25) ;Showing the GUI GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn_userIP ToolTip($userInputIP) Case $btn_Port ToolTip($userPort) EndSwitch WEnd ;--------------end of script ------------------ Note: There will be a "!->Includefile <WMDebug.au3> not found." Pay no attention to it.
  16. So I am a person who has learned programming off the internet, without structured courses, and I'm trying to create a UI element that can be used like "GUICtrlCreate...". I'd like to get some kind of insight on how to improve the code of a Graph element that I have created. I am unfamiliar on the standards for creating such UI elements, and assume I'll get some valuable insight here. Here's some sample code: (I tried to make it look a bit less upsetting to those who know better, but be warned: not pretty.) #include <WinAPISys.au3> #include <WinAPI.au3> #include <WinAPIGdi.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> Local $hWnd = GUICreate("Test", 200, 200) GUISetState(@SW_SHOW, $hWnd) Local $hGraph = _GraphStartUp($hWnd, 10, 30, 180, 180) Local $nData, $nDataMax = 1000, $hDataTimer = TimerInit() While GUIGetMsg() <> $GUI_EVENT_ClOSE If TimerDiff($hDataTimer) >= 150 Then $nData = Random(0, $nDataMax) _UpdateGraph($nData) $hDataTimer = TimerInit() EndIf Sleep(20) WEnd _GraphShutDown($hWnd, $hGraph) Exit Func _GraphStartUp($hWnd, $x, $y, $w, $h, $nUpdateTimes = 1000, $nResolution = 60) Global $hBluePen = _WinAPI_CreatePen($PS_SOLID, 2, _WinAPI_RGB(220, 0, 0)) Global $hGreyPen = _WinAPI_CreatePen($PS_DASH, 1, _WinAPI_RGB(100, 100, 100)) Global $hBlackPen = _WinAPI_CreatePen($PS_SOLID, 1, _WinAPI_RGB(0, 0, 0)) Global $hWhitePen = _WinAPI_CreatePen($PS_SOLID, 1, _WinAPI_RGB(255, 255, 255)) Global $nGraphRes = $nResolution Global $aGraphData[$nGraphRes + 1] For $i = 2 To $nGraphRes $aGraphData[$i] = 0 Next Global $hWinDC = _WinAPI_GetWindowDC($hWnd) Global $nGraphX = $x Global $nGraphY = $y Global $nGraphWidth = $w Global $nGraphHeight = $h Global $nGraphXUnit = $nGraphWidth / ($nGraphRes - 1) Global $nGraphBottomY = $nGraphY + $nGraphHeight Global $nGraphMaxX = $nGraphX + $nGraphWidth Global $aUpdateArea[4][2] = [[$nGraphX - 1, $nGraphY - 1], [$nGraphX - 1, $nGraphBottomY + 1], [$nGraphMaxX + 1, $nGraphBottomY + 1], [$nGraphMaxX + 1, $nGraphY - 1]] Global $pUpdateAreaRgn = _WinAPI_CreatePolygonRgn($aUpdateArea) Global $pTextRect = _WinAPI_CreateRectEx($nGraphX + 1, $nGraphY + 1, $nGraphWidth / 2, $nGraphHeight / 4) Global $nGreatestValue = 1 GLobal $pGraphArea = _WinAPI_CreateRectEx($nGraphX - 7, $nGraphY - 26, $nGraphWidth + 14, $nGraphHeight + 2) Global $pDrawCall = DllCallbackRegister('_DrawGraph', 'none', '') Global $pGraphTimer = _WinAPI_SetTimer($hWnd, 567891234, $nUpdateTimes, DllCallbackGetPtr($pDrawCall)) _DrawGraph() Return $pGraphTimer EndFunc Func _DrawGraph() Global $hPen $nGreatestValue = _ArrayMax($aGraphData, 1, 1) $hPen = _WinAPI_SelectObject($hWinDC, $hWhitePen) _WinAPI_PaintRgn($hWinDC, $pUpdateAreaRgn) $hPen = _WinAPI_SelectObject($hWinDC, $hGreyPen) _WinAPI_DrawLine($hWinDC, $nGraphX, $nGraphY, $nGraphMaxX, $nGraphY) _WinAPI_DrawLine($hWinDC, $nGraphX, $nGraphY + ($nGraphHeight / 2), $nGraphMaxX, $nGraphY + ($nGraphHeight / 2)) _WinAPI_DrawLine($hWinDC, $nGraphMaxX, $nGraphY, $nGraphMaxX, $nGraphBottomY) $hPen = _WinAPI_SelectObject($hWinDC, $hBluePen) For $i = 1 To $nGraphRes - 1 _WinAPI_DrawLine($hWinDC, $nGraphX + (($i - 1) * $nGraphXUnit), $nGraphBottomY - ($aGraphData[$i] / $nGreatestValue * $nGraphHeight), $nGraphX + ($i * $nGraphXUnit), $nGraphBottomY - ($aGraphData[$i + 1] / $nGreatestValue * $nGraphHeight)) Next $hPen = _WinAPI_SelectObject($hWinDC, $hBlackPen) _WinAPI_DrawLine($hWinDC, $nGraphX, $nGraphBottomY, $nGraphMaxX, $nGraphBottomY) _WinAPI_DrawLine($hWinDC, $nGraphX, $nGraphY, $nGraphX, $nGraphBottomY) _WinAPI_DrawText($hWinDC, Round($aGraphData[$nGraphRes], 2), $pTextRect, $DT_LEFT) EndFunc Func _UpdateGraph($nData) _ArrayAdd($aGraphData, $nData) _ArrayDelete($aGraphData, 1) EndFunc Func _GraphShutDown($hWnd, $pGraphTimer) _WinAPI_SelectObject($hWinDC, $hPen) _WinAPI_DeleteObject($hBlackPen) _WinAPI_DeleteObject($hGreyPen) _WinAPI_DeleteObject($hBluePen) _WinAPI_DeleteObject($hWhitePen) _WinAPI_ReleaseDC($hWnd, $hWinDC) _WinAPI_KillTimer($hWnd, $pGraphTimer) DllCallbackFree($pDrawCall) _WinAPI_RedrawWindow($hWnd, $pGraphArea) EndFunc
  17. I check this snippet: https://www.autoitscript.com/wiki/Snippets_(_GUI_)#GUI_With_Scrollable_TabItem Modified them and I refactored. That's because I needed to adapt it to my needs (I'll write later). I thought I understood how it works. But I was wrong. This is my example which is showing what I want to achieve. #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiScrollBars.au3> #include <GUIScrollbars_Ex.au3> #include <StringConstants.au3> #include <StructureConstants.au3> #include <WindowsConstants.au3> GUIRegisterMsg($WM_VSCROLL, WM_VSCROLL) _Example() Func _Example() Local $i_Count = 30 Local $a_Options_List[$i_Count + 1] $a_Options_List[0] = $i_Count For $i = 1 To $i_Count $a_Options_List[$i] = 'Test #' & $i Next ConsoleWrite("- " & _my_gui_Wybierz('Testing', $a_Options_List) & @CRLF) EndFunc ;==>_Example Func _my_gui_Wybierz($s_Description, $a_Options_List = "", $i_Left = Default, $i_Top = Default, $i_Width = Default, $hWnd_Parent = 0) ;~ WinSetOnTop($ACROBAT_TITLE, "", $WINDOWS_NOONTOP ) If $i_Left = Default Then $i_Left = -1 If $i_Top = Default Then $i_Top = -1 If $i_Width = Default Then $i_Width = 400 #Region _my_gui_Wybierz - GUI Creation Local $i_Height = 600 Local $hWND_DateForm = GUICreate("", $i_Width, $i_Height, $i_Left, $i_Top, BitOR(0, $WS_SIZEBOX), -1, $hWnd_Parent) WinSetOnTop($hWND_DateForm, "", $WINDOWS_ONTOP) Local $hChild = GUICreate("Scroll area", $i_Width - 15, $i_Height - 40, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hWND_DateForm) _GUIScrollBars_Init($hChild, -1) _GUIScrollBars_ShowScrollBar($hChild, $SB_HORZ, False) _GUIScrollBars_ShowScrollBar($hChild, $SB_VERT, True) ;~ _GUIScrollBars_SetScrollRange($hChild, $SB_VERT, 3, 30) GUICtrlCreateLabel("", 10, 7, $i_Width - 45, 80) Local $id_Label1 = GUICtrlCreateLabel("", 10, 7 + 5, $i_Width - 45, 80 - 5) GUICtrlSetBkColor(-1, 0x88AABB) Local $a_List_of_Button_ID[$a_Options_List[0] + 1] For $IDX_Item = 1 To $a_Options_List[0] If $IDX_Item > 0 And $IDX_Item < 10 Then $a_List_of_Button_ID[$IDX_Item] = GUICtrlCreateButton( _ $IDX_Item & ". " & $a_Options_List[$IDX_Item], _ 10, 90 + ($IDX_Item - 1) * 21, $i_Width - 45, 20, BitOR($BS_LEFT, $WS_GROUP)) Else $a_List_of_Button_ID[$IDX_Item] = GUICtrlCreateButton( _ Chr(Asc('A') + $IDX_Item - 10) & ". " & $a_Options_List[$IDX_Item], _ 10, 90 + ($IDX_Item - 1) * 21, $i_Width - 45, 20, BitOR($BS_LEFT, $WS_GROUP)) EndIf Next Local $temp_var = $a_Options_List[0] Local $a_accelerators[($temp_var * 2) + 1][2] Local $i_Accelerators_Counter = 0 Local $i_Accelerator_Char1 = '' Local $i_Accelerator_Char2 = '' For $IDX_Item = 1 To $a_Options_List[0] If $IDX_Item > 9 Then $i_Accelerator_Char1 = Chr(Asc('A') + $IDX_Item - 10) $i_Accelerator_Char2 = Chr(Asc('a') + $IDX_Item - 10) Else $i_Accelerator_Char1 = "{NUMPAD" & $IDX_Item & "}" ;Chr(48 + $IDX_Item) $i_Accelerator_Char2 = $IDX_Item EndIf $a_accelerators[($IDX_Item * 2) - 1][0] = $i_Accelerator_Char1 $a_accelerators[($IDX_Item * 2) - 1][1] = $a_List_of_Button_ID[$IDX_Item] $a_accelerators[($IDX_Item * 2) - 1 + 1][0] = $i_Accelerator_Char2 $a_accelerators[($IDX_Item * 2) - 1 + 1][1] = $a_List_of_Button_ID[$IDX_Item] $i_Accelerators_Counter += 2 Next $a_accelerators[0][0] = $i_Accelerators_Counter GUISetAccelerators($a_accelerators, $hChild) GUICtrlSetData($id_Label1, $s_Description) GUISetState(@SW_SHOW, $hWND_DateForm) GUISetState(@SW_SHOW, $hChild) #EndRegion _my_gui_Wybierz - GUI Creation #Region - _my_gui_Wybierz - Handling messages Local $i_Selected_item = 0 Local $v_Return_Value = "" Local $a_GUI_Messages While 1 $a_GUI_Messages = GUIGetMsg($GUI_EVENT_ARRAY) If $a_GUI_Messages[0] = $GUI_EVENT_NONE Then ; do nothing ElseIf $a_GUI_Messages[1] = $hWND_DateForm Then If $a_GUI_Messages[0] = $GUI_EVENT_CLOSE Then ExitLoop ElseIf $a_GUI_Messages[1] <> $hChild Then ; .... Else For $IDX_Check = 1 To $a_Options_List[0] If $a_List_of_Button_ID[$IDX_Check] = $a_GUI_Messages[0] Then $v_Return_Value = GUICtrlRead($a_List_of_Button_ID[$IDX_Check]) $i_Selected_item = $IDX_Check $v_Return_Value = _RegExpFirstMatch($v_Return_Value, '.+?\. (.+)') ExitLoop 2 ; exit from ForNext and also from WhileWend EndIf Next EndIf WEnd #EndRegion - _my_gui_Wybierz - Handling messages GUIDelete($hChild) GUIDelete($hWND_DateForm) Return SetError(0, $i_Selected_item, $v_Return_Value) EndFunc ;==>_my_gui_Wybierz Func WM_VSCROLL($hWnd, $msg, $wParam, $lParam) #forceref $msg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $index = -1, $yChar, $yPos Local $Min, $Max, $Page, $Pos, $TrackPos For $x = 0 To UBound($aSB_WindowInfo) - 1 If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $yChar = $aSB_WindowInfo[$index][3] ExitLoop EndIf Next If $index = -1 Then Return 0 ; Get all the vertial scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $yPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $yPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch ; Set the position and then retrieve it. Due to adjustments ; by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ; If the position has changed, scroll the window and update it $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos)) $yPos = $Pos EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_VSCROLL Func _RegExpFirstMatch($s_Data, $s_Pattern) Local $a_Results = StringRegExp($s_Data, $s_Pattern, $STR_REGEXPARRAYGLOBALMATCH) If @error Then Return SetError(@error, @extended, '') Return SetError(0, UBound($a_Results), $a_Results[0]) EndFunc ;==>_RegExpFirstMatch I have few problems with this code, and many question related to them. Question 1: How to make the Scrollbars to work ? I mean to scroll buttons. Question 2: Do I must to ues Child Window, or is it possible to scroll buttons without using Child Window ? Question 3: Why after uncommenting this following line: ;~ _GUIScrollBars_SetScrollRange($hChild, $SB_VERT, 3, 30) the ScrollBar disapears ?
  18. Hey guys! I just started working with the GUI yesterday and it has only brought more fun to the Autoit adventure Basically I have a GUI windows that opens and based on the selection of the combo box the button will do something different. This specific scenario I am talking about the Client Update Verification combo selection. When selected and the button is pressed my second gui window opens. As of now if I only paste comp1 or comp2 by itself it works correctly, but if I paste both, it has a fit. What would the correct way to do this be? Any help or examples, would be greatly appreciated! Thank you in advance #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Client_List.au3> #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiibox v4.kxf Global $Form1_1 = GUICreate("Plexii", 336, 419, 1548, 586) GUISetBkColor(0xFFFFFF) Global $Pic1 = GUICtrlCreatePic("C:\Users\dnoble\Pictures\plexii.jpg", 41, 0, 252, 268, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) Global $Label2 = GUICtrlCreateLabel("Select Test", 125, 280, 95, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $Combo2 = GUICtrlCreateCombo("Select Test", 39, 312, 257, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Client Update Verification|Bids") GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Proceed", 111, 352, 129, 33) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Combo2) = "Client Update Verification" Then _Form2() ;clientupdateverification() EndSwitch WEnd Func _Form2() #Region ### START Koda GUI section ### Form=c:\users\dnoble\pictures\plexiiboxclientupdate verification.kxf $Form1_1 = GUICreate("Plexii", 336, 521, 866, 454) GUISetBkColor(0xFFFFFF) $Edit1 = GUICtrlCreateEdit("", 57, 72, 241, 345) GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Execute", 95, 440, 145, 41) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Edit1) = "comp1" Then comp1() If GUICtrlRead($Edit1) = "comp2" Then comp2() EndSwitch WEnd EndFunc
  19. I'm trying to assign a faint text in the background to an input field that disappears after the input has started. This should have a certain color such as gray.
  20. Hi All, I am trying to mark out the middle square of this Magnify Routine "window on right" (stolen from M23 - Thanks) - I assume the DllCall is overwriting the boxes. But wherever I try and redraw, they won't stay on the Magnify Window. Can anyone advise, bet way to keep boxes around the middle square. Please be kind with my code, it is ripped from a MUCH bigger exe. The "half" transparent window, is for dragging to where you want it, and the buttons are for more precise placement. #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> Global $hMag_GUI, $hMagDC, $hDeskDC, $hPen, $oObj, $aWinPos[2], $iLast_Mouse_X = 0, $iLast_Mouse_Y = 0 Global $pWindowCaptureX, $pWindowCaptureY Global $pWindowMagWinX, $pWindowMagWinY #Region - GUI3 ; *** Grabber/Picker Window Global $hGUI3 = GUICreate("Capture", 150, 150, $pWindowCaptureX, $pWindowCaptureY, $WS_EX_TOOLWINDOW) Global $Pic1 = GUICtrlCreatePic("", 70, 40, 10, 10, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER)) Global $hButtonUp = GUICtrlCreateButton("U", 65, 60, 20, 20) Global $hButtonDown = GUICtrlCreateButton("D", 65, 100, 20, 20) Global $hButtonLeft = GUICtrlCreateButton("L", 40, 80, 20, 20) Global $hButtonRight = GUICtrlCreateButton("R", 90, 80, 20, 20) Global $hButtonOK = GUICtrlCreateButton("OK", 60, 80, 30, 20) #EndRegion - GUI3 #Region - GUI4 Global $hGUI4 = GUICreate("MagWin", 250, 250, 325, 195) Global $hButtonMOK = GUICtrlCreateButton("OK", 45, 140, 30, 20) Global $hButtonMUp = GUICtrlCreateButton("U", 50, 120, 20, 20) Global $hButtonMDown = GUICtrlCreateButton("D", 50, 160, 20, 20) Global $hButtonMLeft = GUICtrlCreateButton("L", 25, 140, 20, 20) Global $hButtonMRight = GUICtrlCreateButton("R", 75, 140, 20, 20) Global $hLabelWindow = GUICtrlCreateLabel("Window", 5, 185, 44, 15) Global $hLabelWindowText = GUICtrlCreateLabel("", 60, 185, 176, 15) Global $hLabelCheck = GUICtrlCreateLabel("Check", 5, 205, 44, 15) Global $hLabelCheckText = GUICtrlCreateLabel("", 60, 205, 176, 15) Global $hLabelScreen = GUICtrlCreateLabel("Screen", 5, 225, 44, 15) Global $hLabelScreenText = GUICtrlCreateLabel("", 60, 225, 176, 15) #EndRegion - GUI4 ;GUISetState(@SW_HIDE, $hGUI1) GUISetState(@SW_SHOW, $hGUI3) GUISetState(@SW_SHOW, $hGUI4) WinSetTrans($hGUI3, "", 100) $hMag_GUI = WinGetHandle("MagWin") ; Get device context for Mag GUI $hMagDC = _WinAPI_GetDC($hMag_GUI) If @error Then Exit ; Get device context for desktop $hDeskDC = _WinAPI_GetDC(0) If @error Then _WinAPI_ReleaseDC($hMag_GUI, $hMagDC) Exit EndIf ; Create pen $hPen = _WinAPI_CreatePen($PS_SOLID, 5, 0x7E7E7E) $oObj = _WinAPI_SelectObject($hMagDC, $hPen) ; Loop until the user exits. ; *** Static Window While 1 ; Reset position Local $aWinPos = WinGetPos("Capture") If $aWinPos[0] <> $iLast_Mouse_X Or $aWinPos[1] <> $iLast_Mouse_Y Then ; Redraw Mag GUI _FOEA_Loupe($aWinPos) ;~ Local $TWPx = $aWinPos[0]+81 ;+81 Top Left Corner; +85 Middle ;~ Local $TWPy = $aWinPos[1]+75 ;+75 Top Left Corner; +80 Middle ;~ ;*** WINDOW COORDS = x+81 & y+75 (top left of picker square) GUISetState(@SW_HIDE, $hGUI3) Local $output1 = PixelCheckSum($aWinPos[0]+81, $aWinPos[1]+75, $aWinPos[0]+91, $aWinPos[1]+85) Local $output2 = PixelCheckSum($aWinPos[0]+73, $aWinPos[1]+66, $aWinPos[0]+83, $aWinPos[1]+76) If $aWinPos[0] < 1440 Then GUICtrlSetData($hLabelWindowText, $aWinPos[0]+81 & "(" & $aWinPos[0]+81+1440 &")," & $aWinPos[1]+75 & " : " & $output1) GUICtrlSetData($hLabelCheckText, $aWinPos[0]+73 & "(" & $aWinPos[0]+73+1440 & ")," & $aWinPos[1]+66 & " : " & $output2) GUICtrlSetData($hLabelScreenText, "W: " & $aWinPos[0]+73 & "(" & $aWinPos[0]+73+1440 &")," & $aWinPos[1]+66 & " C: " & $aWinPos[0]+81 & "," & $aWinPos[1]+75) Else GUICtrlSetData($hLabelWindowText, $aWinPos[0]+81-1440 & "(" & $aWinPos[0]+81 &")," & $aWinPos[1]+75 & " : " & $output1) GUICtrlSetData($hLabelCheckText, $aWinPos[0]+89-1440 & "(" & $aWinPos[0]+89 &")," & $aWinPos[1]+84 & " : " & $output2) GUICtrlSetData($hLabelScreenText, "W: " & $aWinPos[0]+73-1440 & "(" & $aWinPos[0]+73 & ")," & $aWinPos[1]+66 & " C: " & $aWinPos[0]+81 & "," & $aWinPos[1]+75) ;GUICtrlSetData($hLabel2, $aWinPos[1]+75) EndIf GUISetState(@SW_SHOW, $hGUI3) $iLast_Mouse_X = $aWinPos[0] $iLast_Mouse_Y = $aWinPos[1] $pWindowCaptureX = $aWinPos[0] $pWindowCaptureY = $aWinPos[1] ; *** Box ; Tried it here - doesn't work ;~ Global $Graphic = GUICtrlCreateGraphic(176, 55, 2, 20) ;~ Global $Graphic = GUICtrlCreateGraphic(194, 55, 2, 20) ;~ Global $Graphic = GUICtrlCreateGraphic(176, 55, 20, 2) ;~ Global $Graphic = GUICtrlCreateGraphic(176, 73, 20, 2) ;~ Global $Graphic = GUICtrlCreateGraphic(0, 0, 1, 1) EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Local $aWinPos = WinGetPos("MagWin") $pWindowMagWinX = $aWinPos[0] $pWindowMagWinY = $aWinPos[1] ;GUISetState(@SW_HIDE, $hGUI3) GUIDelete($hGUI3) ; Clear up Mag GUI _WinAPI_SelectObject($hMagDC, $oObj) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDeskDC) _WinAPI_ReleaseDC($hMag_GUI, $hMagDC) ;GUISetState(@SW_HIDE, $hMag_G GUIDelete($hGUI4) GUIDelete($hMag_GUI) ExitLoop Case $hButtonMOK GUISetState(@SW_HIDE, $hGUI3) Local $aWinPos = WinGetPos("Capture") Local $TWPx = $aWinPos[0]+81 ;+81 Top Left Corner; +85 Middle Local $TWPy = $aWinPos[1]+75 ;+75 Top Left Corner; +80 Middle ;*** WINDOW COORDS = x+81 & y+75 (top left of picker square) If $aWinPos[0] > 1440 Then $aWinPos[0] = $aWinPos[0]-1440 $TWPx = $TWPx-1440 EndIf Local $output0 = PixelCheckSum($TWPx-8, $TWPy-9, $TWPx-8+10, $TWPy+1) ;_FOEA_WinAPI_DrawRect(LRChecksum($TWPx-8), $TWPy-9, LRChecksum($TWPx-8)+10, $TWPy+1, 0xFFFFFF, 50) MsgBox($MB_SYSTEMMODAL, "Results ", _ "Window Coords" & @CRLF & _ $TWPx & "(" & $TWPx+1440 & "), " & $TWPy & @CRLF & _ "Checksum0: " & $output0 & @CRLF) GUISetState(@SW_SHOW, $hGUI3) WinActivate($hGUI3, "Capture") Case $hButtonMUp _FOEA_ButtonMUp() Case $hButtonMDown _FOEA_ButtonMDown() Case $hButtonMRight _FOEA_ButtonMRight() Case $hButtonMLeft _FOEA_ButtonMLeft() EndSwitch WEnd Func _FOEA_Loupe($aWinPos) Local $iX, $iY DllCall("gdi32.dll", "int", "StretchBlt", _ "int", $hMagDC, "int", 10, "int", 10, "int", 110, "int", 110, _ "int", $hDeskDC, "int", $aWinPos[0]+68, "int", $aWinPos[1]+61, "int", 20, "int", 20, _ "long", $SRCCOPY) DllCall("gdi32.dll", "int", "StretchBlt", _ "int", $hMagDC, "int", 130, "int", 10, "int", 110, "int", 110, _ "int", $hDeskDC, "int", $aWinPos[0]+70, "int", $aWinPos[1]+63, "int", 7, "int", 7, _ "long", $SRCCOPY) ; Appears initially - then disappears... Global $Graph1 = GUICtrlCreateGraphic(170, 57, 8, 16, $SS_WHITERECT) Global $Graph2 = GUICtrlCreateGraphic(170, 73, 31, 8, $SS_WHITERECT) Global $Graph3 = GUICtrlCreateGraphic(193, 57, 8, 16, $SS_WHITERECT) Global $Graph4 = GUICtrlCreateGraphic(170, 49, 31, 8, $SS_WHITERECT) ; This apears to be needed to stop the Magnify window moving Global $Graph5 = GUICtrlCreateGraphic(0, 0, 1, 1) ;Tried this too - no difference GUISetState(@SW_SHOW, $Graph1) GUISetState(@SW_SHOW, $Graph2) GUISetState(@SW_SHOW, $Graph3) GUISetState(@SW_SHOW, $Graph4) EndFunc ;==>Loupe Func _FOEA_ButtonMUp() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0], $aWinPos[1]-1) EndFunc Func _FOEA_ButtonMDown() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0], $aWinPos[1]+1) EndFunc Func _FOEA_ButtonMRight() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0]+1, $aWinPos[1]) EndFunc Func _FOEA_ButtonMLeft() Local $aWinPos = WinGetPos("Capture") WinMove($hGUI3, "Capture", $aWinPos[0]-1, $aWinPos[1]) EndFunc
  21. I'm trying to display a GIF. However, the GUI should not be visible. Here is an attempt that doesn't work: $sGIF = "MyGIF.gif" #Include <IE.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WINAPI.au3> #include <SendMessage.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", "_Exit") $hGui = GUICreate("Test", 400, 300, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 10, 10, 380, 280) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 250) _IENavigate($oIE, $sGIF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch WEnd Func _Exit() Exit
  22. Hi all, I've been looking around the forum and testing different ways of getting a 'drop zone' to work in my script, but I can't seem to get any response from the event listener. Code compiles perfectly. Chaning the control from a label to an input- or edit-field doesn't change its behaviour, still no response when a file is dropped on there... It might just be that I am overlooking a simple detail, so I'm hoping for an extra pair of eyes here or there who can spot why this isn't working as it should. I have another 3500+ lines script where I have basically the same bit of code, and it seems to work in there without problems. So, here it goes: Global $DD_GUI = GUICreate("DicomDrop",200,200,-1,-1,BitOR($WS_SYSMENU,$WS_POPUP),$WS_EX_ACCEPTFILES) GUISetBkColor(0x030303,$DD_GUI) $DD_GUI_DRAGLABEL = GUICtrlCreateLabel("",0,0,32,32,-1, $GUI_WS_EX_PARENTDRAG) $DD_GUI_DRAGIMAGE = GUICtrlCreateIcon(@ScriptFullPath,201,0,0,32,32) $DD_GUI_TITLELABEL = GUICtrlCreateLabel("DicomDrop",50,10,100,20,$SS_CENTER) GUICtrlSetFont($DD_GUI_TITLELABEL,8,$FW_SEMIBOLD,$GUI_FONTNORMAL,"Verdana") GUICtrlSetColor($DD_GUI_TITLELABEL,0xFFFFFF) $DD_GUI_CLOSE = GUICtrlCreateButton("X",174,4,24,24,$BS_FLAT) GUICtrlSetBkColor($DD_GUI_CLOSE,0x030303) GUICtrlSetColor($DD_GUI_CLOSE,0xFFFFFF) Global $DD_GUI_DROPZONE = GUICtrlCreateLabel("",10,42,180,148) GUICtrlSetState(-1,8) GUICtrlSetBkColor($DD_GUI_DROPZONE,0x181818) GUISetState(@SW_SHOW,$DD_GUI) Local $DD_MSG = 0 While 1 $DD_MSG = GUIGetMsg() Select Case $DD_MSG = $GUI_EVENT_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by GUI_EVENT_CLOSE") DD_EXIT() Case $DD_MSG = $GUI_EVENT_DROPPED If @GUI_DropId = $DD_GUI_DROPZONE Then Local $DroppedFile = @GUI_DragFile GUIDelete() ConsoleWrite(@CRLF & "Debug -- Dropped file : " & $DroppedFile) EndIf Case $DD_MSG = $DD_GUI_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by DD_GUI_CLOSEIMAGE") DD_EXIT() EndSelect WEnd Func DD_EXIT() GUIDelete($DD_GUI) Exit EndFunc If anyone has any idea whatsoever, please let me know 🙂 Thanks in advance and kind regards, Jan
  23. Hi all, I am creating a GUI library in Nim with win32 API functions. Even though the syntax is similar to Python, coding is almost similar to C in Nim. I can change the back color of the button in NM_CUSTOMDRAW. But I can't change the button text color. here is my pseudo code. proc setBtnBackColor*(me : Button, lp: LPNMCUSTOMDRAW ) = if lp.uItemState and CDIS_SELECTED : #------------------ btn clicked # Here i am changing the button color with SelectObject & FillRect. elif lp.uItemState and CDIS_HOT : # ----------------Mouse over # Here i am changing the button's mouse hover color with SelectObject & FillRect. else: # -------------------------Default color set # Here i am changing the button's default color with SelectObject & FillRect. # Here i tried---> SetTextColor(lp.hdc, RGB(102, 255, 51) ) #------- But no luck. #------------------------------------------------------------------------- Please guide me. What i am doing wrong here ? I am returning "CDRF_SKIPDEFAULT" after calling this function. Note : I am using subclassed button. So when the parent window receives WM_NOTIFY message, it sends that to my button's WndProc. There i am handling the message.
  24. I am not able to use the $GUI_READ_EXTENDED with the Metro UDF, any work around ? Local $aPos[2] = [$Radio1, $Radio2] For $Radio In $aPos If GUICtrlRead($Radio) = $GUI_UNCHECKED Then ContinueLoop IniWrite($sGUIstate_IniFile, "Data", "POS", GUICtrlRead($Radio, $GUI_READ_EXTENDED)) ;; return the text of the menu item ExitLoop Next
  25. I use SetSoundDevice to control my audio devices but the UI was either blurry like this: or unusable like this: so I made this horrible thing to add scaling to the GUI: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_HiDpi=y #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/sf /sv /rm #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> ;~ _convertGUI("") If $CmdLine[0] <> 0 Then _convertGUI($CmdLine[1]) Func _convertGUI($sFilePath) If $sFilePath <> "" Then Local $aArray = FileReadToArray($sFilePath) Else ;TEST DATA Local $aArray[6] = ['$H_Res_Language = GUICtrlCreateProgress(5, 120, 210 + 25, 480, 20, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE)) ; $CBS_DROPDOWNLIST)', _ 'Local $h_Ok = GUICtrlCreateButton("Ok", 72, 224, 81, 33, 0)', _ 'GUICreate($Warning_TiTle, 700, 310, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX)', _ 'GUICtrlCreateLabel("Output type: ", 30, 130, 65, 20) ;, $SS_RIGHT)', _ '$H_FieldNameEdit = GUICtrlCreateEdit($INP_FieldNameEdit, 100,260+25, 500, 150 - 25) ;comment', 'Local $H_CANCEL = GUICtrlCreateGraphic("Cancel", 224, 224, 97, 33, 0)'] EndIf Local $hTimer = TimerInit(), $iGUIElementCount = 0, $sResult = "", $sFileName = "", $sDrive = "", $sDir = "", $sExtension = "" If @Compiled Then _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) $sFileName = StringRegExpReplace($sFilePath, "^.*\\", "") EndIf For $i = 0 To (UBound($aArray) - 1) If StringRegExp($aArray[$i], "GUICtrlCreate|GUICreate") Then $sResult = _splitComma($aArray[$i]) If Not @error Then $aArray[$i] = $sResult $iGUIElementCount += 1 EndIf Next ConsoleWrite("t = " & TimerDiff($hTimer) & " GUI elements = " & $iGUIElementCount & " lines = " & (UBound($aArray) - 1) & @CRLF) If $sFileName <> "" Then Local $hFile = FileOpen("edited." & $sFileName, 2) _FileWriteFromArray("edited." & $sFileName, $aArray) FileClose($hFile) EndIf Exit EndFunc ;==>_convertGUI Func _splitComma($sString) Local $sSplitResult = "", $sTrimmedR = "", $sTrimmedL = "" Local $aSplit = StringSplit($sString, ',') If Not @error Then $sTrimmedR = "" $sTrimmedL = "" For $j = 1 To $aSplit[0] If StringRegExp($aSplit[1], "(?:.GUICtrlCreateGraphic|GUICtrlCreateProgress|GUICtrlCreateSlider|GUICtrlCreateTab|GUICtrlCreateTreeView)") Then If $j = 1 Then While StringLeft($aSplit[$j], 1) <> '(' $sTrimmedL &= StringLeft($aSplit[$j], 1) $aSplit[$j] = StringTrimLeft($aSplit[$j], 1) WEnd $aSplit[$j] = StringTrimLeft($aSplit[$j], 1) EndIf EndIf If $j = $aSplit[0] Then While StringRight($aSplit[$j], 1) <> ')' $sTrimmedR &= StringRight($aSplit[$j], 1) $aSplit[$j] = StringTrimRight($aSplit[$j], 1) WEnd $aSplit[$j] = StringTrimRight($aSplit[$j], 1) EndIf If StringRegExp($aSplit[$j], "[0-9]") And $aSplit[$j] <> -1 And $aSplit[$j] <> 0 And $aSplit[$j] <> 1 And Not StringInStr($aSplit[$j], ')') Then If StringRegExp($aSplit[$j], "\-|\+") Then ;put parenthesis around + or - $aSplit[$j] = '(' & $aSplit[$j] & ")*$g_DPI" Else $aSplit[$j] = $aSplit[$j] & "*$g_DPI" EndIf EndIf If $j < $aSplit[0] Then $sSplitResult &= $aSplit[$j] & ',' ElseIf $j = $aSplit[0] Then $sSplitResult &= $aSplit[$j] & ')' Else $sSplitResult &= $aSplit[$j] EndIf Next If $sTrimmedR <> "" Then $sSplitResult &= StringReverse($sTrimmedR) If $sTrimmedL <> "" Then $sSplitResult = $sTrimmedL & '(' & $sSplitResult Else SetError(1) Return EndIf ConsoleWrite($sSplitResult & @CRLF) Return $sSplitResult EndFunc ;==>_splitComma And now it looks good: but it doesn't work on everything, for example the "GUICtrlCreateLabel("Output type: ", 30, 130, 65, 20) ;, $SS_RIGHT)" (from the autoit3wrapper gui) because the comment contains a parenthesis and it would break completely if there were variables as parameters.. Is there some kind of parser around that I could use instead or maybe someone who has already done something like this?
×
×
  • Create New...