Jump to content

Recommended Posts

Hi, recently i created a GUI for some calculations in AutoIT.  The GUI has 2 tabs and on the first tab, it has few inputboxes where i use to click with mouse and start entering the inputs. i recently made some changes in the position of these textboxes. I made this by changing the autoit code file instead of making changes in KODA. Now i cannot click inside these textboxes with mouse. However, i can use TAB key to cycle through/enter input in these input boxes. what could have made the inputboxes not responding to mouseclicks. thanks

Link to post
Share on other sites
  • Moderators

@Rskm how about posting the code so we can see what you're seeing, rather than asking us to guess?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites
10 hours ago, JLogan3o13 said:

@Rskm how about posting the code so we can see what you're seeing, rather than asking us to guess?

Hi, The code is here.. so when i run this, on the Tab 1, there is a text box 'location of the ....' i am not able to click in this with the mouse now.  But if i use Tab on keyboard, i can enter the input. i am not sure why mouse clicks are not accepted now.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\Users\RajithRadhakrishnan\Downloads\untitled_JPA_icon.ico
#Tidy_Parameters=/sdp ?C:\Program Files\gnuplot\bin\gnuplot.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <file.au3>
#include <string.au3>
#include <WinAPIFiles.au3>
#include <StringConstants.au3>
#include <date.au3>
#include <Math.au3>
#include <Excel.au3>
#include <ExcelConstants.au3>
#include <Color.au3>
#include <MsgBoxConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=d:\my_autoitscripts\cribbing\cribbing_check\gui2\gui_cribbing.kxf
Global $Form1_1 = GUICreate("Cribbing Program", 344, 900, -1, -1)
Global $MAIN = GUICtrlCreateTab(0, 0, 344, 895)
;
Global $TabSheet1 = GUICtrlCreateTabItem("Cribbing_Coord")
;
Global $Label3 = GUICtrlCreateLabel("This section of the program extracts coordinates for the proposed cribbing pattern", 16, 40,300,200)
Global $Labe33 = GUICtrlCreateLabel("1. Input 1", 16, 80,300,200)
Global $Labe34 = GUICtrlCreateLabel("2. Input 2", 16, 120,300,200)
Global $Labe34 = GUICtrlCreateLabel("3. Input 3", 16, 185,300,200)
Global $Labe35 = GUICtrlCreateLabel("4. Instructions", 16, 250,300,200)

;
Global $Label1 = GUICtrlCreateLabel("Location for the .DXF file/ Coord file  :", 16, 320, 265, 22)
Global $kod_locn = GUICtrlCreateInput(" ", 16, 340, 280, 26)
;
Global $Label23 = GUICtrlCreateLabel("Name of the .DXF file :", 16, 370, 165, 22)
;~
Global $kod_dwf_name = GUICtrlCreateInput(".DXF", 16, 390, 280, 26)
;
Global $Label2 = GUICtrlCreateLabel("Thickness of the cribbing (m) :", 16, 420, 165, 22)
Global $kod_cribthk = GUICtrlCreateInput("0.3", 16, 440, 281, 26)
Global $Button1 = GUICtrlCreateButton("Extract from DXF", 16, 470, 105, 35)
Global $Button11 = GUICtrlCreateButton("Template File", 16, 520, 105, 35)
;
;
;
Global $TabSheet2 = GUICtrlCreateTabItem("Analysis")
GUICtrlSetState(-1,$GUI_SHOW)
Global $Label7 = GUICtrlCreateLabel("This section calculates the stresses in the proposed cribbing. ", 8, 32, 300, 17)
Global $Group1 = GUICtrlCreateGroup("Jack-Up/HLV  Data", 8, 80, 321, 193)
Global $Label4 = GUICtrlCreateLabel("Mass of the Jack-Up (Te):", 16, 128, 190, 25)
Global $kod_jh = GUICtrlCreateInput("Jack Up, HLV", 208, 104, 121, 21)
Global $Label5 = GUICtrlCreateLabel("CofG of the Jack-Up in X (m):", 16, 152, 142, 17)
Global $kod_mass = GUICtrlCreateInput("", 208, 128, 121, 21)
Global $Label6 = GUICtrlCreateLabel("CofG of the Jack-Up in Y (m):", 16, 176, 142, 17)
Global $kod_cogx = GUICtrlCreateInput("", 208, 152, 121, 21)
Global $Label9 = GUICtrlCreateLabel("CofG of the Jack-Up in Z (m):", 16, 200, 142, 17)
Global $kod_cogy = GUICtrlCreateInput("", 208, 176, 121, 21)
Global $Label10 = GUICtrlCreateLabel("Name of Jack-Up, HLV name:", 16, 104, 142, 21)
Global $kod_cogz = GUICtrlCreateInput("", 208, 200, 121, 21)
Global $Label11 = GUICtrlCreateLabel("Mass MomInertia in Pitching(Te.m2):", 16, 224,190, 17)
Global $kod_pinertia = GUICtrlCreateInput("", 208, 224, 121, 21)
Global $Label12 = GUICtrlCreateLabel("Mass MomInertia in Rolling(Te.m2):", 16, 248,190, 17)
Global $kod_rinertia = GUICtrlCreateInput("", 208, 248, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Global $Label8 = GUICtrlCreateLabel("X,Y are respectively Longitudinal,Transverse axis for the Carrier vessel", 8, 56, 300, 17)
Global $Group2 = GUICtrlCreateGroup("Motions (Pitching)", 8, 280, 321, 121)
Global $Label13 = GUICtrlCreateLabel("Surge Acceleration (m/s2) :", 16, 304, 133, 17)
Global $Label14 = GUICtrlCreateLabel("Pitch Acceleration (Deg/s2) :", 16, 328, 190, 17)
Global $Label15 = GUICtrlCreateLabel("Pitch Angle (Deg) :", 16, 352, 93, 17)
Global $Label16 = GUICtrlCreateLabel("Heave Acceleration (m/s2)", 16, 376, 131, 17)
Global $kod_surge = GUICtrlCreateInput("", 208, 304, 121, 21)
Global $kod_pitch_accln = GUICtrlCreateInput("", 208, 328, 121, 21)
Global $kod_pitch_angle = GUICtrlCreateInput("", 208, 352, 121, 21)
Global $kod_p_heave = GUICtrlCreateInput("", 208, 376, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Motions = GUICtrlCreateGroup("Motions (Rolling)", 8, 408, 321, 121)
Global $kod = GUICtrlCreateLabel("Sway Acceleration (m/s2) :", 16, 432, 131, 17)
Global $Label17 = GUICtrlCreateLabel("Roll Acceleration (Deg/s2) :", 16, 456, 190, 17)
Global $Label18 = GUICtrlCreateLabel("Roll Angle (Deg) :", 16, 480, 87, 17)
Global $Label19 = GUICtrlCreateLabel("Heave Acceleration (m/s2) :", 16, 504, 137, 17)
Global $kod_sway = GUICtrlCreateInput("", 208, 432, 121, 21)
Global $kod_roll_accln = GUICtrlCreateInput("", 208, 456, 121, 21)
Global $kod_roll_angle = GUICtrlCreateInput("", 208, 480, 121, 21)
Global $kod_r_heave = GUICtrlCreateInput("", 208, 504, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group3 = GUICtrlCreateGroup("Wind Data (1 Hr )", 8, 536, 321, 169)
Global $Label20 = GUICtrlCreateLabel("Wind force along Longi, Fx (kN) :", 16, 560, 190, 17)
Global $Label21 = GUICtrlCreateLabel("CoE above the cribbing for Fx (m)  :", 16, 584, 190, 17)
Global $Label22 = GUICtrlCreateLabel("Wind force along Transverse, Fy (kN) :", 16, 608, 190, 17)
Global $Label23 = GUICtrlCreateLabel("CoE above the cribbing for Fy (m) :", 16, 632,190, 17)
Global $Label24 = GUICtrlCreateLabel("Trim, about Transverse axis (Deg) :", 16, 656, 166, 17)
Global $Label25 = GUICtrlCreateLabel("Heel, about Longitudinal axis (Deg) :", 16, 680, 172, 17)
Global $kod_wind_fx = GUICtrlCreateInput("", 208, 560, 121, 21)
Global $kod_coe_x = GUICtrlCreateInput("", 208, 584, 121, 21)
Global $kod_wind_fy = GUICtrlCreateInput("", 208, 608, 121, 21)
Global $kod_coe_y = GUICtrlCreateInput("", 208, 632, 121, 21)
Global $kod_trim = GUICtrlCreateInput("", 208, 656, 121, 21)
Global $kod_heel = GUICtrlCreateInput("", 208, 680, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Label26 = GUICtrlCreateLabel("Location of cribbing data:", 16, 712, 150, 17)
Global $kod_cribfilefolder = GUICtrlCreateInput("", 208, 712, 121, 21)
;~ Global $kod_cribfilefolder = GUICtrlCreateInput("D:\my_autoitscripts\cribbing\new", 208, 712, 121, 21)
Global $Label27 = GUICtrlCreateLabel("File name for cribbing data :", 16, 740, 150, 17)
Global $kod_cribfile = GUICtrlCreateInput("coords_.txt", 208, 740, 121, 21)


Global $Label28 = GUICtrlCreateLabel("File name for output file:", 16, 770, 137, 17)
Global $kod_outname = GUICtrlCreateInput("Tmp.txt", 208, 770, 121, 21)

Global $Label29 = GUICtrlCreateLabel("Crop factor for verification (m):", 16, 800, 157, 20)
Global $kod_crop = GUICtrlCreateInput("1", 208, 800, 121, 20)
Global $Button2 = GUICtrlCreateButton("Run", 208, 830, 121, 25)
Global $Readme = GUICtrlCreateButton("Read me", 20, 830, 121, 25)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit


        Case $Button11
            Global $dir=guictrlread($kod_locn)
            FileDelete($dir&"\Coord_crib.txt")
            Global $coordfile=fileopen($dir&"\Coord_crib.txt",1)
            Filewrite($coordfile,"! This file has coordinates for the cribbing program"&@CRLF)
            Filewrite($coordfile,"! DXF File         : No DXF file used. Coordinates are entered manually in this file"&@CRLF)
            Filewrite($coordfile,"! Additional Notes : X1, Y1, X2, Y2 & Thk to be entered with a comma"&@CRLF)
            Filewrite($coordfile,"! Prepared on      : "&@MDAY & "/" & @MON & "/" & @YEAR  & " " & @HOUR & ":" & @MIN & ":" & @SEC&@CRLF)
            Filewrite($coordfile,"     X1  ,     Y1  ,     X2  ,      Y2 ,  Thk"&@CRLF)
            fileclose($coordfile)
            Msgbox(0,"Status","Template file 'Coord_crib.txt' created")
            Exit


            Endswitch

Wend

 

Edited by Melba23
Added code tags
Link to post
Share on other sites
  • Moderators

Rskm,

When you post code in future please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation.

And please do not double post - I have deleted the duplicate.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

Your issue is caused by these lines ---

Global $Labe33 = GUICtrlCreateLabel("1. Input 1", 16, 80,300,200)
Global $Labe34 = GUICtrlCreateLabel("2. Input 2", 16, 120,300,200)
Global $Labe34 = GUICtrlCreateLabel("3. Input 3", 16, 185,300,200)
Global $Labe35 = GUICtrlCreateLabel("4. Instructions", 16, 250,300,200)

With a height of 200, they are overlapping the lower controls thus preventing them from being clicked with the mouse.

Link to post
Share on other sites
On 7/29/2020 at 10:25 AM, Melba23 said:

Rskm,

When you post code in future please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation.

And please do not double post - I have deleted the duplicate.

M23

ok, noted. thanks 

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By It_is_me_Me
      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.
    • By dejhost
      Hi.
      I am trying to automate a software called "LabelImg" (https://pypi.org/project/labelImg/).
      My autoit-script is started once I selected a folder with images within LabelImg. Pressing the button "Next Image" or pressing the shortcut "d" (https://github.com/tzutalin/labelImg#Hotkeys) jumps to the next image in the selected folder. This shall happen once per second.
      #include <Misc.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> Opt("WinTitleMatchMode", 1) Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("1B", $hDLL) Then ExitLoop Else Local $temp = WinActivate("labelImg") ConsoleWrite($temp & @CRLF) If WinActivate("labelImg") Then ConsoleWrite("All Set!" & @CRLF) EndIf ;Send("d") Local $temp = MouseClick($MOUSE_CLICK_RIGHT, 50, 200) If $temp <> 1 Then MsgBox(1, "$temp", $temp) ExitLoop EndIf Sleep(1000) EndIf WEnd DllClose($hDLL) So the Send ("d")-command and the MouseClick are alternative methods to jump to the next image. Both fail.
      Both ConsoleWrite's deliver proper feedback (I continiously get the handle and "All set" ).

      Could you tell me what I'm doing wrong? 
      Thank you.
    • By CYBRIX
      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  
    • By mLipok
      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 ?
    • By Mo0C0w
      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  

×
×
  • Create New...